Skip to content

Commit

Permalink
fix: fixed structure of billing details in payment body
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay committed Aug 7, 2024
1 parent a9c1a6e commit 3fa9e7d
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 154 deletions.
2 changes: 1 addition & 1 deletion src/Payments/PaymentMethodsRecord.res
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ let paymentMethodsFields = [
miniIcon: None,
},
{
paymentMethodName: "multibanco",
paymentMethodName: "multibanco_transfer",
icon: Some(icon("multibanco", ~size=19)),
displayName: "Multibanco",
fields: [Email, InfoElement],
Expand Down
16 changes: 8 additions & 8 deletions src/Utilities/DynamicFieldsUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ let isBillingAddressFieldType = (fieldType: PaymentMethodsRecord.paymentMethodsF

let getBillingAddressPathFromFieldType = (fieldType: PaymentMethodsRecord.paymentMethodsFields) => {
switch fieldType {
| AddressLine1 => "billing.address.line1"
| AddressLine2 => "billing.address.line2"
| AddressCity => "billing.address.city"
| AddressState => "billing.address.state"
| AddressCountry(_) => "billing.address.country"
| AddressPincode => "billing.address.zip"
| AddressLine1 => "payment_method_data.billing.address.line1"
| AddressLine2 => "payment_method_data.billing.address.line2"
| AddressCity => "payment_method_data.billing.address.city"
| AddressState => "payment_method_data.billing.address.state"
| AddressCountry(_) => "payment_method_data.billing.address.country"
| AddressPincode => "payment_method_data.billing.address.zip"
| _ => ""
}
}
Expand Down Expand Up @@ -552,11 +552,11 @@ let useRequiredFieldsBody = (
if item === BillingName {
let arr = value->String.split(" ")
acc->Dict.set(
"billing.address.first_name",
"payment_method_data.billing.address.first_name",
arr->Array.get(0)->Option.getOr("")->JSON.Encode.string,
)
acc->Dict.set(
"billing.address.last_name",
"payment_method_data.billing.address.last_name",
arr->Array.get(1)->Option.getOr("")->JSON.Encode.string,
)
} else {
Expand Down
Loading

0 comments on commit 3fa9e7d

Please sign in to comment.