@tap-payments/apple-pay-button 0.0.68-development → 1.0.0-test

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 (51) hide show
  1. package/README.md +30 -30
  2. package/build/@types/ApplePaySession.d.ts +67 -0
  3. package/build/@types/index.d.ts +118 -6
  4. package/build/@types/index.js +1 -6
  5. package/build/api/app.service.d.ts +23 -0
  6. package/build/{api.js → api/app.service.js} +93 -84
  7. package/build/api/base.d.ts +9 -0
  8. package/build/api/base.js +45 -0
  9. package/build/api/httpClient.d.ts +8 -0
  10. package/build/api/httpClient.js +33 -0
  11. package/build/constants/index.d.ts +58 -2
  12. package/build/constants/index.js +58 -2
  13. package/build/features/ApplePayButton/ApplePayButton.css +21 -0
  14. package/build/features/ApplePayButton/ApplePayButton.d.ts +5 -3
  15. package/build/features/ApplePayButton/ApplePayButton.js +25 -9
  16. package/build/features/ApplePayButton/index.d.ts +3 -3
  17. package/build/features/ApplePayButton/index.js +2 -2
  18. package/build/hooks/index.d.ts +1 -1
  19. package/build/hooks/index.js +1 -1
  20. package/build/hooks/useApplePay.d.ts +7 -85
  21. package/build/hooks/useApplePay.js +178 -262
  22. package/build/hooks/useGetEvents.d.ts +4 -0
  23. package/build/hooks/useGetEvents.js +15 -0
  24. package/build/hooks/useScript.d.ts +1 -0
  25. package/build/hooks/useScript.js +39 -0
  26. package/build/index.d.ts +4 -4
  27. package/build/index.js +7 -5
  28. package/build/utils/config.d.ts +9 -7
  29. package/build/utils/config.js +52 -41
  30. package/build/utils/defaultValues.d.ts +32 -2
  31. package/build/utils/defaultValues.js +31 -10
  32. package/build/utils/index.d.ts +0 -3
  33. package/build/utils/index.js +0 -3
  34. package/package.json +11 -16
  35. package/build/@types/ApplePayButtonProps.d.ts +0 -128
  36. package/build/@types/charge.d.ts +0 -57
  37. package/build/@types/charge.js +0 -1
  38. package/build/@types/checkoutProfile.d.ts +0 -194
  39. package/build/@types/checkoutProfile.js +0 -1
  40. package/build/@types/enums.d.ts +0 -65
  41. package/build/@types/enums.js +0 -76
  42. package/build/@types/tapLocalisation.d.ts +0 -193
  43. package/build/@types/tapLocalisation.js +0 -1
  44. package/build/@types/tapTheme.d.ts +0 -842
  45. package/build/@types/tapTheme.js +0 -1
  46. package/build/api.d.ts +0 -34
  47. package/build/hooks/useMerchantApplePay.d.ts +0 -20
  48. package/build/hooks/useMerchantApplePay.js +0 -176
  49. package/build/utils/theme.d.ts +0 -12
  50. package/build/utils/theme.js +0 -61
  51. /package/build/@types/{ApplePayButtonProps.js → ApplePaySession.js} +0 -0
package/build/index.js CHANGED
@@ -1,10 +1,12 @@
1
- import { ApplePayButton, renderApplePayButton } from './features/ApplePayButton';
2
- import { ThemeMode, Scope, SupportedNetworks, Locale, ButtonType, Edges, MerchantCapabilities } from './@types/enums';
3
- export { ApplePayButton, ThemeMode, Scope, SupportedNetworks, Locale, ButtonType, Edges, MerchantCapabilities };
4
- window['TapSDKs'] = {
5
- renderApplePayButton: renderApplePayButton,
1
+ import { ApplePayButton, render, abortApplePaySession } from './features/ApplePayButton';
2
+ import { ThemeMode, Scope, SupportedNetworks, Environment, Locale, ButtonType, Edges, MerchantCapabilities } from './constants';
3
+ export { ApplePayButton, abortApplePaySession, ThemeMode, Scope, SupportedNetworks, Environment, Locale, ButtonType, Edges, MerchantCapabilities };
4
+ window['TapApplepaySDK'] = {
5
+ render: render,
6
+ abortApplePaySession: abortApplePaySession,
6
7
  Scope: Scope,
7
8
  SupportedNetworks: SupportedNetworks,
9
+ Environment: Environment,
8
10
  Locale: Locale,
9
11
  ButtonType: ButtonType,
10
12
  ThemeMode: ThemeMode,
@@ -1,11 +1,13 @@
1
- import { Acceptance, ApplePayButtonProps, ApplePayRequestData, MetaData, PaymentMethod } from '../@types';
2
- export declare const validateSupportedNetworks: (supportedNetworksOptions: Acceptance['supportedSchemes'], merchantSupportedNetworks?: Acceptance['supportedSchemes']) => Acceptance['supportedSchemes'];
3
- export declare const getApplePayPaymentMethod: (paymentMethods: Array<PaymentMethod>) => PaymentMethod;
4
- export declare const getApplePayRequest: ({ order, customer, supportedNetworks, merchantCapabilities, countryCode, name }: Pick<ApplePayButtonProps, "order" | "customer"> & {
5
- supportedNetworks: Acceptance['supportedSchemes'];
1
+ import { Acceptance, ApplePayButtonProps, ApplePayRequestData, PaymentMethod } from '../@types';
2
+ import { SupportedNetworks } from '../constants';
3
+ export declare const validateSupportedNetworks: (supportedNetworksConfig: Array<(typeof SupportedNetworks)[keyof typeof SupportedNetworks]>, supportedNetworks: Acceptance['supportedBrands']) => ("amex" | "mada" | "masterCard" | "visa" | "chinaUnionPay" | "discover" | "electron" | "jcb" | "maestro")[];
4
+ export declare const validateCurrency: (currency: string, currencies: string[]) => string;
5
+ export declare const getApplePayRequest: ({ transaction, customer, supportedNetworks, merchantCapabilities, countryCode, name, acceptance }: Pick<ApplePayButtonProps, "transaction" | "customer" | "acceptance"> & {
6
+ supportedNetworks: Acceptance['supportedBrands'];
6
7
  merchantCapabilities: ApplePayRequestData['merchantCapabilities'];
7
8
  countryCode: string;
8
9
  name: string;
9
10
  }) => ApplePayRequestData;
10
- export declare const prepareApplePayRequest: ({ payment_options, merchant, order, customer, acceptance }: Pick<MetaData, 'merchant' | 'payment_options'> & Pick<ApplePayButtonProps, 'order' | 'customer' | 'acceptance'>) => ApplePayRequestData;
11
- export declare const shallRenderApplePay: () => boolean;
11
+ export declare const getApplePayPaymentMethod: (paymentMethods: Array<PaymentMethod>) => PaymentMethod;
12
+ export declare const rsaSetup: (key: string) => (string: string) => string;
13
+ export declare function generateApplicationHeader(obj: Record<string, string | any>): string;
@@ -1,36 +1,34 @@
1
- import { getMerchantCapabilities } from './defaultValues';
2
- export var validateSupportedNetworks = function (supportedNetworksOptions, merchantSupportedNetworks) {
1
+ import { JSEncrypt } from 'jsencrypt';
2
+ export var validateSupportedNetworks = function (supportedNetworksConfig, supportedNetworks) {
3
3
  var toLowerCase = function (item) { return item.toLowerCase(); };
4
- if (!supportedNetworksOptions)
5
- throw new Error("There is no supported networks available in your acceptance object");
6
- if (!merchantSupportedNetworks)
7
- return supportedNetworksOptions.map(toLowerCase);
8
- if (merchantSupportedNetworks.length === 0)
9
- return supportedNetworksOptions.map(toLowerCase);
10
- var supportedNetworks = supportedNetworksOptions.filter(function (item) {
11
- return merchantSupportedNetworks.find(function (network) { return network.toLowerCase() === item.toLowerCase(); });
12
- });
13
- if (supportedNetworks.length === 0) {
14
- throw new Error("It seems that there is no supported networks available in based on your acceptance object");
4
+ if (!supportedNetworks)
5
+ return supportedNetworksConfig.map(toLowerCase);
6
+ if (supportedNetworks.length === 0)
7
+ return supportedNetworksConfig.map(toLowerCase);
8
+ if (supportedNetworks.length > supportedNetworksConfig.length) {
9
+ throw new Error("The supported networks list is not valid");
15
10
  }
16
- return supportedNetworks.map(toLowerCase);
17
- };
18
- export var getApplePayPaymentMethod = function (paymentMethods) {
19
- var paymentMethod = paymentMethods.find(function (_a) {
20
- var name = _a.name, payment_type = _a.payment_type;
21
- return [name, payment_type].some(function (item) { return item.toLowerCase() === 'apple_pay'; });
11
+ supportedNetworks.forEach(function (network) {
12
+ var isSupported = supportedNetworksConfig.some(function (item) { return item.toLowerCase() === network.toLowerCase(); });
13
+ if (!isSupported) {
14
+ throw new Error("The supported network ".concat(network, " is not supported"));
15
+ }
22
16
  });
23
- if (!paymentMethod) {
24
- throw new Error('apple_pay is not configured in your payment options');
17
+ return supportedNetworks;
18
+ };
19
+ export var validateCurrency = function (currency, currencies) {
20
+ var isSupported = currencies.some(function (item) { return item.toLowerCase() === currency.toLowerCase(); });
21
+ if (!isSupported) {
22
+ throw new Error("The currency \"".concat(currency, "\" is not supported, you have to use one of these currencies: ").concat(currencies));
25
23
  }
26
- return paymentMethod;
24
+ return currency;
27
25
  };
28
26
  export var getApplePayRequest = function (_a) {
29
27
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
30
- var order = _a.order, customer = _a.customer, supportedNetworks = _a.supportedNetworks, merchantCapabilities = _a.merchantCapabilities, countryCode = _a.countryCode, name = _a.name;
28
+ var transaction = _a.transaction, customer = _a.customer, supportedNetworks = _a.supportedNetworks, merchantCapabilities = _a.merchantCapabilities, countryCode = _a.countryCode, name = _a.name, acceptance = _a.acceptance;
31
29
  return {
32
30
  countryCode: countryCode,
33
- currencyCode: order.currency,
31
+ currencyCode: transaction.currency,
34
32
  merchantCapabilities: merchantCapabilities,
35
33
  supportedNetworks: supportedNetworks,
36
34
  billingContact: customer && {
@@ -40,26 +38,39 @@ export var getApplePayRequest = function (_a) {
40
38
  familyName: ((_j = customer.name) === null || _j === void 0 ? void 0 : _j.length) ? (_k = customer.name[0]) === null || _k === void 0 ? void 0 : _k.last : ''
41
39
  },
42
40
  total: {
43
- amount: Number(Number(order.amount).toFixed(2)),
41
+ amount: Number(transaction.amount),
44
42
  label: name
45
- }
43
+ },
44
+ supportsCouponCode: acceptance.supportsCouponCode,
45
+ couponCode: transaction.couponCode,
46
+ requiredShippingContactFields: customer === null || customer === void 0 ? void 0 : customer.requiredShippingContactFields,
47
+ shippingMethods: transaction.shipping
46
48
  };
47
49
  };
48
- export var prepareApplePayRequest = function (_a) {
49
- var payment_options = _a.payment_options, merchant = _a.merchant, order = _a.order, customer = _a.customer, acceptance = _a.acceptance;
50
- var paymentMethod = getApplePayPaymentMethod(payment_options.payment_methods || []);
51
- var supportedNetworks = validateSupportedNetworks(paymentMethod.supported_card_brands, acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedSchemes);
52
- var request = getApplePayRequest({
53
- countryCode: merchant.country_code,
54
- order: order,
55
- customer: customer,
56
- supportedNetworks: supportedNetworks,
57
- merchantCapabilities: getMerchantCapabilities(acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedFundSource),
58
- name: merchant.name
50
+ export var getApplePayPaymentMethod = function (paymentMethods) {
51
+ var paymentMethod = paymentMethods.find(function (_a) {
52
+ var name = _a.name, payment_type = _a.payment_type;
53
+ return [name, payment_type].some(function (item) { return item.toLowerCase() === 'apple_pay'; });
59
54
  });
60
- return request;
55
+ if (!paymentMethod) {
56
+ throw new Error('Apple Pay is not configured in your payment options');
57
+ }
58
+ return paymentMethod;
61
59
  };
62
- export var shallRenderApplePay = function () {
63
- var https = window.location.protocol === 'https:';
64
- return https;
60
+ export var rsaSetup = function (key) {
61
+ var rsa = new JSEncrypt();
62
+ rsa.setPublicKey(key);
63
+ return function (string) {
64
+ if (typeof string !== 'string')
65
+ throw new Error('string should be from type string');
66
+ var encrypted = rsa.encrypt(string);
67
+ if (!encrypted)
68
+ throw new Error('encryption data reached max allowed length');
69
+ return encrypted;
70
+ };
65
71
  };
72
+ export function generateApplicationHeader(obj) {
73
+ return Object.keys(obj)
74
+ .map(function (key) { return "".concat(key, "=").concat(obj[key]); })
75
+ .join('|');
76
+ }
@@ -1,2 +1,32 @@
1
- import { MerchantCapabilities } from '../@types/enums';
2
- export declare const getMerchantCapabilities: (supportedCards?: Array<string>) => MerchantCapabilities[];
1
+ import { ApplePayButtonProps } from '../@types';
2
+ export declare const getDefaultValues: (mainObject: ApplePayButtonProps) => {
3
+ interface: {
4
+ locale?: "en" | "ar" | "fr" | undefined;
5
+ theme?: "dark" | "light" | undefined;
6
+ edges?: "straight" | "curved" | undefined;
7
+ type?: "book" | "buy" | "check-out" | "pay" | "plain" | "subscribe" | undefined;
8
+ };
9
+ scope?: "AppleToken" | "TapToken" | undefined;
10
+ publicKey: string;
11
+ environment: "production" | "sandbox" | "beta" | "development" | "staging";
12
+ merchant: {
13
+ id: string;
14
+ domain: string;
15
+ identifier?: string | undefined;
16
+ };
17
+ customer?: import("../@types").Customer | undefined;
18
+ acceptance: import("../@types").Acceptance;
19
+ transaction: import("../@types").Transaction;
20
+ onCancel?: (() => void) | undefined;
21
+ onError?: ((error: any) => void) | undefined;
22
+ onSuccess?: ((data: Record<string, any>) => Promise<void>) | undefined;
23
+ onClick?: (() => void) | undefined;
24
+ onReady?: (() => void) | undefined;
25
+ onMerchantValidation?: ((status: "initiated" | "completed" | "error") => void) | undefined;
26
+ onShippingContactSelected?: ((shippingContact: import("../@types").ApplePayPaymentContact) => void | Promise<import("../@types").ApplePayUpdateData>) | undefined;
27
+ onPaymentMethodSelected?: ((paymentMethod: import("../@types").ApplePayPaymentMethod) => void | Promise<import("../@types").ApplePayUpdateData>) | undefined;
28
+ onCouponChanged?: ((couponCode: string) => void | Promise<import("../@types").ApplePayUpdateData>) | undefined;
29
+ metaData?: import("../@types").MetaData | undefined;
30
+ debug?: boolean | undefined;
31
+ };
32
+ export declare const getMerchantCapaplities: (supportedCards?: Array<string>) => ("supports3DS" | "supportsCredit" | "supportsDebit")[];
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
13
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
14
  if (ar || !(i in from)) {
@@ -7,21 +18,31 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7
18
  }
8
19
  return to.concat(ar || Array.prototype.slice.call(from));
9
20
  };
10
- import { MerchantCapabilities } from '../@types/enums';
11
- export var getMerchantCapabilities = function (supportedCards) {
12
- var merchantCapabilities = [MerchantCapabilities.Supports3DS];
21
+ import { ThemeMode, Locale, ButtonType, Edges, MerchantCapabilities } from '../constants';
22
+ export var getDefaultValues = function (mainObject) {
23
+ var userThemeMode = window.matchMedia('(prefers-color-scheme: light)').matches ? ThemeMode.LIGHT : ThemeMode.DARK;
24
+ var userLang = navigator.language.toLowerCase().includes(Locale.AR) ? Locale.AR : Locale.EN;
25
+ var defaultInterface = {
26
+ locale: userLang,
27
+ theme: userThemeMode,
28
+ type: ButtonType.PLAIN,
29
+ edges: Edges.CURVED
30
+ };
31
+ return __assign(__assign({}, mainObject), { interface: __assign(__assign({}, defaultInterface), mainObject.interface) });
32
+ };
33
+ export var getMerchantCapaplities = function (supportedCards) {
34
+ var merchantCapaplities = [MerchantCapabilities.Supports3DS];
13
35
  if (!supportedCards) {
14
- merchantCapabilities = __spreadArray(__spreadArray([], merchantCapabilities, true), [
36
+ merchantCapaplities = __spreadArray(__spreadArray([], merchantCapaplities, true), [
15
37
  MerchantCapabilities.SupportsCredit,
16
38
  MerchantCapabilities.SupportsDebit
17
39
  ], false);
18
- return merchantCapabilities;
19
40
  }
20
- if (supportedCards.includes('CREDIT')) {
21
- merchantCapabilities.push(MerchantCapabilities.SupportsCredit);
41
+ else if (supportedCards.includes('CREDIT')) {
42
+ merchantCapaplities.push(MerchantCapabilities.SupportsCredit);
22
43
  }
23
- if (supportedCards.includes('DEBIT')) {
24
- merchantCapabilities.push(MerchantCapabilities.SupportsDebit);
44
+ else if (supportedCards.includes('DEBIT')) {
45
+ merchantCapaplities.push(MerchantCapabilities.SupportsDebit);
25
46
  }
26
- return merchantCapabilities;
47
+ return merchantCapaplities;
27
48
  };
@@ -1,4 +1 @@
1
1
  export * from './html';
2
- export * from './theme';
3
- export * from './config';
4
- export * from './defaultValues';
@@ -1,4 +1 @@
1
1
  export * from './html';
2
- export * from './theme';
3
- export * from './config';
4
- export * from './defaultValues';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "0.0.68-development",
3
+ "version": "1.0.0-test",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",
@@ -10,17 +10,17 @@
10
10
  "README.md"
11
11
  ],
12
12
  "scripts": {
13
- "start": "cross-env NODE_ENV=development webpack serve",
14
13
  "prepare": "npx husky install",
15
14
  "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
15
  "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
16
  "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
17
  "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
18
+ "start": "cross-env NODE_ENV=development webpack serve",
19
19
  "build": "cross-env NODE_ENV=production webpack",
20
- "copy:files": "copyfiles -u 1 src/**/*.gif build/ && copyfiles -u 1 src/**/*.css build/",
20
+ "copy:files": "copyfiles -u 1 src/**/*.css build/",
21
21
  "tsc:alias": "tsc-alias -p tsconfig.json",
22
22
  "ts:build": "rm -rf build && tsc && yarn tsc:alias && yarn copy:files",
23
- "push": "npm publish --access public --tag development"
23
+ "push": "npm publish --access public --tag test"
24
24
  },
25
25
  "keywords": [],
26
26
  "author": {
@@ -28,23 +28,11 @@
28
28
  "email": "a.elsharkawy@tap.company"
29
29
  },
30
30
  "license": "ISC",
31
- "dependencies": {
32
- "@tap-payments/acceptance-sdk": "^0.0.11",
33
- "@tap-payments/browser-info": "^1.0.2",
34
- "@tap-payments/web-error-handing": "^1.0.1",
35
- "axios": "^1.2.2",
36
- "framer-motion": "^10.16.5",
37
- "jsencrypt": "^3.3.2",
38
- "lottie-react": "^2.4.0",
39
- "react": "^18.2.0",
40
- "react-dom": "^18.2.0"
41
- },
42
31
  "devDependencies": {
43
32
  "@babel/core": "^7.18.6",
44
33
  "@babel/preset-env": "^7.18.6",
45
34
  "@babel/preset-react": "^7.18.6",
46
35
  "@babel/preset-typescript": "^7.18.6",
47
- "@types/applepayjs": "^14.0.3",
48
36
  "@types/crypto-js": "^4.1.1",
49
37
  "@types/react": "^18.0.15",
50
38
  "@types/react-dom": "^18.0.6",
@@ -83,6 +71,13 @@
83
71
  "webpack-dev-server": "^4.9.3",
84
72
  "webpack-merge": "^5.8.0"
85
73
  },
74
+ "dependencies": {
75
+ "@tap-payments/browser-info": "^1.0.2",
76
+ "axios": "^1.2.2",
77
+ "jsencrypt": "^3.3.2",
78
+ "react": ">=17.0.2",
79
+ "react-dom": ">=17.0.2"
80
+ },
86
81
  "peerDependencies": {
87
82
  "react": ">=17.0.2",
88
83
  "react-dom": ">=17.0.2"
@@ -1,128 +0,0 @@
1
- import { CheckoutProfileResponse } from './checkoutProfile';
2
- import { Locale, ThemeMode, Edges, Scope, MerchantCapabilities, SupportedNetworks, ButtonType, ColorStyle } from './enums';
3
- export interface ApplePayRequestData {
4
- countryCode: string;
5
- currencyCode: string;
6
- merchantCapabilities: Array<MerchantCapabilities>;
7
- supportedNetworks: Array<SupportedNetworks>;
8
- billingContact?: {
9
- phoneNumber?: string;
10
- emailAddress?: string;
11
- givenName: string;
12
- familyName: string;
13
- };
14
- total: {
15
- label: string;
16
- amount: number;
17
- };
18
- }
19
- export interface ApplePayDataToLunchSDKFromMerchantSide {
20
- headers: Record<string, any>;
21
- BASE_URL: string;
22
- merchant: Record<string, string>;
23
- applePayRequestData: ApplePayRequestData;
24
- debug?: boolean;
25
- applePaySDKVersion?: number;
26
- }
27
- export interface Interface {
28
- locale?: Locale;
29
- theme?: ThemeMode;
30
- edges?: Edges;
31
- type?: ButtonType;
32
- colorStyle?: ColorStyle;
33
- loader?: boolean;
34
- }
35
- export interface Customer {
36
- id?: string;
37
- name?: {
38
- lang: Locale;
39
- first: string;
40
- last: string;
41
- middle?: string;
42
- }[];
43
- contact?: {
44
- email?: string;
45
- phone?: {
46
- countryCode: string;
47
- number: string;
48
- };
49
- };
50
- }
51
- export interface Acceptance {
52
- supportedSchemes?: Array<SupportedNetworks>;
53
- supportedFundSource?: string[];
54
- supportedPaymentAuthentications?: string[];
55
- }
56
- export interface ApplePayButtonProps {
57
- operator: {
58
- publicKey: string;
59
- hashstring?: string;
60
- };
61
- merchant: {
62
- id: string;
63
- };
64
- scope: Scope;
65
- interface?: Interface;
66
- customer?: Customer;
67
- acceptance?: Acceptance;
68
- transaction?: {
69
- authentication?: boolean;
70
- authorize?: {
71
- auto: {
72
- type: string;
73
- time: number;
74
- };
75
- };
76
- metadata?: Record<string, string>;
77
- reference?: string;
78
- paymentAgreement?: {
79
- id: string;
80
- contract?: {
81
- id: string;
82
- };
83
- };
84
- destinations?: Record<string, any>;
85
- };
86
- invoice?: {
87
- id: string;
88
- };
89
- order: {
90
- amount: number;
91
- currency: string;
92
- id?: string;
93
- description?: string;
94
- metadata?: Record<string, string>;
95
- reference?: string;
96
- };
97
- post?: {
98
- url: string;
99
- };
100
- redirect?: {
101
- url: string;
102
- };
103
- onOrderCreated?: (orderId: string) => void;
104
- onCancel?: () => void;
105
- onError?: (error: any) => void;
106
- onSuccess?: (data: Record<string, any>) => void;
107
- onClick?: (data?: ApplePayDataToLunchSDKFromMerchantSide) => void;
108
- onReady?: () => void;
109
- metaData?: MetaData;
110
- debug?: boolean;
111
- integration?: 'sdk' | 'iframe';
112
- headers?: {
113
- mdn: string;
114
- application: string;
115
- };
116
- }
117
- export interface MerchantResponse {
118
- id: string;
119
- name: string;
120
- country_code: string;
121
- session_token: string;
122
- [other: string]: string;
123
- }
124
- export interface MetaData {
125
- merchant: MerchantResponse;
126
- payment_options: CheckoutProfileResponse['payment_options'];
127
- headers: Record<string, string>;
128
- }
@@ -1,57 +0,0 @@
1
- export interface ChargeRequestBody {
2
- source: {
3
- id: string;
4
- };
5
- ipaddress?: string;
6
- amount: number;
7
- currency: string;
8
- selected_amount?: number;
9
- selected_currency?: string;
10
- product: string;
11
- threeDSecure?: boolean;
12
- save_card: boolean;
13
- fee: number;
14
- customer: {
15
- id?: string;
16
- first_name?: string;
17
- middle_name?: string;
18
- last_name?: string;
19
- email?: string;
20
- phone?: {
21
- country_code: string;
22
- number: string;
23
- };
24
- };
25
- hashstring?: string;
26
- metadata?: Record<string, string>;
27
- post?: {
28
- url: string;
29
- };
30
- redirect?: {
31
- url: string;
32
- };
33
- merchant?: {
34
- id: string;
35
- };
36
- order?: {
37
- id: string;
38
- };
39
- payment_agreement?: {
40
- id: string;
41
- contract?: {
42
- id: string;
43
- };
44
- };
45
- destinations?: Record<string, any>;
46
- reference?: {
47
- order?: string;
48
- transaction?: string;
49
- };
50
- description?: string;
51
- }
52
- export interface AuthorizeRequestBody extends ChargeRequestBody {
53
- auto?: {
54
- type: string;
55
- time: number;
56
- };
57
- }
@@ -1 +0,0 @@
1
- export {};