@@ -837,6 +837,9 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
837
837
pub struct CybersourcePaymentsCaptureRequest {
838
838
processing_information : ProcessingInformation ,
839
839
order_information : OrderInformationWithBill ,
840
+ client_reference_information : ClientReferenceInformation ,
841
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
842
+ merchant_defined_information : Option < Vec < MerchantDefinedInformation > > ,
840
843
}
841
844
842
845
#[ derive( Debug , Serialize ) ]
@@ -853,6 +856,10 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCaptureRouterData>>
853
856
fn try_from (
854
857
item : & CybersourceRouterData < & types:: PaymentsCaptureRouterData > ,
855
858
) -> Result < Self , Self :: Error > {
859
+ let merchant_defined_information =
860
+ item. router_data . request . metadata . clone ( ) . map ( |metadata| {
861
+ Vec :: < MerchantDefinedInformation > :: foreign_from ( metadata. peek ( ) . to_owned ( ) )
862
+ } ) ;
856
863
Ok ( Self {
857
864
processing_information : ProcessingInformation {
858
865
capture_options : Some ( CaptureOptions {
@@ -873,6 +880,10 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCaptureRouterData>>
873
880
} ,
874
881
bill_to : None ,
875
882
} ,
883
+ client_reference_information : ClientReferenceInformation {
884
+ code : Some ( item. router_data . connector_request_reference_id . clone ( ) ) ,
885
+ } ,
886
+ merchant_defined_information,
876
887
} )
877
888
}
878
889
}
@@ -918,6 +929,9 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsIncrementalAuthorizationRout
918
929
pub struct CybersourceVoidRequest {
919
930
client_reference_information : ClientReferenceInformation ,
920
931
reversal_information : ReversalInformation ,
932
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
933
+ merchant_defined_information : Option < Vec < MerchantDefinedInformation > > ,
934
+ // The connector documentation does not mention the merchantDefinedInformation field for Void requests. But this has been still added because it works!
921
935
}
922
936
923
937
#[ derive( Debug , Serialize ) ]
@@ -932,6 +946,10 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCancelRouterData>> for Cyber
932
946
fn try_from (
933
947
value : & CybersourceRouterData < & types:: PaymentsCancelRouterData > ,
934
948
) -> Result < Self , Self :: Error > {
949
+ let merchant_defined_information =
950
+ value. router_data . request . metadata . clone ( ) . map ( |metadata| {
951
+ Vec :: < MerchantDefinedInformation > :: foreign_from ( metadata. peek ( ) . to_owned ( ) )
952
+ } ) ;
935
953
Ok ( Self {
936
954
client_reference_information : ClientReferenceInformation {
937
955
code : Some ( value. router_data . connector_request_reference_id . clone ( ) ) ,
@@ -954,6 +972,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCancelRouterData>> for Cyber
954
972
field_name : "Cancellation Reason" ,
955
973
} ) ?,
956
974
} ,
975
+ merchant_defined_information,
957
976
} )
958
977
}
959
978
}
@@ -1591,6 +1610,7 @@ impl<F>
1591
1610
#[ serde( rename_all = "camelCase" ) ]
1592
1611
pub struct CybersourceRefundRequest {
1593
1612
order_information : OrderInformation ,
1613
+ client_reference_information : ClientReferenceInformation ,
1594
1614
}
1595
1615
1596
1616
impl < F > TryFrom < & CybersourceRouterData < & types:: RefundsRouterData < F > > > for CybersourceRefundRequest {
@@ -1605,6 +1625,9 @@ impl<F> TryFrom<&CybersourceRouterData<&types::RefundsRouterData<F>>> for Cybers
1605
1625
currency : item. router_data . request . currency ,
1606
1626
} ,
1607
1627
} ,
1628
+ client_reference_information : ClientReferenceInformation {
1629
+ code : Some ( item. router_data . request . refund_id . clone ( ) ) ,
1630
+ } ,
1608
1631
} )
1609
1632
}
1610
1633
}
0 commit comments