@@ -9,7 +9,7 @@ use crate::{
9
9
} ,
10
10
core:: errors,
11
11
services,
12
- types:: { self , api, storage:: enums, ErrorResponse } ,
12
+ types:: { self , api, storage:: enums, transformers :: ForeignFrom , ErrorResponse } ,
13
13
utils,
14
14
} ;
15
15
@@ -356,35 +356,53 @@ impl TryFrom<&types::ConnectorAuthType> for NoonAuthType {
356
356
#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
357
357
#[ strum( serialize_all = "UPPERCASE" ) ]
358
358
pub enum NoonPaymentStatus {
359
+ Initiated ,
359
360
Authorized ,
360
361
Captured ,
361
362
PartiallyCaptured ,
362
- Reversed ,
363
- Cancelled ,
363
+ PartiallyRefunded ,
364
+ PaymentInfoAdded ,
364
365
#[ serde( rename = "3DS_ENROLL_INITIATED" ) ]
365
366
ThreeDsEnrollInitiated ,
366
367
#[ serde( rename = "3DS_ENROLL_CHECKED" ) ]
367
368
ThreeDsEnrollChecked ,
368
- Failed ,
369
+ #[ serde( rename = "3DS_RESULT_VERIFIED" ) ]
370
+ ThreeDsResultVerified ,
371
+ MarkedForReview ,
372
+ Authenticated ,
373
+ PartiallyReversed ,
369
374
#[ default]
370
375
Pending ,
376
+ Cancelled ,
377
+ Failed ,
378
+ Refunded ,
371
379
Expired ,
380
+ Reversed ,
372
381
Rejected ,
382
+ Locked ,
373
383
}
374
384
375
- impl From < NoonPaymentStatus > for enums:: AttemptStatus {
376
- fn from ( item : NoonPaymentStatus ) -> Self {
385
+ impl ForeignFrom < ( NoonPaymentStatus , Self ) > for enums:: AttemptStatus {
386
+ fn foreign_from ( data : ( NoonPaymentStatus , Self ) ) -> Self {
387
+ let ( item, current_status) = data;
377
388
match item {
378
389
NoonPaymentStatus :: Authorized => Self :: Authorized ,
379
- NoonPaymentStatus :: Captured => Self :: Charged ,
380
- NoonPaymentStatus :: PartiallyCaptured => Self :: PartialCharged ,
381
- NoonPaymentStatus :: Reversed => Self :: Voided ,
390
+ NoonPaymentStatus :: Captured
391
+ | NoonPaymentStatus :: PartiallyCaptured
392
+ | NoonPaymentStatus :: PartiallyRefunded
393
+ | NoonPaymentStatus :: Refunded => Self :: Charged ,
394
+ NoonPaymentStatus :: Reversed | NoonPaymentStatus :: PartiallyReversed => Self :: Voided ,
382
395
NoonPaymentStatus :: Cancelled | NoonPaymentStatus :: Expired => Self :: AuthenticationFailed ,
383
396
NoonPaymentStatus :: ThreeDsEnrollInitiated | NoonPaymentStatus :: ThreeDsEnrollChecked => {
384
397
Self :: AuthenticationPending
385
398
}
399
+ NoonPaymentStatus :: ThreeDsResultVerified => Self :: AuthenticationSuccessful ,
386
400
NoonPaymentStatus :: Failed | NoonPaymentStatus :: Rejected => Self :: Failure ,
387
- NoonPaymentStatus :: Pending => Self :: Pending ,
401
+ NoonPaymentStatus :: Pending | NoonPaymentStatus :: MarkedForReview => Self :: Pending ,
402
+ NoonPaymentStatus :: Initiated
403
+ | NoonPaymentStatus :: PaymentInfoAdded
404
+ | NoonPaymentStatus :: Authenticated => Self :: Started ,
405
+ NoonPaymentStatus :: Locked => current_status,
388
406
}
389
407
}
390
408
}
@@ -448,7 +466,7 @@ impl<F, T>
448
466
} ) ;
449
467
let order = item. response . result . order ;
450
468
Ok ( Self {
451
- status : enums:: AttemptStatus :: from ( order. status ) ,
469
+ status : enums:: AttemptStatus :: foreign_from ( ( order. status , item . data . status ) ) ,
452
470
response : match order. error_message {
453
471
Some ( error_message) => Err ( ErrorResponse {
454
472
code : order. error_code . to_string ( ) ,
0 commit comments