File tree Expand file tree Collapse file tree 9 files changed +16
-4
lines changed
migrations/2023-10-13-100447_add-payment-cancelled-event-type Expand file tree Collapse file tree 9 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ pub enum IncomingWebhookEvent {
12
12
PaymentIntentSuccess ,
13
13
PaymentIntentProcessing ,
14
14
PaymentIntentPartiallyFunded ,
15
+ PaymentIntentCancelled ,
15
16
PaymentActionRequired ,
16
17
EventNotSupported ,
17
18
SourceChargeable ,
@@ -84,7 +85,8 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
84
85
| IncomingWebhookEvent :: PaymentIntentSuccess
85
86
| IncomingWebhookEvent :: PaymentIntentProcessing
86
87
| IncomingWebhookEvent :: PaymentActionRequired
87
- | IncomingWebhookEvent :: PaymentIntentPartiallyFunded => Self :: Payment ,
88
+ | IncomingWebhookEvent :: PaymentIntentPartiallyFunded
89
+ | IncomingWebhookEvent :: PaymentIntentCancelled => Self :: Payment ,
88
90
IncomingWebhookEvent :: EventNotSupported => Self :: ReturnResponse ,
89
91
IncomingWebhookEvent :: RefundSuccess | IncomingWebhookEvent :: RefundFailure => {
90
92
Self :: Refund
Original file line number Diff line number Diff line change @@ -794,6 +794,7 @@ pub enum EventType {
794
794
PaymentSucceeded ,
795
795
PaymentFailed ,
796
796
PaymentProcessing ,
797
+ PaymentCancelled ,
797
798
ActionRequired ,
798
799
RefundSucceeded ,
799
800
RefundFailed ,
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ fn get_stripe_event_type(event_type: api_models::enums::EventType) -> &'static s
168
168
api_models:: enums:: EventType :: PaymentSucceeded => "payment_intent.succeeded" ,
169
169
api_models:: enums:: EventType :: PaymentFailed => "payment_intent.payment_failed" ,
170
170
api_models:: enums:: EventType :: PaymentProcessing => "payment_intent.processing" ,
171
+ api_models:: enums:: EventType :: PaymentCancelled => "payment_intent.canceled" ,
171
172
172
173
// the below are not really stripe compatible because stripe doesn't provide this
173
174
api_models:: enums:: EventType :: ActionRequired => "action.required" ,
Original file line number Diff line number Diff line change @@ -1844,6 +1844,9 @@ impl api::IncomingWebhook for Stripe {
1844
1844
stripe:: WebhookEventType :: PaymentIntentSucceed => {
1845
1845
api:: IncomingWebhookEvent :: PaymentIntentSuccess
1846
1846
}
1847
+ stripe:: WebhookEventType :: PaymentIntentCanceled => {
1848
+ api:: IncomingWebhookEvent :: PaymentIntentCancelled
1849
+ }
1847
1850
stripe:: WebhookEventType :: ChargeSucceeded => {
1848
1851
if let Some ( stripe:: WebhookPaymentMethodDetails {
1849
1852
payment_method :
@@ -1898,7 +1901,6 @@ impl api::IncomingWebhook for Stripe {
1898
1901
| stripe:: WebhookEventType :: ChargePending
1899
1902
| stripe:: WebhookEventType :: ChargeUpdated
1900
1903
| stripe:: WebhookEventType :: ChargeRefunded
1901
- | stripe:: WebhookEventType :: PaymentIntentCanceled
1902
1904
| stripe:: WebhookEventType :: PaymentIntentCreated
1903
1905
| stripe:: WebhookEventType :: PaymentIntentProcessing
1904
1906
| stripe:: WebhookEventType :: PaymentIntentAmountCapturableUpdated
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ fn default_webhook_config() -> api::MerchantWebhookConfig {
17
17
api:: IncomingWebhookEvent :: PaymentIntentSuccess ,
18
18
api:: IncomingWebhookEvent :: PaymentIntentFailure ,
19
19
api:: IncomingWebhookEvent :: PaymentIntentProcessing ,
20
+ api:: IncomingWebhookEvent :: PaymentIntentCancelled ,
20
21
api:: IncomingWebhookEvent :: PaymentActionRequired ,
21
22
api:: IncomingWebhookEvent :: RefundSuccess ,
22
23
] )
Original file line number Diff line number Diff line change @@ -257,8 +257,8 @@ impl ForeignFrom<api_enums::IntentStatus> for Option<storage_enums::EventType> {
257
257
| api_enums:: IntentStatus :: RequiresCustomerAction => {
258
258
Some ( storage_enums:: EventType :: ActionRequired )
259
259
}
260
- api_enums:: IntentStatus :: Cancelled
261
- | api_enums:: IntentStatus :: RequiresPaymentMethod
260
+ api_enums:: IntentStatus :: Cancelled => Some ( storage_enums :: EventType :: PaymentCancelled ) ,
261
+ api_enums:: IntentStatus :: RequiresPaymentMethod
262
262
| api_enums:: IntentStatus :: RequiresConfirmation
263
263
| api_enums:: IntentStatus :: RequiresCapture
264
264
| api_enums:: IntentStatus :: PartiallyCaptured => None ,
Original file line number Diff line number Diff line change
1
+ -- This file should undo anything in `up.sql`
2
+ Select 1 ;
Original file line number Diff line number Diff line change
1
+ -- Your SQL goes here
2
+ ALTER TYPE " EventType" ADD VALUE ' payment_cancelled' ;
Original file line number Diff line number Diff line change 5076
5076
" payment_succeeded" ,
5077
5077
" payment_failed" ,
5078
5078
" payment_processing" ,
5079
+ " payment_cancelled" ,
5079
5080
" action_required" ,
5080
5081
" refund_succeeded" ,
5081
5082
" refund_failed" ,
You can’t perform that action at this time.
0 commit comments