-
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 (#610) Co-authored-by: Sagnik Mitra <[email protected]> Co-authored-by: Pritish Budhiraja <[email protected]>
- Loading branch information
1 parent
0f60c12
commit 0804823
Showing
10 changed files
with
207 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->JSON.Encode.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