@@ -592,7 +592,7 @@ pub struct AuthorizedotnetSetupMandateResponse {
592
592
#[ derive( Debug , Clone , Deserialize , Serialize ) ]
593
593
#[ serde( rename_all = "camelCase" ) ]
594
594
pub struct AuthorizedotnetCustomerResponse {
595
- customer_profile_id : String ,
595
+ customer_profile_id : Option < String > ,
596
596
#[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
597
597
customer_payment_profile_id_list : Vec < String > ,
598
598
#[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
@@ -607,14 +607,21 @@ impl<F, T> TryFrom<ResponseRouterData<F, AuthorizedotnetCustomerResponse, T, Pay
607
607
fn try_from (
608
608
item : ResponseRouterData < F , AuthorizedotnetCustomerResponse , T , PaymentsResponseData > ,
609
609
) -> Result < Self , Self :: Error > {
610
- let connector_customer_id = item. response . customer_profile_id . clone ( ) ;
611
610
match item. response . messages . result_code {
612
- ResultCode :: Ok => Ok ( Self {
613
- response : Ok ( PaymentsResponseData :: ConnectorCustomerResponse {
614
- connector_customer_id,
611
+ ResultCode :: Ok => match item. response . customer_profile_id . clone ( ) {
612
+ Some ( connector_customer_id) => Ok ( Self {
613
+ response : Ok ( PaymentsResponseData :: ConnectorCustomerResponse {
614
+ connector_customer_id,
615
+ } ) ,
616
+ ..item. data
615
617
} ) ,
616
- ..item. data
617
- } ) ,
618
+ None => Err (
619
+ errors:: ConnectorError :: UnexpectedResponseError ( bytes:: Bytes :: from (
620
+ "Missing customer profile id from Authorizedotnet" . to_string ( ) ,
621
+ ) )
622
+ . into ( ) ,
623
+ ) ,
624
+ } ,
618
625
ResultCode :: Error => {
619
626
let error_message = item. response . messages . message . first ( ) ;
620
627
let error_code = error_message. map ( |error| error. code . clone ( ) ) ;
0 commit comments