@@ -242,6 +242,7 @@ pub struct PaymentsRequest {
242
242
pub return_url : ReturnUrl ,
243
243
pub capture : bool ,
244
244
pub reference : String ,
245
+ pub metadata : Option < Secret < serde_json:: Value > > ,
245
246
}
246
247
247
248
#[ derive( Debug , Serialize , Deserialize ) ]
@@ -428,6 +429,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
428
429
let connector_auth = & item. router_data . connector_auth_type ;
429
430
let auth_type: CheckoutAuthType = connector_auth. try_into ( ) ?;
430
431
let processing_channel_id = auth_type. processing_channel_id ;
432
+ let metadata = item. router_data . request . metadata . clone ( ) ;
431
433
Ok ( Self {
432
434
source : source_var,
433
435
amount : item. amount . to_owned ( ) ,
@@ -437,6 +439,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
437
439
return_url,
438
440
capture,
439
441
reference : item. router_data . connector_request_reference_id . clone ( ) ,
442
+ metadata,
440
443
} )
441
444
}
442
445
}
@@ -450,6 +453,16 @@ pub enum CheckoutPaymentStatus {
450
453
CardVerified ,
451
454
Declined ,
452
455
Captured ,
456
+ #[ serde( rename = "Retry Scheduled" ) ]
457
+ RetryScheduled ,
458
+ Voided ,
459
+ #[ serde( rename = "Partially Captured" ) ]
460
+ PartiallyCaptured ,
461
+ #[ serde( rename = "Partially Refunded" ) ]
462
+ PartiallyRefunded ,
463
+ Refunded ,
464
+ Canceled ,
465
+ Expired ,
453
466
}
454
467
455
468
impl TryFrom < CheckoutWebhookEventType > for CheckoutPaymentStatus {
@@ -460,7 +473,14 @@ impl TryFrom<CheckoutWebhookEventType> for CheckoutPaymentStatus {
460
473
CheckoutWebhookEventType :: PaymentCaptured => Ok ( Self :: Captured ) ,
461
474
CheckoutWebhookEventType :: PaymentDeclined => Ok ( Self :: Declined ) ,
462
475
CheckoutWebhookEventType :: AuthenticationStarted
463
- | CheckoutWebhookEventType :: AuthenticationApproved => Ok ( Self :: Pending ) ,
476
+ | CheckoutWebhookEventType :: AuthenticationApproved
477
+ | CheckoutWebhookEventType :: AuthenticationAttempted => Ok ( Self :: Pending ) ,
478
+ CheckoutWebhookEventType :: AuthenticationExpired
479
+ | CheckoutWebhookEventType :: AuthenticationFailed
480
+ | CheckoutWebhookEventType :: PaymentAuthenticationFailed
481
+ | CheckoutWebhookEventType :: PaymentCaptureDeclined => Ok ( Self :: Declined ) ,
482
+ CheckoutWebhookEventType :: PaymentCanceled => Ok ( Self :: Canceled ) ,
483
+ CheckoutWebhookEventType :: PaymentVoided => Ok ( Self :: Voided ) ,
464
484
CheckoutWebhookEventType :: PaymentRefunded
465
485
| CheckoutWebhookEventType :: PaymentRefundDeclined
466
486
| CheckoutWebhookEventType :: DisputeReceived
@@ -494,10 +514,18 @@ impl ForeignFrom<(CheckoutPaymentStatus, Option<enums::CaptureMethod>)> for enum
494
514
Self :: Authorized
495
515
}
496
516
}
497
- CheckoutPaymentStatus :: Captured => Self :: Charged ,
498
- CheckoutPaymentStatus :: Declined => Self :: Failure ,
517
+ CheckoutPaymentStatus :: Captured
518
+ | CheckoutPaymentStatus :: PartiallyRefunded
519
+ | CheckoutPaymentStatus :: Refunded => Self :: Charged ,
520
+ CheckoutPaymentStatus :: PartiallyCaptured => Self :: PartialCharged ,
521
+ CheckoutPaymentStatus :: Declined
522
+ | CheckoutPaymentStatus :: Expired
523
+ | CheckoutPaymentStatus :: Canceled => Self :: Failure ,
499
524
CheckoutPaymentStatus :: Pending => Self :: AuthenticationPending ,
500
- CheckoutPaymentStatus :: CardVerified => Self :: Pending ,
525
+ CheckoutPaymentStatus :: CardVerified | CheckoutPaymentStatus :: RetryScheduled => {
526
+ Self :: Pending
527
+ }
528
+ CheckoutPaymentStatus :: Voided => Self :: Voided ,
501
529
}
502
530
}
503
531
}
@@ -514,10 +542,18 @@ impl ForeignFrom<(CheckoutPaymentStatus, CheckoutPaymentIntent)> for enums::Atte
514
542
Self :: Authorized
515
543
}
516
544
}
517
- CheckoutPaymentStatus :: Captured => Self :: Charged ,
518
- CheckoutPaymentStatus :: Declined => Self :: Failure ,
545
+ CheckoutPaymentStatus :: Captured
546
+ | CheckoutPaymentStatus :: PartiallyRefunded
547
+ | CheckoutPaymentStatus :: Refunded => Self :: Charged ,
548
+ CheckoutPaymentStatus :: PartiallyCaptured => Self :: PartialCharged ,
549
+ CheckoutPaymentStatus :: Declined
550
+ | CheckoutPaymentStatus :: Expired
551
+ | CheckoutPaymentStatus :: Canceled => Self :: Failure ,
519
552
CheckoutPaymentStatus :: Pending => Self :: AuthenticationPending ,
520
- CheckoutPaymentStatus :: CardVerified => Self :: Pending ,
553
+ CheckoutPaymentStatus :: CardVerified | CheckoutPaymentStatus :: RetryScheduled => {
554
+ Self :: Pending
555
+ }
556
+ CheckoutPaymentStatus :: Voided => Self :: Voided ,
521
557
}
522
558
}
523
559
}
@@ -537,10 +573,18 @@ impl ForeignFrom<(CheckoutPaymentStatus, Option<Balances>)> for enums::AttemptSt
537
573
Self :: Authorized
538
574
}
539
575
}
540
- CheckoutPaymentStatus :: Captured => Self :: Charged ,
541
- CheckoutPaymentStatus :: Declined => Self :: Failure ,
576
+ CheckoutPaymentStatus :: Captured
577
+ | CheckoutPaymentStatus :: PartiallyRefunded
578
+ | CheckoutPaymentStatus :: Refunded => Self :: Charged ,
579
+ CheckoutPaymentStatus :: PartiallyCaptured => Self :: PartialCharged ,
580
+ CheckoutPaymentStatus :: Declined
581
+ | CheckoutPaymentStatus :: Expired
582
+ | CheckoutPaymentStatus :: Canceled => Self :: Failure ,
542
583
CheckoutPaymentStatus :: Pending => Self :: AuthenticationPending ,
543
- CheckoutPaymentStatus :: CardVerified => Self :: Pending ,
584
+ CheckoutPaymentStatus :: CardVerified | CheckoutPaymentStatus :: RetryScheduled => {
585
+ Self :: Pending
586
+ }
587
+ CheckoutPaymentStatus :: Voided => Self :: Voided ,
544
588
}
545
589
}
546
590
}
@@ -559,6 +603,7 @@ pub struct Links {
559
603
pub struct PaymentsResponse {
560
604
id : String ,
561
605
amount : Option < i32 > ,
606
+ currency : Option < String > ,
562
607
action_id : Option < String > ,
563
608
status : CheckoutPaymentStatus ,
564
609
#[ serde( rename = "_links" ) ]
@@ -567,6 +612,8 @@ pub struct PaymentsResponse {
567
612
reference : Option < String > ,
568
613
response_code : Option < String > ,
569
614
response_summary : Option < String > ,
615
+ approved : Option < bool > ,
616
+ processed_on : Option < String > ,
570
617
}
571
618
572
619
#[ derive( Debug , Deserialize , Serialize ) ]
@@ -1132,11 +1179,18 @@ pub fn is_chargeback_event(event_code: &CheckoutWebhookEventType) -> bool {
1132
1179
pub enum CheckoutWebhookEventType {
1133
1180
AuthenticationStarted ,
1134
1181
AuthenticationApproved ,
1182
+ AuthenticationAttempted ,
1183
+ AuthenticationExpired ,
1184
+ AuthenticationFailed ,
1135
1185
PaymentApproved ,
1136
1186
PaymentCaptured ,
1137
1187
PaymentDeclined ,
1138
1188
PaymentRefunded ,
1139
1189
PaymentRefundDeclined ,
1190
+ PaymentAuthenticationFailed ,
1191
+ PaymentCanceled ,
1192
+ PaymentCaptureDeclined ,
1193
+ PaymentVoided ,
1140
1194
DisputeReceived ,
1141
1195
DisputeExpired ,
1142
1196
DisputeAccepted ,
@@ -1169,6 +1223,8 @@ pub struct CheckoutWebhookData {
1169
1223
pub response_code : Option < String > ,
1170
1224
pub response_summary : Option < String > ,
1171
1225
pub currency : String ,
1226
+ pub processed_on : Option < String > ,
1227
+ pub approved : Option < bool > ,
1172
1228
}
1173
1229
1174
1230
#[ derive( Debug , Deserialize ) ]
@@ -1220,13 +1276,22 @@ pub enum CheckoutDisputeTransactionType {
1220
1276
impl From < CheckoutWebhookEventType > for api:: IncomingWebhookEvent {
1221
1277
fn from ( transaction_type : CheckoutWebhookEventType ) -> Self {
1222
1278
match transaction_type {
1223
- CheckoutWebhookEventType :: AuthenticationStarted => Self :: EventNotSupported ,
1224
- CheckoutWebhookEventType :: AuthenticationApproved => Self :: EventNotSupported ,
1279
+ CheckoutWebhookEventType :: AuthenticationStarted
1280
+ | CheckoutWebhookEventType :: AuthenticationApproved
1281
+ | CheckoutWebhookEventType :: AuthenticationAttempted => Self :: EventNotSupported ,
1282
+ CheckoutWebhookEventType :: AuthenticationExpired
1283
+ | CheckoutWebhookEventType :: AuthenticationFailed
1284
+ | CheckoutWebhookEventType :: PaymentAuthenticationFailed => {
1285
+ Self :: PaymentIntentAuthorizationFailure
1286
+ }
1225
1287
CheckoutWebhookEventType :: PaymentApproved => Self :: EventNotSupported ,
1226
1288
CheckoutWebhookEventType :: PaymentCaptured => Self :: PaymentIntentSuccess ,
1227
1289
CheckoutWebhookEventType :: PaymentDeclined => Self :: PaymentIntentFailure ,
1228
1290
CheckoutWebhookEventType :: PaymentRefunded => Self :: RefundSuccess ,
1229
1291
CheckoutWebhookEventType :: PaymentRefundDeclined => Self :: RefundFailure ,
1292
+ CheckoutWebhookEventType :: PaymentCanceled => Self :: PaymentIntentCancelFailure ,
1293
+ CheckoutWebhookEventType :: PaymentCaptureDeclined => Self :: PaymentIntentCaptureFailure ,
1294
+ CheckoutWebhookEventType :: PaymentVoided => Self :: PaymentIntentCancelled ,
1230
1295
CheckoutWebhookEventType :: DisputeReceived
1231
1296
| CheckoutWebhookEventType :: DisputeEvidenceRequired => Self :: DisputeOpened ,
1232
1297
CheckoutWebhookEventType :: DisputeExpired => Self :: DisputeExpired ,
@@ -1329,6 +1394,9 @@ impl TryFrom<&api::IncomingWebhookRequestDetails<'_>> for PaymentsResponse {
1329
1394
response_code : data. response_code ,
1330
1395
response_summary : data. response_summary ,
1331
1396
action_id : data. action_id ,
1397
+ currency : Some ( data. currency ) ,
1398
+ processed_on : data. processed_on ,
1399
+ approved : data. approved ,
1332
1400
} ;
1333
1401
1334
1402
Ok ( psync_struct)
0 commit comments