-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor: [Checkout] change payment and webhooks API contract #4023
Conversation
}; | ||
|
||
return Ok(api_models::webhooks::ObjectReferenceId::RefundId( | ||
refund_reference, | ||
)); | ||
} | ||
Ok(api_models::webhooks::ObjectReferenceId::PaymentId( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to handle with Hyperswitch reference attempt_id first, if it is not provided use checkout's connector transaction id
| CheckoutWebhookEventType::PaymentCanceled | ||
| CheckoutWebhookEventType::PaymentVoided |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle these status in Psync then map it here
@@ -450,6 +453,16 @@ pub enum CheckoutPaymentStatus { | |||
CardVerified, | |||
Declined, | |||
Captured, | |||
#[serde(rename = "Retry Scheduled")] | |||
RetryScheduled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please raise this with connector and get clarity on when do we get this status?
CheckoutPaymentStatus::CardVerified | CheckoutPaymentStatus::RetryScheduled => { | ||
Self::Pending | ||
} | ||
CheckoutPaymentStatus::Voided | CheckoutPaymentStatus::Canceled => Self::Voided, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we get this Canceled status? if this is during authentication then should be mapped to payment failure
CheckoutPaymentStatus::CardVerified | CheckoutPaymentStatus::RetryScheduled => { | ||
Self::Pending | ||
} | ||
CheckoutPaymentStatus::Voided | CheckoutPaymentStatus::Canceled => Self::Voided, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we get this Canceled status? if this is during authentication then should be mapped to payment failure
CheckoutPaymentStatus::CardVerified | CheckoutPaymentStatus::RetryScheduled => { | ||
Self::Pending | ||
} | ||
CheckoutPaymentStatus::Voided | CheckoutPaymentStatus::Canceled => Self::Voided, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we get this Canceled status? if this is during authentication then should be mapped to payment failure
CheckoutWebhookEventType::PaymentApproved => Self::EventNotSupported, | ||
CheckoutWebhookEventType::PaymentCaptured => Self::PaymentIntentSuccess, | ||
CheckoutWebhookEventType::PaymentDeclined => Self::PaymentIntentFailure, | ||
CheckoutWebhookEventType::PaymentRefunded => Self::RefundSuccess, | ||
CheckoutWebhookEventType::PaymentRefundDeclined => Self::RefundFailure, | ||
CheckoutWebhookEventType::PaymentCanceled => Self::PaymentIntentCancelled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we get this Canceled status? if this is during authentication then should be mapped to payment failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Occurs when the customer has canceled the payment via a provider's platform.
Type of Change
Description
Resolves 4486
Additional Changes
Motivation and Context
How did you test it?
Create a Card Non 3ds and 3ds payment and do refund for the same. Also configure webhooks and check for all the events.
On Checkout dashboard you can configure Webhooks from
Developer -> Webhooks -> New Webhook
Under events enable
Disputes
andGateway
EventsPayment Create for card no 3ds
Paymnet Response for Card No 3ds
Do Payment Retrieve for the same Payment ID , status should be "succeeded"
Paymnet Request For Card 3ds
Payment Response for Card 3ds
Do Payment Retrieve for the same Payment ID, status should be "succeeded"
Do Refund for same Payment ID
Checklist
cargo +nightly fmt --all
cargo clippy