Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: over capture status flag [Draft pr] #2092

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/screens/Developer/PaymentSettings/PaymentSettings.res
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,25 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => {
},
]
/>
<DesktopRow>
<div className="flex flex-col">
<FieldRenderer
labelClass="!text-fs-15 !text-grey-700 font-semibold"
fieldWrapperClass="w-full flex justify-between items-center border-t border-gray-200 pt-8 "
field={makeFieldInfo(
~name="always_request_overcapture",
~label="Payments Overcapture",
~customInput=InputFields.boolInput(
~isDisabled=false,
~boolCustomClass="rounded-lg ",
),
)}
/>
<p className="font-medium text-fs-14 text-black opacity-50 pl-1">
{" Overcapture allows capturing an amount higher than the authorized amount for a card payment."->React.string}
</p>
</div>
</DesktopRow>
<DesktopRow>
<FieldRenderer
labelClass="!text-fs-15 !text-grey-700 font-semibold"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ let itemToObjMapper = dict => {
is_auto_retries_enabled: dict->getOptionBool("is_auto_retries_enabled"),
max_auto_retries_enabled: dict->getOptionInt("max_auto_retries_enabled"),
is_click_to_pay_enabled: dict->getOptionBool("is_click_to_pay_enabled"),
always_request_overcapture: dict->getOptionBool("always_request_overcapture"),
authentication_product_ids: Some(
dict
->getDictfromDict("authentication_product_ids")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ let itemToObjMapper = dict => {
is_auto_retries_enabled: dict->getOptionBool("is_auto_retries_enabled"),
max_auto_retries_enabled: dict->getOptionInt("max_auto_retries_enabled"),
is_click_to_pay_enabled: dict->getOptionBool("is_click_to_pay_enabled"),
always_request_overcapture: dict->getOptionBool("always_request_overcapture"),
authentication_product_ids: Some(
dict
->getDictfromDict("authentication_product_ids")
Expand Down
1 change: 1 addition & 0 deletions src/screens/Settings/HSwitchSettingTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ type profileEntity = {
outgoing_webhook_custom_http_headers: option<Dict.t<JSON.t>>,
is_auto_retries_enabled: option<bool>,
max_auto_retries_enabled: option<int>,
always_request_overcapture: option<bool>,
}

type twoFaType = RecoveryCode | Totp
Expand Down
8 changes: 8 additions & 0 deletions src/screens/Settings/MerchantAccountUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let parseBussinessProfileJson = (profileRecord: profileEntity) => {
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
always_request_overcapture,
} = profileRecord

let profileInfo =
Expand Down Expand Up @@ -71,6 +72,7 @@ let parseBussinessProfileJson = (profileRecord: profileEntity) => {
profileInfo->setOptionBool("is_connector_agnostic_mit_enabled", is_connector_agnostic_mit_enabled)
profileInfo->setOptionBool("is_click_to_pay_enabled", is_click_to_pay_enabled)
profileInfo->setOptionJson("authentication_product_ids", authentication_product_ids)
profileInfo->setOptionBool("always_request_overcapture", always_request_overcapture)

profileInfo->setOptionDict(
"outgoing_webhook_custom_http_headers",
Expand Down Expand Up @@ -249,6 +251,11 @@ let getBusinessProfilePayload = (values: JSON.t) => {
valuesDict->getOptionBool("is_click_to_pay_enabled"),
)

profileDetailsDict->setOptionBool(
"always_request_overcapture",
valuesDict->getOptionBool("always_request_overcapture"),
)

let authenticationProductIds = valuesDict->getJsonObjectFromDict("authentication_product_ids")
if !(authenticationProductIds->getDictFromJsonObject->isEmptyDict) {
profileDetailsDict->Dict.set("authentication_product_ids", authenticationProductIds)
Expand Down Expand Up @@ -522,6 +529,7 @@ let defaultValueForBusinessProfile = {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
always_request_overcapture: None,
}

let getValueFromBusinessProfile = businessProfileValue => {
Expand Down
4 changes: 4 additions & 0 deletions src/screens/Transaction/Order/OrderEntity.res
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ let getHeadingForOtherDetails = otherDetailsColType => {
| PMBillingLastName => Table.makeHeaderInfo(~key="payment_method_last_name", ~title="Last Name")
| MerchantOrderReferenceId =>
Table.makeHeaderInfo(~key="merchant_order_reference_id", ~title="Merchant Order Reference Id")
| OvercaptureStatus =>
Table.makeHeaderInfo(~key="overcapture_status", ~title="Overcapture Status")
}
}

Expand Down Expand Up @@ -647,6 +649,7 @@ let getCellForOtherDetails = (order, aboutPaymentColType): Table.cell => {
| PMBillingLastName => Text(order.payment_method_billing_last_name)
| BillingPhone => Text(`${order.billingPhone}`)
| MerchantOrderReferenceId => Text(order.merchant_order_reference_id)
| OvercaptureStatus => Text(order.overcapture_status)
}
}

Expand Down Expand Up @@ -914,6 +917,7 @@ let itemToObjMapper = dict => {
merchant_order_reference_id: dict->getString("merchant_order_reference_id", ""),
attempt_count: dict->getInt("attempt_count", 0),
connector_label: dict->getString("connector_label", "NA"),
overcapture_status: dict->getString("overcapture_status", ""),
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/screens/Transaction/Order/OrderTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ type order = {
merchant_order_reference_id: string,
attempt_count: int,
connector_label: string,
overcapture_status: string,
}

type refundsColType =
Expand Down Expand Up @@ -274,6 +275,7 @@ type otherDetailsColType =
| FRMTransactionType
| FRMStatus
| MerchantOrderReferenceId
| OvercaptureStatus

type optionObj = {
urlKey: string,
Expand Down
1 change: 1 addition & 0 deletions src/screens/Transaction/Order/ShowOrder.res
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ let make = (~id, ~profileId, ~merchantId, ~orgId) => {
StatementDescriptorSuffix,
PaymentExperience,
MerchantOrderReferenceId,
OvercaptureStatus,
]
isNonRefundConnector={isNonRefundConnector(orderData.connector)}
paymentStatus={orderData.status}
Expand Down
1 change: 1 addition & 0 deletions src/utils/Mappers/BusinessProfileMapper.res
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ let businessProfileTypeMapper = values => {
is_auto_retries_enabled: jsonDict->getOptionBool("is_auto_retries_enabled"),
max_auto_retries_enabled: jsonDict->getOptionInt("max_auto_retries_enabled"),
is_click_to_pay_enabled: jsonDict->getOptionBool("is_click_to_pay_enabled"),
always_request_overcapture: jsonDict->getOptionBool("always_request_overcapture"),
authentication_product_ids: Some(
jsonDict
->getDictfromDict("authentication_product_ids")
Expand Down
Loading