@paykka/card-checkout-ui 0.11.6 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/card-checkout-ui.js +19 -19
  2. package/dist/card-checkout-ui.umd.cjs +19 -19
  3. package/dist/es/_commonjsHelpers.js +82 -1
  4. package/dist/es/api/index.js +1 -0
  5. package/dist/es/api/modules/address/index.js +9 -9
  6. package/dist/es/api/modules/ali-pay/index.js +10 -49
  7. package/dist/es/api/modules/apple-pay/index.js +13 -59
  8. package/dist/es/api/modules/boost/index.js +8 -48
  9. package/dist/es/api/modules/card/index.js +10 -54
  10. package/dist/es/api/modules/checkout/index.js +11 -9
  11. package/dist/es/api/modules/checkout/map.js +25 -18
  12. package/dist/es/api/modules/encrypted-card/index.js +3 -2
  13. package/dist/es/api/modules/gcash/index.js +8 -48
  14. package/dist/es/api/modules/get-browser-params.js +4 -1
  15. package/dist/es/api/modules/google-pay/index.js +10 -56
  16. package/dist/es/api/modules/grab-pay/index.js +8 -48
  17. package/dist/es/api/modules/index.js +1 -0
  18. package/dist/es/api/modules/line-pay/index.js +8 -48
  19. package/dist/es/api/modules/map.js +17 -11
  20. package/dist/es/api/modules/may-bank-qr-pay/index.js +8 -48
  21. package/dist/es/api/modules/nine-pay/index.js +8 -48
  22. package/dist/es/api/modules/paymaya/index.js +8 -48
  23. package/dist/es/api/modules/risk/index.js +2 -1
  24. package/dist/es/api/modules/sepa/index.js +10 -51
  25. package/dist/es/api/modules/shopee-pay/index.js +8 -48
  26. package/dist/es/api/modules/threeDS/index.js +3 -0
  27. package/dist/es/api/modules/tng-wallet/index.js +8 -48
  28. package/dist/es/api/modules/wechat-pay/index.js +10 -51
  29. package/dist/es/api/modules/zalopay/index.js +16 -0
  30. package/dist/es/api/utils/index.js +59 -0
  31. package/dist/es/components/AddressField/index.js +37 -37
  32. package/dist/es/components/AliPay/index.js +158 -111
  33. package/dist/es/components/ApplePay/index.js +99 -67
  34. package/dist/es/components/Boost/index.js +91 -70
  35. package/dist/es/components/Card/index.js +114 -107
  36. package/dist/es/components/CardSelector/index.js +1 -1
  37. package/dist/es/components/DropIn/index.js +12 -4
  38. package/dist/es/components/EncryptedCard/index.js +6 -2
  39. package/dist/es/components/GooglePay/index.js +94 -60
  40. package/dist/es/components/GrabPay/index.js +91 -70
  41. package/dist/es/components/GuideCard/index.js +10 -7
  42. package/dist/es/components/LinePay/index.js +91 -70
  43. package/dist/es/components/MayBankQRPay/index.js +302 -275
  44. package/dist/es/components/NinePay/index.js +91 -70
  45. package/dist/es/components/SecuredFieldsProvider/index.js +26 -9
  46. package/dist/es/components/SecuredIframe/index.js +40 -61
  47. package/dist/es/components/Sepa/index.js +72 -53
  48. package/dist/es/components/ShopeePay/index.js +91 -70
  49. package/dist/es/components/SubmitButton/index.js +8 -7
  50. package/dist/es/components/TNGWallet/index.js +91 -70
  51. package/dist/es/components/ThreeDS/index.js +32 -7
  52. package/dist/es/components/WechatPay/index.js +151 -102
  53. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +26 -6
  54. package/dist/es/components/index.js +1 -0
  55. package/dist/es/components/internal/Form/FormItem.js +1 -1
  56. package/dist/es/components/internal/Form/util.js +1 -1
  57. package/dist/es/components/internal/Modal/Modal.js +1 -1
  58. package/dist/es/components/internal/Select/Select.js +19 -8
  59. package/dist/es/components/internal/Select/SelectMenu.js +2 -2
  60. package/dist/es/components/internal/Select/SelectMenuItem.js +12 -4
  61. package/dist/es/components/internal/icons/IconError.js +7 -4
  62. package/dist/es/components/internal/icons/IconZalopay.js +47 -0
  63. package/dist/es/components/internal/icons/IconZalopayComplete.js +48 -0
  64. package/dist/es/components/wallets/GCash/GCash.js +80 -56
  65. package/dist/es/components/wallets/Paymaya/Paymaya.js +91 -70
  66. package/dist/es/components/wallets/Zalopay/Zalopay.js +381 -0
  67. package/dist/es/components/wallets/Zalopay/index.js +1 -0
  68. package/dist/es/components/wallets/Zalopay/type.js +1 -0
  69. package/dist/es/components/wallets/Zalopay/zalopay2.js +1 -0
  70. package/dist/es/config.js +5 -5
  71. package/dist/es/constant.js +8 -2
  72. package/dist/es/core/{Address.js → address.js} +8 -16
  73. package/dist/es/core/{PayKKaCheckout.js → checkout.js} +101 -27
  74. package/dist/es/core/create.js +1 -1
  75. package/dist/es/core/query.js +3 -2
  76. package/dist/es/core/{Session.js → session.js} +28 -32
  77. package/dist/es/core/theme.js +65 -0
  78. package/dist/es/core.js +0 -4
  79. package/dist/es/hooks/usePayment.js +14 -0
  80. package/dist/es/i18n/locales/de-DE.js +3 -1
  81. package/dist/es/i18n/locales/en-GB.js +3 -1
  82. package/dist/es/i18n/locales/es-ES.js +3 -1
  83. package/dist/es/i18n/locales/fr-FR.js +3 -1
  84. package/dist/es/i18n/locales/ja-JP.js +3 -1
  85. package/dist/es/i18n/locales/ko-KR.js +3 -1
  86. package/dist/es/i18n/locales/nl-NL.js +3 -1
  87. package/dist/es/i18n/locales/pt-PT.js +3 -1
  88. package/dist/es/i18n/locales/ru-RU.js +3 -1
  89. package/dist/es/i18n/locales/zh-CN.js +3 -1
  90. package/dist/es/i18n/locales/zh-HK.js +3 -1
  91. package/dist/es/i18n/locales/zh-TW.js +3 -1
  92. package/dist/es/index.js +21 -7
  93. package/dist/es/style.css +1 -1
  94. package/dist/es/types/index.js +7 -0
  95. package/dist/es/utils/colors.js +5 -1
  96. package/dist/es/utils/format.js +0 -5
  97. package/dist/es/utils/object.js +31 -1
  98. package/dist/es/utils/payment.js +82 -0
  99. package/dist/es/utils/redirect.js +4 -4
  100. package/dist/es/utils/string.js +10 -0
  101. package/dist/es/utils/system-info/is-ua-webview.js +14 -12
  102. package/dist/es/utils/theme.js +7 -0
  103. package/dist/style.css +1 -1
  104. package/dist/types/api/modules/address/index.d.ts +15 -6
  105. package/dist/types/api/modules/ali-pay/index.d.ts +3 -19
  106. package/dist/types/api/modules/apple-pay/index.d.ts +4 -14
  107. package/dist/types/api/modules/boost/index.d.ts +3 -23
  108. package/dist/types/api/modules/card/index.d.ts +3 -30
  109. package/dist/types/api/modules/checkout/index.d.ts +3 -3
  110. package/dist/types/api/modules/checkout/map.d.ts +3 -3
  111. package/dist/types/api/modules/checkout/type.d.ts +33 -4
  112. package/dist/types/api/modules/gcash/index.d.ts +3 -23
  113. package/dist/types/api/modules/get-browser-params.d.ts +1 -0
  114. package/dist/types/api/modules/google-pay/index.d.ts +3 -13
  115. package/dist/types/api/modules/grab-pay/index.d.ts +3 -23
  116. package/dist/types/api/modules/index.d.ts +1 -0
  117. package/dist/types/api/modules/line-pay/index.d.ts +3 -23
  118. package/dist/types/api/modules/map.d.ts +2 -2
  119. package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +3 -23
  120. package/dist/types/api/modules/nine-pay/index.d.ts +3 -23
  121. package/dist/types/api/modules/paymaya/index.d.ts +3 -23
  122. package/dist/types/api/modules/sepa/index.d.ts +3 -24
  123. package/dist/types/api/modules/shopee-pay/index.d.ts +3 -23
  124. package/dist/types/api/modules/tng-wallet/index.d.ts +3 -23
  125. package/dist/types/api/modules/type.d.ts +74 -21
  126. package/dist/types/api/modules/wechat-pay/index.d.ts +3 -20
  127. package/dist/types/api/modules/zalopay/index.d.ts +4 -0
  128. package/dist/types/api/utils/index.d.ts +48 -0
  129. package/dist/types/components/AddressField/type.d.ts +3 -9
  130. package/dist/types/components/AliPay/AliPay.d.ts +6 -2
  131. package/dist/types/components/AliPay/type.d.ts +15 -2
  132. package/dist/types/components/ApplePay/ApplePay.d.ts +6 -2
  133. package/dist/types/components/ApplePay/type.d.ts +10 -14
  134. package/dist/types/components/ApplePay/utils.d.ts +1 -1
  135. package/dist/types/components/Boost/Boost.d.ts +6 -2
  136. package/dist/types/components/Boost/type.d.ts +2 -24
  137. package/dist/types/components/Card/Card.d.ts +6 -2
  138. package/dist/types/components/Card/type.d.ts +3 -43
  139. package/dist/types/components/DropIn/DropIn.d.ts +6 -2
  140. package/dist/types/components/DropIn/type.d.ts +4 -10
  141. package/dist/types/components/GooglePay/GooglePay.d.ts +6 -2
  142. package/dist/types/components/GooglePay/createGooglePay.d.ts +2 -1
  143. package/dist/types/components/GooglePay/type.d.ts +10 -26
  144. package/dist/types/components/GrabPay/GrabPay.d.ts +6 -2
  145. package/dist/types/components/GrabPay/type.d.ts +3 -25
  146. package/dist/types/components/LinePay/LinePay.d.ts +6 -2
  147. package/dist/types/components/LinePay/type.d.ts +3 -25
  148. package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -2
  149. package/dist/types/components/MayBankQRPay/type.d.ts +3 -25
  150. package/dist/types/components/NinePay/NinePay.d.ts +6 -2
  151. package/dist/types/components/NinePay/type.d.ts +3 -25
  152. package/dist/types/components/SecuredFieldsProvider/type.d.ts +5 -0
  153. package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +3 -1
  154. package/dist/types/components/Sepa/Sepa.d.ts +6 -2
  155. package/dist/types/components/Sepa/type.d.ts +3 -2
  156. package/dist/types/components/ShopeePay/ShopeePay.d.ts +6 -2
  157. package/dist/types/components/ShopeePay/type.d.ts +3 -25
  158. package/dist/types/components/TNGWallet/TNGWallet.d.ts +6 -2
  159. package/dist/types/components/TNGWallet/type.d.ts +3 -25
  160. package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +2 -0
  161. package/dist/types/components/WechatPay/WechatPay.d.ts +6 -2
  162. package/dist/types/components/WechatPay/type.d.ts +15 -2
  163. package/dist/types/components/business/QRCodeModal/type.d.ts +2 -0
  164. package/dist/types/components/index.d.ts +1 -0
  165. package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
  166. package/dist/types/components/internal/Select/SelectMenu.d.ts +1 -1
  167. package/dist/types/components/internal/icons/IconZalopay.d.ts +2 -0
  168. package/dist/types/components/internal/icons/IconZalopayComplete.d.ts +2 -0
  169. package/dist/types/components/internal/icons/index.d.ts +3 -0
  170. package/dist/types/components/wallets/GCash/GCash.d.ts +6 -2
  171. package/dist/types/components/wallets/GCash/type.d.ts +3 -35
  172. package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -2
  173. package/dist/types/components/wallets/Paymaya/type.d.ts +3 -25
  174. package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +10 -0
  175. package/dist/types/components/wallets/Zalopay/index.d.ts +2 -0
  176. package/dist/types/components/wallets/Zalopay/type.d.ts +39 -0
  177. package/dist/types/config.d.ts +2 -4
  178. package/dist/types/constant.d.ts +3 -1
  179. package/dist/types/core/{Address.d.ts → address.d.ts} +23 -24
  180. package/dist/types/core/{PayKKaCheckout.d.ts → checkout.d.ts} +9 -3
  181. package/dist/types/core/context.d.ts +3 -2
  182. package/dist/types/core/index.d.ts +3 -2
  183. package/dist/types/core/query.d.ts +2 -2
  184. package/dist/types/core/session.d.ts +23 -0
  185. package/dist/types/core/theme.d.ts +7 -0
  186. package/dist/types/hooks/index.d.ts +1 -0
  187. package/dist/types/hooks/usePayment.d.ts +8 -0
  188. package/dist/types/i18n/locales/de-DE.d.ts +2 -0
  189. package/dist/types/i18n/locales/en-GB.d.ts +2 -0
  190. package/dist/types/i18n/locales/es-ES.d.ts +2 -0
  191. package/dist/types/i18n/locales/fr-FR.d.ts +2 -0
  192. package/dist/types/i18n/locales/ja-JP.d.ts +2 -0
  193. package/dist/types/i18n/locales/ko-KR.d.ts +2 -0
  194. package/dist/types/i18n/locales/nl-NL.d.ts +2 -0
  195. package/dist/types/i18n/locales/pt-PT.d.ts +2 -0
  196. package/dist/types/i18n/locales/ru-RU.d.ts +2 -0
  197. package/dist/types/i18n/locales/zh-CN.d.ts +2 -0
  198. package/dist/types/i18n/locales/zh-HK.d.ts +2 -0
  199. package/dist/types/i18n/locales/zh-TW.d.ts +2 -0
  200. package/dist/types/index.d.ts +2 -1
  201. package/dist/types/types/index.d.ts +70 -32
  202. package/dist/types/types/message.d.ts +30 -25
  203. package/dist/types/utils/card-brand/index.d.ts +3 -3
  204. package/dist/types/utils/colors.d.ts +1 -0
  205. package/dist/types/utils/index.d.ts +4 -2
  206. package/dist/types/utils/object.d.ts +7 -0
  207. package/dist/types/utils/payment.d.ts +37 -0
  208. package/dist/types/utils/string.d.ts +1 -0
  209. package/dist/types/utils/style.d.ts +1 -1
  210. package/dist/types/utils/system-info/is-ua-webview.d.ts +1 -1
  211. package/dist/types/utils/theme.d.ts +4 -0
  212. package/package.json +3 -3
  213. package/dist/es/utils/deep-freeze.js +0 -13
  214. package/dist/es/utils/obj.js +0 -22
  215. package/dist/types/core/Session.d.ts +0 -16
  216. package/dist/types/utils/deep-freeze.d.ts +0 -1
  217. package/dist/types/utils/obj.d.ts +0 -6
@@ -1,61 +1,15 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
3
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
6
4
  import { payResMap } from "../map.js";
7
- async function googlePay({
8
- sessionId,
9
- clientKey,
10
- token,
11
- bill,
12
- browser
13
- }, core, options) {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", PaymentMethod.GOOGLE_PAY);
16
- const params = deepMerge({
17
- bill: {
18
- first_name: bill == null ? void 0 : bill.firstName,
19
- middle_name: bill == null ? void 0 : bill.middleName,
20
- last_name: bill == null ? void 0 : bill.lastName,
21
- address_line1: bill == null ? void 0 : bill.addressLine1,
22
- address_line2: bill == null ? void 0 : bill.addressLine2,
23
- country: bill == null ? void 0 : bill.country,
24
- state: bill == null ? void 0 : bill.state,
25
- city: bill == null ? void 0 : bill.city,
26
- email: bill == null ? void 0 : bill.email,
27
- postal_code: bill == null ? void 0 : bill.postalCode,
28
- area_code: bill == null ? void 0 : bill.areaCode,
29
- phone_number: bill == null ? void 0 : bill.phoneNumber,
30
- descriptor: bill == null ? void 0 : bill.descriptor
31
- }
32
- }, extraParams || {});
33
- return http.post(
34
- "/session/payments",
35
- {
36
- ...params,
37
- session_id: sessionId,
38
- client_key: clientKey,
39
- payment: {
40
- payment_method: PaymentMethod.GOOGLE_PAY,
41
- token_data: token
42
- },
43
- browser
44
- },
45
- options
46
- ).then(payResMap);
47
- }
48
- async function getGooglePayInfo({ sessionId, clientKey }, options) {
49
- return http.post(
50
- "/session/payments/query",
51
- {
52
- session_id: sessionId,
53
- client_key: clientKey,
54
- payment_method: PaymentMethod.GOOGLE_PAY
55
- },
56
- options
57
- ).then(payResMap);
58
- }
5
+ const googlePay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
8
+ };
9
+ const getGooglePayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
12
+ };
59
13
  export {
60
14
  getGooglePayInfo,
61
15
  googlePay
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
3
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
6
4
  import { payResMap } from "../map.js";
7
- const grabPay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
5
+ const grabPay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getGrabPayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.GRAB_PAY
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getGrabPayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getGrabPayInfo,
@@ -1,3 +1,4 @@
1
1
  import "../../utils/card-brand/brands.js";
2
2
  import "../../utils/system-info/get-browser-info.js";
3
+ import "../../core.js";
3
4
  import "../http.js";
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
5
1
  import { http } from "../../http.js";
6
2
  import { payResMap } from "../map.js";
7
- const linePay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
3
+ import { apiPrefix } from "../../../config.js";
4
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
5
+ const linePay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getLinePayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.LINE_PAY
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getLinePayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getLinePayInfo,
@@ -1,28 +1,34 @@
1
- function amountMap(res) {
1
+ const amountMap = (res) => {
2
2
  return {
3
3
  amount: res == null ? void 0 : res.amount,
4
4
  currency: res == null ? void 0 : res.currency,
5
5
  symbol: res == null ? void 0 : res.symbol,
6
6
  digits: res == null ? void 0 : res.default_fraction_digits
7
7
  };
8
- }
9
- function payResMap(res) {
10
- var _a, _b;
8
+ };
9
+ const payResMap = (res) => {
10
+ var _a;
11
+ const payInfo = res.pay_info || {};
11
12
  return {
13
+ sessionId: res.session_id,
14
+ merchantId: res.merchant_id,
12
15
  errorCode: res.error_code,
13
16
  errorMessage: res.error_description,
14
- merchantId: res.merchant_id,
15
- sessionId: res.session_id,
16
17
  orderId: res.order_id,
17
18
  transAmount: amountMap(res.trans_amount),
18
19
  status: res.status,
19
20
  orderStatus: res.order_status,
20
- threeDSUrl: (_a = res.authentication_result) == null ? void 0 : _a.authentication_url,
21
- paymentUrl: (_b = res.pay_info) == null ? void 0 : _b.payment_url,
22
- paymentExpiredAt: res == null ? void 0 : res.payment_expire_time,
23
- payInfo: res.pay_info
21
+ paymentMethod: res.payment_method,
22
+ finishTime: res.utc_finish_time,
23
+ payInfo: {
24
+ threeDSUrl: (_a = res.authentication_result) == null ? void 0 : _a.authentication_url,
25
+ paymentUrl: payInfo.payment_url,
26
+ paymentExpiredAt: res == null ? void 0 : res.payment_expire_time,
27
+ ...payInfo
28
+ },
29
+ rawResponse: res
24
30
  };
25
- }
31
+ };
26
32
  export {
27
33
  amountMap,
28
34
  payResMap
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
6
3
  import { payResMap } from "../map.js";
7
- const mayBankQRPay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
4
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
5
+ const mayBankQRPay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getMayBankQRPayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.MAY_BANK_QR_PAY
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getMayBankQRPayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getMayBankQRPayInfo,
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
3
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
6
4
  import { payResMap } from "../map.js";
7
- const ninePay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
5
+ const ninePay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getNinePayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.NINE_PAY
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getNinePayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getNinePayInfo,
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
2
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
5
3
  import { http } from "../../http.js";
6
4
  import { payResMap } from "../map.js";
7
- const paymayaPay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
5
+ const paymayaPay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getPaymayaPayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.PAYMAYA
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getPaymayaPayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getPaymayaPayInfo,
@@ -1,6 +1,7 @@
1
+ import { apiPrefix } from "../../../config.js";
1
2
  import { http } from "../../http.js";
2
3
  const getRiskAuthorization = async (params, options) => {
3
- return http.post("/session/fraud-detection/component/authorization", params, options).then((res) => {
4
+ return http.post(`${apiPrefix}/fraud-detection/component/authorization`, params, options).then((res) => {
4
5
  return {
5
6
  authCode: res.auth_code,
6
7
  channel: res.channel,
@@ -1,56 +1,15 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
3
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
6
4
  import { payResMap } from "../map.js";
7
- async function sepaPay({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", PaymentMethod.SEPA_DEBIT);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- iban: payment.iban,
36
- payment_method: PaymentMethod.SEPA_DEBIT,
37
- holder_name: payment.holderName
38
- },
39
- browser
40
- },
41
- options
42
- ).then(payResMap);
43
- }
44
- async function getSepaPayInfo({ sessionId, clientKey }, options) {
45
- return http.post(
46
- "/session/payments/query",
47
- {
48
- session_id: sessionId,
49
- client_key: clientKey
50
- },
51
- options
52
- ).then(payResMap);
53
- }
5
+ const sepaPay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
8
+ };
9
+ const getSepaPayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
12
+ };
54
13
  export {
55
14
  getSepaPayInfo,
56
15
  sepaPay
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
3
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
6
4
  import { payResMap } from "../map.js";
7
- const shopeePay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
5
+ const shopeePay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getShopeePayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.SHOPEE_PAY
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getShopeePayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getShopeePayInfo,
@@ -1 +1,4 @@
1
+ import "../../../utils/card-brand/brands.js";
2
+ import "../../../utils/system-info/get-browser-info.js";
3
+ import "../../../core.js";
1
4
  import "../../http.js";
@@ -1,54 +1,14 @@
1
- import { PaymentMethod } from "../../../constant.js";
2
- import "../../../utils/card-brand/brands.js";
3
- import "../../../utils/system-info/get-browser-info.js";
4
- import { deepMerge } from "../../../utils/object.js";
1
+ import { apiPrefix } from "../../../config.js";
5
2
  import { http } from "../../http.js";
3
+ import { buildPaymentParams, buildQueryParams } from "../../utils/index.js";
6
4
  import { payResMap } from "../map.js";
7
- const tngWalletPay = async ({
8
- sessionId,
9
- clientKey,
10
- payment,
11
- bill,
12
- browser
13
- }, core, options) => {
14
- const { _getExtraParams } = core.config;
15
- const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
16
- const params = deepMerge({
17
- bill: {
18
- email: bill.email,
19
- country: bill.country,
20
- state: bill.province,
21
- city: bill.city,
22
- postal_code: bill.postCode,
23
- address_line1: bill.address1,
24
- address_line2: bill.address2,
25
- county: bill.area
26
- }
27
- }, extraParams || {});
28
- return http.post(
29
- "/session/payments",
30
- {
31
- ...params,
32
- session_id: sessionId,
33
- client_key: clientKey,
34
- payment: {
35
- payment_method: payment.paymentMethod
36
- },
37
- browser
38
- },
39
- options
40
- ).then(payResMap);
5
+ const tngWalletPay = async (params, extraParams, options) => {
6
+ const paymentParams = buildPaymentParams(params, extraParams);
7
+ return http.post(`${apiPrefix}/payments`, paymentParams, options).then(payResMap);
41
8
  };
42
- const getTNGWalletPayInfo = async ({ sessionId, clientKey }, options) => {
43
- return http.post(
44
- "/session/payments/query",
45
- {
46
- session_id: sessionId,
47
- client_key: clientKey,
48
- payment_method: PaymentMethod.TNG_WALLET
49
- },
50
- options
51
- ).then(payResMap);
9
+ const getTNGWalletPayInfo = async (params, extraParams, options) => {
10
+ const queryParams = buildQueryParams(params, extraParams);
11
+ return http.post(`${apiPrefix}/payments/query`, queryParams, options).then(payResMap);
52
12
  };
53
13
  export {
54
14
  getTNGWalletPayInfo,