Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(analytics): adding outgoing webhooks kafka event #3140

Merged
merged 18 commits into from
Jan 5, 2024

Conversation

harsh-sharma-juspay
Copy link
Contributor

@harsh-sharma-juspay harsh-sharma-juspay commented Dec 15, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

adding outgoing webhook Kafka event

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

create Successful Payment or refund or dispute or mandate
then check Kafka topic outgoing_webhook_logs_topic triggered web hook should have logged as example commented below

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@harsh-sharma-juspay harsh-sharma-juspay requested review from a team as code owners December 15, 2023 11:14
@github-actions github-actions bot added the S-conventions-not-followed Status: This PR does not follow contributing guidelines label Dec 15, 2023
@harsh-sharma-juspay harsh-sharma-juspay changed the title Outgoing webhook event feat(analytics): adding outgoing webhooks kafka event Dec 15, 2023
@github-actions github-actions bot removed the S-conventions-not-followed Status: This PR does not follow contributing guidelines label Dec 15, 2023
@harsh-sharma-juspay harsh-sharma-juspay self-assigned this Dec 15, 2023
@harsh-sharma-juspay harsh-sharma-juspay added the A-webhooks Area: Webhook flows label Dec 15, 2023
@harsh-sharma-juspay
Copy link
Contributor Author

Expected Kafka_Event for OutgoingWebhook

{
	"merchant_id": "merchant_1702641252",
	"event_id": "pay_x79pY1mnTNtyAQyCm5gT_payment_succeeded",
	"event_type": "payment_succeeded",
	"outgoing_webhook_event_type": "payment",
	"payment_id": "pay_x79pY1mnTNtyAQyCm5gT",
	"content": {
		"payment_id": "pay_x79pY1mnTNtyAQyCm5gT",
		"merchant_id": "merchant_1702641252",
		"status": "succeeded",
		"amount": 6540,
		"amount_capturable": 0,
		"amount_received": 6540,
		"connector": "stripe",
		"client_secret": "pay_x79pY1mnTNtyAQyCm5gT_secret_H9I8KFhdUvm3flLg7CAc",
		"created": "2023-12-15T13:26:30.376Z",
		"currency": "USD",
		"customer_id": "StripeCustomer",
		"description": "Its my first payment request",
		"refunds": null,
		"disputes": null,
		"mandate_id": null,
		"mandate_data": null,
		"setup_future_usage": null,
		"off_session": null,
		"capture_on": null,
		"capture_method": "automatic",
		"payment_method": "card",
		"payment_method_data": {
			"card": {
				"last4": "4242",
				"card_type": null,
				"card_network": null,
				"card_issuer": null,
				"card_issuing_country": null,
				"card_isin": "424242",
				"card_exp_month": "10",
				"card_exp_year": "25",
				"card_holder_name": "joseph Doe"
			}
		},
		"payment_token": null,
		"shipping": {
			"address": {
				"city": "San Fransico",
				"country": "US",
				"line1": "1467",
				"line2": "Harrison Street",
				"line3": "Harrison Street",
				"zip": "94122",
				"state": "California",
				"first_name": "joseph",
				"last_name": "Doe"
			},
			"phone": {
				"number": "8056594427",
				"country_code": "+91"
			}
		},
		"billing": {
			"address": {
				"city": "San Fransico",
				"country": "US",
				"line1": "1467",
				"line2": "Harrison Street",
				"line3": "Harrison Street",
				"zip": "94122",
				"state": "California",
				"first_name": "joseph",
				"last_name": "Doe"
			},
			"phone": {
				"number": "8056594427",
				"country_code": "+91"
			}
		},
		"order_details": null,
		"email": "guest@example.com",
		"name": "John Doe",
		"phone": "999999999",
		"return_url": "https://google.com/",
		"authentication_type": "no_three_ds",
		"statement_descriptor_name": "joseph",
		"statement_descriptor_suffix": "JS",
		"next_action": null,
		"cancellation_reason": null,
		"error_code": null,
		"error_message": null,
		"unified_code": null,
		"unified_message": null,
		"payment_experience": null,
		"payment_method_type": "credit",
		"connector_label": null,
		"business_country": null,
		"business_label": "default",
		"business_sub_label": null,
		"allowed_payment_method_types": null,
		"ephemeral_key": {
			"customer_id": "StripeCustomer",
			"created_at": 1702646790,
			"expires": 1702650390,
			"secret": "epk_3def6aeb2bf74c46818fa34d76829071"
		},
		"manual_retry_allowed": false,
		"connector_transaction_id": "pi_3ONbPPD5R7gDAGff1GBHOABD",
		"frm_message": null,
		"metadata": {
			"udf1": "value1",
			"login_date": "2019-09-10T10:11:12Z",
			"new_customer": "true"
		},
		"connector_metadata": null,
		"feature_metadata": null,
		"reference_id": "pi_3ONbPPD5R7gDAGff1GBHOABD",
		"payment_link": null,
		"profile_id": "pro_dJTN6uGsYIuKeeG9IsgV",
		"surcharge_details": null,
		"attempt_count": 1,
		"merchant_decision": null,
		"merchant_connector_id": "mca_FmLwc8mWoZR22H1nt4Ce",
		"incremental_authorization_allowed": null,
		"authorization_count": null,
		"incremental_authorizations": null
	},
	"is_error": false,
	"error": null,
	"created_at_timestamp": 1702646793711
}

@harsh-sharma-juspay
Copy link
Contributor Author

Screenshot 2023-12-15 at 7 03 55 PM

Copy link
Member

@lsampras lsampras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add the corresponding schema in crates/analytics/docs/scripts/webhook_events.sql

config/development.toml Outdated Show resolved Hide resolved
ivor11
ivor11 previously approved these changes Dec 18, 2023
@harsh-sharma-juspay
Copy link
Contributor Author

Screenshot 2024-01-05 at 1 03 20 PM

@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 5, 2024
Merged via the queue into main with commit 1d26df2 Jan 5, 2024
10 of 12 checks passed
@likhinbopanna likhinbopanna deleted the outgoing_webhook_event branch January 5, 2024 10:45
pixincreate added a commit that referenced this pull request Jan 8, 2024
* 'main' of github.com:juspay/hyperswitch:
  fix(connector): [Stripe] Deserialization Error while parsing Dispute Webhook Body (#3256)
  refactor(euclid_wasm): Update wasm config (#3222)
  fix(analytics): added response to the connector outgoing event (#3129)
  fix(analytics): fixed response code to 501 (#3119)
  fix(connector): [NMI] Populating `ErrorResponse` with required fields and Mapping `connector_response_reference_id` (#3214)
  feat(merchant_account): Add list multiple merchants in `MerchantAccountInterface` (#3220)
  feat: include version number in response headers and on application startup (#3045)
  chore: address Rust 1.75 clippy lints (#3231)
  feat: add deep health check (#3210)
  feat(analytics): adding outgoing webhooks kafka event (#3140)
  refactor: address panics due to indexing and slicing (#3233)
  fix(users): Fix wrong redirection url in magic link (#3217)
  fix(user): add integration_completed enum in metadata type (#3245)
  chore(version): v1.106.1
  fix(connector): [iatapay] change refund amount (#3244)
  chore(version): v1.106.0
  test(postman): update postman collection files
  fix(core): fix recurring mandates flow for cyber source (#3224)
  chore: fix channel handling for consumer workflow loop (#3223)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-webhooks Area: Webhook flows
Projects
No open projects
Status: Candidate
Development

Successfully merging this pull request may close these issues.

5 participants