@@ -6,62 +6,47 @@ external renderAmazonPayButton: (~buttonId: string, ~config: amazonPayConfigType
66
77let deliveryPriceMapper = dict => {
88 {
9- amount : getInt (dict , "amount" , 0 ),
10- displayAmount : getString (dict , "display_amount" , "" ),
11- currencyCode : getString (dict , "currency_code" , "" ),
9+ amount : dict -> getInt ("amount" , 0 ),
10+ displayAmount : dict -> getString ("display_amount" , "" ),
11+ currencyCode : dict -> getString ("currency_code" , "" ),
1212 }
1313}
1414
1515let shippingMethodMapper = dict => {
1616 {
17- shippingMethodName : getString (dict , "shipping_method_name" , "" ),
18- shippingMethodCode : getString (dict , "shipping_method_code" , "" ),
17+ shippingMethodName : dict -> getString ("shipping_method_name" , "" ),
18+ shippingMethodCode : dict -> getString ("shipping_method_code" , "" ),
1919 }
2020}
2121
2222let deliveryOptionMapper = dict => {
2323 let priceData = dict -> getDictFromDict ("price" )-> deliveryPriceMapper
2424 {
25- id : getString (dict , "id" , "" ),
25+ id : dict -> getString ("id" , "" ),
2626 price : {
2727 amount : priceData .displayAmount ,
2828 currencyCode : priceData .currencyCode ,
2929 },
3030 shippingMethod : dict -> getDictFromDict ("shipping_method" )-> shippingMethodMapper ,
31- isDefault : getBool (dict , "is_default" , false ),
31+ isDefault : dict -> getBool ("is_default" , false ),
3232 }
3333}
3434
3535let amazonPayTokenMapper = dict => {
3636 {
37- walletName : getString (dict , "wallet_name" , "" ),
38- merchantId : getString (dict , "merchant_id" , "" ),
39- ledgerCurrency : getString (dict , "ledger_currency" , "" ),
40- storeId : getString (dict , "store_id" , "" ),
41- paymentIntent : getString (dict , "payment_intent" , "" ),
42- totalShippingAmount : getString (dict , "total_shipping_amount" , "" ),
43- totalTaxAmount : getString (dict , "total_tax_amount" , "" ),
44- totalBaseAmount : getString (dict , "total_base_amount" , "" ),
45- deliveryOptions : getArray (dict , "delivery_options" )-> Array .map (item =>
46- item -> getDictFromJson -> deliveryOptionMapper
47- ),
37+ walletName : dict -> getString ("wallet_name" , "" ),
38+ merchantId : dict -> getString ("merchant_id" , "" ),
39+ ledgerCurrency : dict -> getString ("ledger_currency" , "" ),
40+ storeId : dict -> getString ("store_id" , "" ),
41+ paymentIntent : dict -> getString ("payment_intent" , "" ),
42+ totalTaxAmount : dict -> getString ("total_tax_amount" , "" ),
43+ totalBaseAmount : dict -> getString ("total_base_amount" , "" ),
44+ deliveryOptions : dict
45+ -> getArray ("delivery_options" )
46+ -> Array .map (item => item -> getDictFromJson -> deliveryOptionMapper ),
4847 }
4948}
5049
51- let mapDeliveryOptionsToConfig = (options : array <deliveryOption >): array <deliveryOption > => {
52- options -> Array .map (option => {
53- {
54- id : option .id ,
55- price : {
56- amount : option .price .amount ,
57- currencyCode : option .price .currencyCode ,
58- },
59- shippingMethod : option .shippingMethod ,
60- isDefault : option .isDefault ,
61- }
62- })
63- }
64-
6550let amazonPayBody = (amazonCheckoutSessionId , shipping ) => {
6651 let wallet = {
6752 amazon_pay : {
0 commit comments