@@ -271,6 +271,8 @@ pub struct FiuuPaymentRequest {
271
271
signature : Secret < String > ,
272
272
#[ serde( rename = "ReturnURL" ) ]
273
273
return_url : Option < String > ,
274
+ #[ serde( rename = "NotificationURL" ) ]
275
+ notification_url : Option < Url > ,
274
276
#[ serde( flatten) ]
275
277
payment_method_data : FiuuPaymentMethodData ,
276
278
}
@@ -401,6 +403,10 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque
401
403
false => 1 ,
402
404
true => 0 ,
403
405
} ;
406
+ let notification_url = Some (
407
+ Url :: parse ( & item. router_data . request . get_webhook_url ( ) ?)
408
+ . change_context ( errors:: ConnectorError :: RequestEncodingFailed ) ?,
409
+ ) ;
404
410
let payment_method_data = match item. router_data . request . payment_method_data {
405
411
PaymentMethodData :: Card ( ref card) => {
406
412
FiuuPaymentMethodData :: try_from ( ( card, item. router_data ) )
@@ -530,6 +536,7 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque
530
536
return_url,
531
537
payment_method_data,
532
538
signature,
539
+ notification_url,
533
540
} )
534
541
}
535
542
}
@@ -714,7 +721,7 @@ pub struct NonThreeDSResponseData {
714
721
pub error_desc : Option < String > ,
715
722
}
716
723
717
- #[ derive( Debug , Serialize , Deserialize ) ]
724
+ #[ derive( Debug , Serialize , Deserialize , Clone ) ]
718
725
pub struct ExtraParameters {
719
726
token : Option < Secret < String > > ,
720
727
}
@@ -1162,6 +1169,27 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
1162
1169
capture_method : item. data . request . capture_method ,
1163
1170
status : response. status ,
1164
1171
} ) ?;
1172
+ let mandate_reference = response. extra_parameters . as_ref ( ) . and_then ( |extra_p| {
1173
+ let mandate_token: Result < ExtraParameters , _ > = serde_json:: from_str ( extra_p) ;
1174
+ match mandate_token {
1175
+ Ok ( token) => {
1176
+ token. token . as_ref ( ) . map ( |token| MandateReference {
1177
+ connector_mandate_id : Some ( token. clone ( ) . expose ( ) ) ,
1178
+ payment_method_id : None ,
1179
+ mandate_metadata : None ,
1180
+ } )
1181
+ }
1182
+ Err ( err) => {
1183
+ router_env:: logger:: warn!(
1184
+ "Failed to convert 'extraP' from fiuu webhook response to fiuu::ExtraParameters. \
1185
+ Input: '{}', Error: {}",
1186
+ extra_p,
1187
+ err
1188
+ ) ;
1189
+ None
1190
+ }
1191
+ }
1192
+ } ) ;
1165
1193
let error_response = if status == enums:: AttemptStatus :: Failure {
1166
1194
Some ( ErrorResponse {
1167
1195
status_code : item. http_code ,
@@ -1183,7 +1211,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
1183
1211
let payments_response_data = PaymentsResponseData :: TransactionResponse {
1184
1212
resource_id : item. data . request . connector_transaction_id . clone ( ) ,
1185
1213
redirection_data : None ,
1186
- mandate_reference : None ,
1214
+ mandate_reference,
1187
1215
connector_metadata : None ,
1188
1216
network_txn_id : None ,
1189
1217
connector_response_reference_id : None ,
@@ -1636,6 +1664,8 @@ pub struct FiuuWebhooksPaymentResponse {
1636
1664
pub channel : String ,
1637
1665
pub error_desc : Option < String > ,
1638
1666
pub error_code : Option < String > ,
1667
+ #[ serde( rename = "extraP" ) ]
1668
+ pub extra_parameters : Option < String > ,
1639
1669
}
1640
1670
1641
1671
#[ derive( Debug , Deserialize , Serialize , Clone ) ]
0 commit comments