@@ -235,22 +235,27 @@ impl TryFrom<&ConnectorAuthType> for VoltAuthType {
235
235
}
236
236
}
237
237
238
- impl From < VoltPaymentStatus > for enums:: AttemptStatus {
239
- fn from ( item : VoltPaymentStatus ) -> Self {
240
- match item {
241
- VoltPaymentStatus :: Received | VoltPaymentStatus :: Settled => Self :: Charged ,
242
- VoltPaymentStatus :: Completed | VoltPaymentStatus :: DelayedAtBank => Self :: Pending ,
243
- VoltPaymentStatus :: NewPayment
244
- | VoltPaymentStatus :: BankRedirect
245
- | VoltPaymentStatus :: AwaitingCheckoutAuthorisation => Self :: AuthenticationPending ,
246
- VoltPaymentStatus :: RefusedByBank
247
- | VoltPaymentStatus :: RefusedByRisk
248
- | VoltPaymentStatus :: NotReceived
249
- | VoltPaymentStatus :: ErrorAtBank
250
- | VoltPaymentStatus :: CancelledByUser
251
- | VoltPaymentStatus :: AbandonedByUser
252
- | VoltPaymentStatus :: Failed => Self :: Failure ,
238
+ fn get_attempt_status (
239
+ ( item, current_status) : ( VoltPaymentStatus , enums:: AttemptStatus ) ,
240
+ ) -> enums:: AttemptStatus {
241
+ match item {
242
+ VoltPaymentStatus :: Received | VoltPaymentStatus :: Settled => enums:: AttemptStatus :: Charged ,
243
+ VoltPaymentStatus :: Completed | VoltPaymentStatus :: DelayedAtBank => {
244
+ enums:: AttemptStatus :: Pending
253
245
}
246
+ VoltPaymentStatus :: NewPayment
247
+ | VoltPaymentStatus :: BankRedirect
248
+ | VoltPaymentStatus :: AwaitingCheckoutAuthorisation => {
249
+ enums:: AttemptStatus :: AuthenticationPending
250
+ }
251
+ VoltPaymentStatus :: RefusedByBank
252
+ | VoltPaymentStatus :: RefusedByRisk
253
+ | VoltPaymentStatus :: NotReceived
254
+ | VoltPaymentStatus :: ErrorAtBank
255
+ | VoltPaymentStatus :: CancelledByUser
256
+ | VoltPaymentStatus :: AbandonedByUser
257
+ | VoltPaymentStatus :: Failed => enums:: AttemptStatus :: Failure ,
258
+ VoltPaymentStatus :: Unknown => current_status,
254
259
}
255
260
}
256
261
@@ -309,6 +314,7 @@ pub enum VoltPaymentStatus {
309
314
AbandonedByUser ,
310
315
Failed ,
311
316
Settled ,
317
+ Unknown ,
312
318
}
313
319
314
320
#[ derive( Debug , Serialize , Deserialize ) ]
@@ -335,7 +341,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
335
341
) -> Result < Self , Self :: Error > {
336
342
match item. response {
337
343
VoltPaymentsResponseData :: PsyncResponse ( payment_response) => {
338
- let status = enums:: AttemptStatus :: from ( payment_response. status . clone ( ) ) ;
344
+ let status =
345
+ get_attempt_status ( ( payment_response. status . clone ( ) , item. data . status ) ) ;
339
346
Ok ( Self {
340
347
status,
341
348
response : if is_payment_failure ( status) {
0 commit comments