mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
Refactor(Connectors): [BOA] enhance response objects (#4508)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com>
This commit is contained in:
@ -378,11 +378,34 @@ impl<F, T>
|
|||||||
let error_response =
|
let error_response =
|
||||||
get_error_response_if_failure((&info_response, mandate_status, item.http_code));
|
get_error_response_if_failure((&info_response, mandate_status, item.http_code));
|
||||||
|
|
||||||
let connector_response = info_response
|
let connector_response = match item.data.payment_method {
|
||||||
.processor_information
|
common_enums::PaymentMethod::Card => info_response
|
||||||
.as_ref()
|
.processor_information
|
||||||
.map(types::AdditionalPaymentMethodConnectorResponse::from)
|
.as_ref()
|
||||||
.map(types::ConnectorResponseData::with_additional_payment_method_data);
|
.and_then(|processor_information| {
|
||||||
|
info_response
|
||||||
|
.consumer_authentication_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|consumer_auth_information| {
|
||||||
|
types::AdditionalPaymentMethodConnectorResponse::from((
|
||||||
|
processor_information,
|
||||||
|
consumer_auth_information,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.map(types::ConnectorResponseData::with_additional_payment_method_data),
|
||||||
|
common_enums::PaymentMethod::CardRedirect
|
||||||
|
| common_enums::PaymentMethod::PayLater
|
||||||
|
| common_enums::PaymentMethod::Wallet
|
||||||
|
| common_enums::PaymentMethod::BankRedirect
|
||||||
|
| common_enums::PaymentMethod::BankTransfer
|
||||||
|
| common_enums::PaymentMethod::Crypto
|
||||||
|
| common_enums::PaymentMethod::BankDebit
|
||||||
|
| common_enums::PaymentMethod::Reward
|
||||||
|
| common_enums::PaymentMethod::Upi
|
||||||
|
| common_enums::PaymentMethod::Voucher
|
||||||
|
| common_enums::PaymentMethod::GiftCard => None,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
status: mandate_status,
|
status: mandate_status,
|
||||||
@ -722,6 +745,44 @@ pub struct ClientReferenceInformation {
|
|||||||
pub struct ClientProcessorInformation {
|
pub struct ClientProcessorInformation {
|
||||||
avs: Option<Avs>,
|
avs: Option<Avs>,
|
||||||
card_verification: Option<CardVerification>,
|
card_verification: Option<CardVerification>,
|
||||||
|
processor: Option<ProcessorResponse>,
|
||||||
|
network_transaction_id: Option<Secret<String>>,
|
||||||
|
approval_code: Option<String>,
|
||||||
|
merchant_advice: Option<MerchantAdvice>,
|
||||||
|
response_code: Option<String>,
|
||||||
|
ach_verification: Option<AchVerification>,
|
||||||
|
system_trace_audit_number: Option<String>,
|
||||||
|
event_status: Option<String>,
|
||||||
|
retrieval_reference_number: Option<String>,
|
||||||
|
consumer_authentication_response: Option<ConsumerAuthenticationResponse>,
|
||||||
|
response_details: Option<String>,
|
||||||
|
transaction_id: Option<Secret<String>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct MerchantAdvice {
|
||||||
|
code: Option<String>,
|
||||||
|
code_raw: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ConsumerAuthenticationResponse {
|
||||||
|
code: Option<String>,
|
||||||
|
code_raw: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct AchVerification {
|
||||||
|
result_code_raw: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ProcessorResponse {
|
||||||
|
name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
@ -735,6 +796,39 @@ pub struct CardVerification {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ClientRiskInformation {
|
pub struct ClientRiskInformation {
|
||||||
rules: Option<Vec<ClientRiskInformationRules>>,
|
rules: Option<Vec<ClientRiskInformationRules>>,
|
||||||
|
profile: Option<Profile>,
|
||||||
|
score: Option<Score>,
|
||||||
|
info_codes: Option<InfoCodes>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct InfoCodes {
|
||||||
|
address: Option<Vec<String>>,
|
||||||
|
identity_change: Option<Vec<String>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Score {
|
||||||
|
factor_codes: Option<Vec<String>>,
|
||||||
|
result: Option<RiskResult>,
|
||||||
|
model_used: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum RiskResult {
|
||||||
|
StringVariant(String),
|
||||||
|
IntVariant(u64),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Profile {
|
||||||
|
early_decision: Option<String>,
|
||||||
|
name: Option<String>,
|
||||||
|
decision: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
@ -1254,26 +1348,36 @@ pub struct ClientAuthSetupInfoResponse {
|
|||||||
id: String,
|
id: String,
|
||||||
client_reference_information: ClientReferenceInformation,
|
client_reference_information: ClientReferenceInformation,
|
||||||
consumer_authentication_information: BankOfAmericaConsumerAuthInformationResponse,
|
consumer_authentication_information: BankOfAmericaConsumerAuthInformationResponse,
|
||||||
|
processor_information: Option<ClientProcessorInformation>,
|
||||||
|
processing_information: Option<ProcessingInformationResponse>,
|
||||||
|
payment_account_information: Option<PaymentAccountInformation>,
|
||||||
|
payment_information: Option<PaymentInformationResponse>,
|
||||||
|
payment_insights_information: Option<PaymentInsightsInformation>,
|
||||||
|
risk_information: Option<ClientRiskInformation>,
|
||||||
|
token_information: Option<BankOfAmericaTokenInformation>,
|
||||||
|
error_information: Option<BankOfAmericaErrorInformation>,
|
||||||
|
issuer_information: Option<IssuerInformation>,
|
||||||
|
reconciliation_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum BankOfAmericaAuthSetupResponse {
|
pub enum BankOfAmericaAuthSetupResponse {
|
||||||
ClientAuthSetupInfo(ClientAuthSetupInfoResponse),
|
ClientAuthSetupInfo(Box<ClientAuthSetupInfoResponse>),
|
||||||
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum BankOfAmericaPaymentsResponse {
|
pub enum BankOfAmericaPaymentsResponse {
|
||||||
ClientReferenceInformation(BankOfAmericaClientReferenceResponse),
|
ClientReferenceInformation(Box<BankOfAmericaClientReferenceResponse>),
|
||||||
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum BankOfAmericaSetupMandatesResponse {
|
pub enum BankOfAmericaSetupMandatesResponse {
|
||||||
ClientReferenceInformation(BankOfAmericaClientReferenceResponse),
|
ClientReferenceInformation(Box<BankOfAmericaClientReferenceResponse>),
|
||||||
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1284,9 +1388,125 @@ pub struct BankOfAmericaClientReferenceResponse {
|
|||||||
status: BankofamericaPaymentStatus,
|
status: BankofamericaPaymentStatus,
|
||||||
client_reference_information: ClientReferenceInformation,
|
client_reference_information: ClientReferenceInformation,
|
||||||
processor_information: Option<ClientProcessorInformation>,
|
processor_information: Option<ClientProcessorInformation>,
|
||||||
|
processing_information: Option<ProcessingInformationResponse>,
|
||||||
|
payment_information: Option<PaymentInformationResponse>,
|
||||||
|
payment_insights_information: Option<PaymentInsightsInformation>,
|
||||||
risk_information: Option<ClientRiskInformation>,
|
risk_information: Option<ClientRiskInformation>,
|
||||||
token_information: Option<BankOfAmericaTokenInformation>,
|
token_information: Option<BankOfAmericaTokenInformation>,
|
||||||
error_information: Option<BankOfAmericaErrorInformation>,
|
error_information: Option<BankOfAmericaErrorInformation>,
|
||||||
|
issuer_information: Option<IssuerInformation>,
|
||||||
|
sender_information: Option<SenderInformation>,
|
||||||
|
payment_account_information: Option<PaymentAccountInformation>,
|
||||||
|
reconciliation_id: Option<String>,
|
||||||
|
consumer_authentication_information: Option<ConsumerAuthenticationInformation>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ConsumerAuthenticationInformation {
|
||||||
|
eci_raw: Option<String>,
|
||||||
|
eci: Option<String>,
|
||||||
|
acs_transaction_id: Option<String>,
|
||||||
|
cavv: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct SenderInformation {
|
||||||
|
payment_information: Option<PaymentInformationResponse>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PaymentInsightsInformation {
|
||||||
|
response_insights: Option<ResponseInsights>,
|
||||||
|
rule_results: Option<RuleResults>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ResponseInsights {
|
||||||
|
category_code: Option<String>,
|
||||||
|
category: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RuleResults {
|
||||||
|
id: Option<String>,
|
||||||
|
decision: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PaymentInformationResponse {
|
||||||
|
tokenized_card: Option<CardResponseObject>,
|
||||||
|
customer: Option<CustomerResponseObject>,
|
||||||
|
card: Option<CardResponseObject>,
|
||||||
|
scheme: Option<String>,
|
||||||
|
bin: Option<String>,
|
||||||
|
account_type: Option<String>,
|
||||||
|
issuer: Option<String>,
|
||||||
|
bin_country: Option<api_enums::CountryAlpha2>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CustomerResponseObject {
|
||||||
|
customer_id: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PaymentAccountInformation {
|
||||||
|
card: Option<PaymentAccountCardInformation>,
|
||||||
|
features: Option<PaymentAccountFeatureInformation>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PaymentAccountFeatureInformation {
|
||||||
|
health_card: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PaymentAccountCardInformation {
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
card_type: Option<String>,
|
||||||
|
hashed_number: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ProcessingInformationResponse {
|
||||||
|
payment_solution: Option<String>,
|
||||||
|
commerce_indicator: Option<String>,
|
||||||
|
commerce_indicator_label: Option<String>,
|
||||||
|
authorization_options: Option<AuthorizationOptions>,
|
||||||
|
ecommerce_indicator: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct AuthorizationOptions {
|
||||||
|
auth_type: Option<String>,
|
||||||
|
initiator: Option<Initiator>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Initiator {
|
||||||
|
merchant_initiated_transaction: Option<MerchantInitiatedTransactionResponse>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct MerchantInitiatedTransactionResponse {
|
||||||
|
agreement_id: Option<String>,
|
||||||
|
previous_transaction_id: Option<String>,
|
||||||
|
original_authorized_amount: Option<String>,
|
||||||
|
reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
@ -1295,6 +1515,27 @@ pub struct BankOfAmericaTokenInformation {
|
|||||||
payment_instrument: Option<BankOfAmericaPaymentInstrument>,
|
payment_instrument: Option<BankOfAmericaPaymentInstrument>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct IssuerInformation {
|
||||||
|
country: Option<api_enums::CountryAlpha2>,
|
||||||
|
discretionary_data: Option<String>,
|
||||||
|
country_specific_discretionary_data: Option<String>,
|
||||||
|
response_code: Option<String>,
|
||||||
|
pin_request_indicator: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CardResponseObject {
|
||||||
|
suffix: Option<String>,
|
||||||
|
prefix: Option<String>,
|
||||||
|
expiration_month: Option<Secret<String>>,
|
||||||
|
expiration_year: Option<Secret<String>>,
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
card_type: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BankOfAmericaErrorInformationResponse {
|
pub struct BankOfAmericaErrorInformationResponse {
|
||||||
@ -1862,11 +2103,35 @@ impl<F>
|
|||||||
|| is_setup_mandate_payment(&item.data.request),
|
|| is_setup_mandate_payment(&item.data.request),
|
||||||
));
|
));
|
||||||
let response = get_payment_response((&info_response, status, item.http_code));
|
let response = get_payment_response((&info_response, status, item.http_code));
|
||||||
let connector_response = info_response
|
let connector_response = match item.data.payment_method {
|
||||||
.processor_information
|
common_enums::PaymentMethod::Card => info_response
|
||||||
.as_ref()
|
.processor_information
|
||||||
.map(types::AdditionalPaymentMethodConnectorResponse::from)
|
.as_ref()
|
||||||
.map(types::ConnectorResponseData::with_additional_payment_method_data);
|
.and_then(|processor_information| {
|
||||||
|
info_response
|
||||||
|
.consumer_authentication_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|consumer_auth_information| {
|
||||||
|
types::AdditionalPaymentMethodConnectorResponse::from((
|
||||||
|
processor_information,
|
||||||
|
consumer_auth_information,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.map(types::ConnectorResponseData::with_additional_payment_method_data),
|
||||||
|
common_enums::PaymentMethod::CardRedirect
|
||||||
|
| common_enums::PaymentMethod::PayLater
|
||||||
|
| common_enums::PaymentMethod::Wallet
|
||||||
|
| common_enums::PaymentMethod::BankRedirect
|
||||||
|
| common_enums::PaymentMethod::BankTransfer
|
||||||
|
| common_enums::PaymentMethod::Crypto
|
||||||
|
| common_enums::PaymentMethod::BankDebit
|
||||||
|
| common_enums::PaymentMethod::Reward
|
||||||
|
| common_enums::PaymentMethod::Upi
|
||||||
|
| common_enums::PaymentMethod::Voucher
|
||||||
|
| common_enums::PaymentMethod::GiftCard => None,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
status,
|
status,
|
||||||
response,
|
response,
|
||||||
@ -1911,11 +2176,34 @@ impl<F>
|
|||||||
item.data.request.is_auto_capture()?,
|
item.data.request.is_auto_capture()?,
|
||||||
));
|
));
|
||||||
let response = get_payment_response((&info_response, status, item.http_code));
|
let response = get_payment_response((&info_response, status, item.http_code));
|
||||||
let connector_response = info_response
|
let connector_response = match item.data.payment_method {
|
||||||
.processor_information
|
common_enums::PaymentMethod::Card => info_response
|
||||||
.as_ref()
|
.processor_information
|
||||||
.map(types::AdditionalPaymentMethodConnectorResponse::from)
|
.as_ref()
|
||||||
.map(types::ConnectorResponseData::with_additional_payment_method_data);
|
.and_then(|processor_information| {
|
||||||
|
info_response
|
||||||
|
.consumer_authentication_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|consumer_auth_information| {
|
||||||
|
types::AdditionalPaymentMethodConnectorResponse::from((
|
||||||
|
processor_information,
|
||||||
|
consumer_auth_information,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.map(types::ConnectorResponseData::with_additional_payment_method_data),
|
||||||
|
common_enums::PaymentMethod::CardRedirect
|
||||||
|
| common_enums::PaymentMethod::PayLater
|
||||||
|
| common_enums::PaymentMethod::Wallet
|
||||||
|
| common_enums::PaymentMethod::BankRedirect
|
||||||
|
| common_enums::PaymentMethod::BankTransfer
|
||||||
|
| common_enums::PaymentMethod::Crypto
|
||||||
|
| common_enums::PaymentMethod::BankDebit
|
||||||
|
| common_enums::PaymentMethod::Reward
|
||||||
|
| common_enums::PaymentMethod::Upi
|
||||||
|
| common_enums::PaymentMethod::Voucher
|
||||||
|
| common_enums::PaymentMethod::GiftCard => None,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
status,
|
status,
|
||||||
@ -1935,14 +2223,38 @@ impl<F>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&ClientProcessorInformation> for types::AdditionalPaymentMethodConnectorResponse {
|
impl
|
||||||
fn from(processor_information: &ClientProcessorInformation) -> Self {
|
From<(
|
||||||
let payment_checks = Some(
|
&ClientProcessorInformation,
|
||||||
serde_json::json!({"avs_response": processor_information.avs, "card_verification": processor_information.card_verification}),
|
&ConsumerAuthenticationInformation,
|
||||||
);
|
)> for types::AdditionalPaymentMethodConnectorResponse
|
||||||
|
{
|
||||||
|
fn from(
|
||||||
|
item: (
|
||||||
|
&ClientProcessorInformation,
|
||||||
|
&ConsumerAuthenticationInformation,
|
||||||
|
),
|
||||||
|
) -> Self {
|
||||||
|
let processor_information = item.0;
|
||||||
|
let consumer_authentication_information = item.1;
|
||||||
|
let payment_checks = Some(serde_json::json!({
|
||||||
|
"avs_response": processor_information.avs,
|
||||||
|
"card_verification": processor_information.card_verification,
|
||||||
|
"approval_code": processor_information.approval_code,
|
||||||
|
"consumer_authentication_response": processor_information.consumer_authentication_response,
|
||||||
|
"cavv": consumer_authentication_information.cavv,
|
||||||
|
"eci": consumer_authentication_information.eci,
|
||||||
|
"eci_raw": consumer_authentication_information.eci_raw,
|
||||||
|
}));
|
||||||
|
|
||||||
|
let authentication_data = Some(serde_json::json!({
|
||||||
|
"retrieval_reference_number": processor_information.retrieval_reference_number,
|
||||||
|
"acs_transaction_id": consumer_authentication_information.acs_transaction_id,
|
||||||
|
"system_trace_audit_number": processor_information.system_trace_audit_number,
|
||||||
|
}));
|
||||||
|
|
||||||
Self::Card {
|
Self::Card {
|
||||||
authentication_data: None,
|
authentication_data,
|
||||||
payment_checks,
|
payment_checks,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2025,7 +2337,7 @@ impl<F>
|
|||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum BankOfAmericaTransactionResponse {
|
pub enum BankOfAmericaTransactionResponse {
|
||||||
ApplicationInformation(BankOfAmericaApplicationInfoResponse),
|
ApplicationInformation(Box<BankOfAmericaApplicationInfoResponse>),
|
||||||
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
ErrorInformation(BankOfAmericaErrorInformationResponse),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2035,7 +2347,22 @@ pub struct BankOfAmericaApplicationInfoResponse {
|
|||||||
id: String,
|
id: String,
|
||||||
application_information: ApplicationInformation,
|
application_information: ApplicationInformation,
|
||||||
client_reference_information: Option<ClientReferenceInformation>,
|
client_reference_information: Option<ClientReferenceInformation>,
|
||||||
|
processor_information: Option<ClientProcessorInformation>,
|
||||||
|
processing_information: Option<ProcessingInformationResponse>,
|
||||||
|
payment_information: Option<PaymentInformationResponse>,
|
||||||
|
payment_insights_information: Option<PaymentInsightsInformation>,
|
||||||
error_information: Option<BankOfAmericaErrorInformation>,
|
error_information: Option<BankOfAmericaErrorInformation>,
|
||||||
|
fraud_marking_information: Option<FraudMarkingInformation>,
|
||||||
|
risk_information: Option<ClientRiskInformation>,
|
||||||
|
token_information: Option<BankOfAmericaTokenInformation>,
|
||||||
|
reconciliation_id: Option<String>,
|
||||||
|
consumer_authentication_information: Option<ConsumerAuthenticationInformation>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct FraudMarkingInformation {
|
||||||
|
reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
@ -2069,6 +2396,36 @@ impl<F>
|
|||||||
app_response.application_information.status,
|
app_response.application_information.status,
|
||||||
item.data.request.is_auto_capture()?,
|
item.data.request.is_auto_capture()?,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let connector_response = match item.data.payment_method {
|
||||||
|
common_enums::PaymentMethod::Card => app_response
|
||||||
|
.processor_information
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|processor_information| {
|
||||||
|
app_response
|
||||||
|
.consumer_authentication_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|consumer_auth_information| {
|
||||||
|
types::AdditionalPaymentMethodConnectorResponse::from((
|
||||||
|
processor_information,
|
||||||
|
consumer_auth_information,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.map(types::ConnectorResponseData::with_additional_payment_method_data),
|
||||||
|
common_enums::PaymentMethod::CardRedirect
|
||||||
|
| common_enums::PaymentMethod::PayLater
|
||||||
|
| common_enums::PaymentMethod::Wallet
|
||||||
|
| common_enums::PaymentMethod::BankRedirect
|
||||||
|
| common_enums::PaymentMethod::BankTransfer
|
||||||
|
| common_enums::PaymentMethod::Crypto
|
||||||
|
| common_enums::PaymentMethod::BankDebit
|
||||||
|
| common_enums::PaymentMethod::Reward
|
||||||
|
| common_enums::PaymentMethod::Upi
|
||||||
|
| common_enums::PaymentMethod::Voucher
|
||||||
|
| common_enums::PaymentMethod::GiftCard => None,
|
||||||
|
};
|
||||||
|
|
||||||
let risk_info: Option<ClientRiskInformation> = None;
|
let risk_info: Option<ClientRiskInformation> = None;
|
||||||
if utils::is_payment_failure(status) {
|
if utils::is_payment_failure(status) {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@ -2079,6 +2436,7 @@ impl<F>
|
|||||||
app_response.id.clone(),
|
app_response.id.clone(),
|
||||||
))),
|
))),
|
||||||
status: enums::AttemptStatus::Failure,
|
status: enums::AttemptStatus::Failure,
|
||||||
|
connector_response,
|
||||||
..item.data
|
..item.data
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -2098,6 +2456,7 @@ impl<F>
|
|||||||
.unwrap_or(Some(app_response.id)),
|
.unwrap_or(Some(app_response.id)),
|
||||||
incremental_authorization_allowed: None,
|
incremental_authorization_allowed: None,
|
||||||
}),
|
}),
|
||||||
|
connector_response,
|
||||||
..item.data
|
..item.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user