-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(applepay): calculate tax amount dynamically while changing shipp…
…ing address in apple pay sdk Calculate tax amount and shipping cost dynamically while changing shipping address in apple pay sdk and update the new amount.
- Loading branch information
Sagnik Mitra
authored and
Sagnik Mitra
committed
Sep 12, 2024
1 parent
65dc747
commit 9822330
Showing
10 changed files
with
209 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
open Utils | ||
|
||
type calculateTaxResponse = { | ||
payment_id: string, | ||
net_amount: int, | ||
order_tax_amount: int, | ||
shipping_cost: int, | ||
} | ||
|
||
let taxResponseToObjMapper = dict => { | ||
payment_id: dict->getString("payment_id", ""), | ||
net_amount: dict->getInt("net_amount", 0), | ||
order_tax_amount: dict->getInt("order_tax_amount", 0), | ||
shipping_cost: dict->getInt("shipping_cost", 0), | ||
} | ||
|
||
let calculateTax = (~shippingAddress, ~logger, ~clientSecret, ~publishableKey, ~paymentMethodType) => { | ||
PaymentHelpers.calculateTax( | ||
~clientSecret=clientSecret->Js.Json.string, | ||
~apiKey=publishableKey, | ||
~paymentId=clientSecret->getPaymentId, | ||
~paymentMethodType, | ||
~shippingAddress, | ||
~logger, | ||
~customPodUri="", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters