@tonder.io/ionic-lite-sdk 0.0.35-beta.8 → 0.0.36-beta.1

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 (87) hide show
  1. package/.gitlab-ci.yml +28 -28
  2. package/README.md +221 -202
  3. package/dist/classes/errorResponse.d.ts +1 -1
  4. package/dist/classes/liteCheckout.d.ts +32 -56
  5. package/dist/data/api.d.ts +1 -1
  6. package/dist/helpers/utils.d.ts +4 -8
  7. package/dist/index.d.ts +1 -2
  8. package/dist/index.js +1 -1
  9. package/dist/types/commons.d.ts +0 -37
  10. package/dist/types/requests.d.ts +3 -12
  11. package/dist/types/responses.d.ts +3 -0
  12. package/jest.config.ts +14 -14
  13. package/package.json +38 -38
  14. package/rollup.config.js +16 -16
  15. package/src/classes/3dsHandler.ts +237 -237
  16. package/src/classes/errorResponse.ts +16 -16
  17. package/src/classes/liteCheckout.ts +575 -598
  18. package/src/data/api.ts +20 -20
  19. package/src/helpers/constants.ts +63 -63
  20. package/src/helpers/mercadopago.ts +15 -15
  21. package/src/helpers/utils.ts +320 -120
  22. package/src/index.ts +4 -10
  23. package/src/types/commons.ts +83 -125
  24. package/src/types/requests.ts +105 -114
  25. package/src/types/responses.ts +193 -189
  26. package/src/types/skyflow.ts +17 -17
  27. package/tests/classes/liteCheckout.test.ts +57 -57
  28. package/tests/methods/createOrder.test.ts +142 -142
  29. package/tests/methods/createPayment.test.ts +122 -122
  30. package/tests/methods/customerRegister.test.ts +119 -119
  31. package/tests/methods/getBusiness.test.ts +115 -115
  32. package/tests/methods/getCustomerCards.test.ts +119 -113
  33. package/tests/methods/getOpenpayDeviceSessionID.test.ts +95 -0
  34. package/tests/methods/getSkyflowToken.test.ts +155 -0
  35. package/tests/methods/getVaultToken.test.ts +107 -0
  36. package/tests/methods/registerCustomerCard.test.ts +117 -117
  37. package/tests/methods/startCheckoutRouter.test.ts +119 -119
  38. package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
  39. package/tests/utils/defaultMock.ts +20 -21
  40. package/tests/utils/mockClasses.ts +656 -659
  41. package/tsconfig.json +18 -18
  42. package/.idea/aws.xml +0 -17
  43. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  44. package/.idea/prettier.xml +0 -6
  45. package/.idea/vcs.xml +0 -6
  46. package/.idea/workspace.xml +0 -133
  47. package/dist/classes/BaseInlineCheckout.d.ts +0 -45
  48. package/dist/data/businessApi.d.ts +0 -2
  49. package/dist/data/cardApi.d.ts +0 -4
  50. package/dist/data/checkoutApi.d.ts +0 -4
  51. package/dist/data/customerApi.d.ts +0 -2
  52. package/dist/data/openPayApi.d.ts +0 -1
  53. package/dist/data/paymentMethodApi.d.ts +0 -5
  54. package/dist/data/skyflowApi.d.ts +0 -1
  55. package/dist/helpers/skyflow.d.ts +0 -3
  56. package/dist/helpers/validations.d.ts +0 -6
  57. package/dist/shared/catalog/paymentMethodsCatalog.d.ts +0 -1
  58. package/dist/shared/constants/messages.d.ts +0 -11
  59. package/dist/shared/constants/paymentMethodAPM.d.ts +0 -62
  60. package/dist/shared/constants/tonderUrl.d.ts +0 -7
  61. package/dist/types/card.d.ts +0 -29
  62. package/dist/types/checkout.d.ts +0 -103
  63. package/dist/types/customer.d.ts +0 -12
  64. package/dist/types/paymentMethod.d.ts +0 -22
  65. package/dist/types/transaction.d.ts +0 -101
  66. package/src/classes/BaseInlineCheckout.ts +0 -356
  67. package/src/data/businessApi.ts +0 -18
  68. package/src/data/cardApi.ts +0 -89
  69. package/src/data/checkoutApi.ts +0 -87
  70. package/src/data/customerApi.ts +0 -31
  71. package/src/data/openPayApi.ts +0 -12
  72. package/src/data/paymentMethodApi.ts +0 -37
  73. package/src/data/skyflowApi.ts +0 -20
  74. package/src/helpers/skyflow.ts +0 -91
  75. package/src/helpers/validations.ts +0 -55
  76. package/src/shared/catalog/paymentMethodsCatalog.ts +0 -248
  77. package/src/shared/constants/messages.ts +0 -11
  78. package/src/shared/constants/paymentMethodAPM.ts +0 -63
  79. package/src/shared/constants/tonderUrl.ts +0 -8
  80. package/src/types/card.ts +0 -34
  81. package/src/types/checkout.ts +0 -118
  82. package/src/types/customer.ts +0 -12
  83. package/src/types/index.d.ts +0 -10
  84. package/src/types/liteInlineCheckout.d.ts +0 -191
  85. package/src/types/paymentMethod.ts +0 -24
  86. package/src/types/transaction.ts +0 -101
  87. package/src/types/validations.d.ts +0 -11
@@ -1,125 +1,83 @@
1
- import {ICustomer} from "./customer";
2
-
3
- export type Business = {
4
- business: {
5
- pk: number;
6
- name: string;
7
- categories: {
8
- pk: number;
9
- name: string;
10
- }[];
11
- web: string;
12
- logo: string;
13
- full_logo_url: string;
14
- background_color: string;
15
- primary_color: string;
16
- checkout_mode: boolean;
17
- textCheckoutColor: string;
18
- textDetailsColor: string;
19
- checkout_logo: string;
20
- };
21
- openpay_keys: {
22
- merchant_id: string;
23
- public_key: string;
24
- };
25
- fintoc_keys: {
26
- public_key: string;
27
- };
28
- mercado_pago: {
29
- active: boolean;
30
- };
31
- vault_id: string;
32
- vault_url: string;
33
- reference: number;
34
- is_installments_available: boolean;
35
- };
36
-
37
- export type Customer = {
38
- firstName: string;
39
- lastName: string;
40
- country: string;
41
- street: string;
42
- city: string;
43
- state: string;
44
- postCode: string;
45
- email: string;
46
- phone: string;
47
- };
48
-
49
- export type OrderItem = {
50
- description: string;
51
- quantity: number;
52
- price_unit: number;
53
- discount: number;
54
- taxes: number;
55
- product_reference: number;
56
- name: string;
57
- amount_total: number;
58
- };
59
-
60
- export type PaymentData = {
61
- customer: Customer;
62
- currency: string;
63
- cart: {
64
- total: string | number;
65
- items: OrderItem[];
66
- };
67
- };
68
-
69
- export type TonderAPM = {
70
- pk: string;
71
- payment_method: string;
72
- priority: number;
73
- category: string;
74
- unavailable_countries: string[];
75
- status: string;
76
- }
77
-
78
- export type APM = {
79
- id: string;
80
- payment_method: string;
81
- priority: number;
82
- category: string;
83
- icon: string;
84
- label: string;
85
- }
86
-
87
-
88
- export interface IConfigureCheckout {
89
- customer: ICustomer;
90
- }
91
-
92
- export interface IInlineCheckoutBaseOptions {
93
- mode?: "production" | "sandbox" | "stage" | "development";
94
- /**
95
- * @deprecated This property is deprecated and will be removed in a future release.
96
- * `baseUrlTonder` is no longer required.
97
- */
98
- baseUrlTonder?: string;
99
- /**
100
- * @deprecated This property is deprecated and will be removed in a future release.
101
- * Use `apiKey` instead, as `apiKeyTonder` is no longer required.
102
- */
103
- apiKeyTonder?: string;
104
- /**
105
- * @deprecated This property is deprecated and will be removed in a future release.
106
- * `signal` is no longer required.
107
- */
108
- signal?: AbortSignal;
109
- apiKey: string;
110
- returnUrl: string;
111
- callBack?: (response: any) => void;
112
- }
113
- export interface IApiError {
114
- code: string;
115
- body: Record<string, string> | string;
116
- name: string;
117
- message: string;
118
- }
119
-
120
- export interface IPublicError {
121
- status: string;
122
- code: number;
123
- message: string;
124
- detail: Record<string, any> | string;
125
- }
1
+ export type Business = {
2
+ business: {
3
+ pk: number;
4
+ name: string;
5
+ categories: {
6
+ pk: number;
7
+ name: string;
8
+ }[];
9
+ web: string;
10
+ logo: string;
11
+ full_logo_url: string;
12
+ background_color: string;
13
+ primary_color: string;
14
+ checkout_mode: boolean;
15
+ textCheckoutColor: string;
16
+ textDetailsColor: string;
17
+ checkout_logo: string;
18
+ };
19
+ openpay_keys: {
20
+ merchant_id: string;
21
+ public_key: string;
22
+ };
23
+ fintoc_keys: {
24
+ public_key: string;
25
+ };
26
+ mercado_pago: {
27
+ active: boolean;
28
+ };
29
+ vault_id: string;
30
+ vault_url: string;
31
+ reference: number;
32
+ is_installments_available: boolean;
33
+ };
34
+
35
+ export type Customer = {
36
+ firstName: string;
37
+ lastName: string;
38
+ country: string;
39
+ street: string;
40
+ city: string;
41
+ state: string;
42
+ postCode: string;
43
+ email: string;
44
+ phone: string;
45
+ };
46
+
47
+ export type OrderItem = {
48
+ description: string;
49
+ quantity: number;
50
+ price_unit: number;
51
+ discount: number;
52
+ taxes: number;
53
+ product_reference: number;
54
+ name: string;
55
+ amount_total: number;
56
+ };
57
+
58
+ export type PaymentData = {
59
+ customer: Customer;
60
+ currency: string;
61
+ cart: {
62
+ total: string | number;
63
+ items: OrderItem[];
64
+ };
65
+ };
66
+
67
+ export type TonderAPM = {
68
+ pk: string;
69
+ payment_method: string;
70
+ priority: number;
71
+ category: string;
72
+ unavailable_countries: string[];
73
+ status: string;
74
+ }
75
+
76
+ export type APM = {
77
+ id: string;
78
+ payment_method: string;
79
+ priority: number;
80
+ category: string;
81
+ icon: string;
82
+ label: string;
83
+ }
@@ -1,115 +1,106 @@
1
- import { SkyflowRecord } from "./skyflow";
2
- import {IItem} from "./checkout";
3
-
4
- export interface CreateOrderRequest {
5
- business: string,
6
- client: string,
7
- billing_address_id?: number | null,
8
- shipping_address_id?: number | null,
9
- amount: number,
10
- status?: string,
11
- reference: string | number,
12
- is_oneclick: boolean,
13
- items: IItem[]
14
- }
15
-
16
- export type CreatePaymentRequest = {
17
- business_pk?: string | number,
18
- amount: number,
19
- date?: string,
20
- order_id?: string | number
21
- client_id?: string | number
22
- }
23
-
24
- export type StartCheckoutRequestBase = {
25
- name: any,
26
- last_name: string,
27
- email_client: any,
28
- phone_number: any,
29
- return_url?: string,
30
- id_product: string,
31
- quantity_product: number,
32
- id_ship: string,
33
- instance_id_ship: string,
34
- amount: any,
35
- title_ship: string,
36
- description: string,
37
- device_session_id: any,
38
- token_id: string,
39
- order_id: any,
40
- business_id: any,
41
- payment_id: any,
42
- source: string,
43
- browser_info?: any,
44
- metadata: any,
45
- currency: string,
46
- }
47
-
48
- export type StartCheckoutRequestWithCard = StartCheckoutRequestBase & {
49
- card: any,
50
- payment_method?: never,
51
- }
52
-
53
- export type StartCheckoutRequestWithPaymentMethod = StartCheckoutRequestBase & {
54
- card?: never,
55
- payment_method: string,
56
- }
57
-
58
- export type StartCheckoutRequest = StartCheckoutRequestWithCard | StartCheckoutRequestWithPaymentMethod;
59
-
60
- export type StartCheckoutIdRequest = {
61
- checkout_id: any
62
- }
63
-
64
- export interface VaultRequest extends SkyflowRecord {
65
- records: SkyflowRecord[],
66
- continueOnError?: boolean,
67
- byot?: "DISABLE" | "ENABLE" | "ENABLE_STRICT"
68
- }
69
-
70
- export type RegisterCustomerCardRequest = {
71
- skyflow_id: string;
72
- }
73
-
74
- export type TokensSkyflowRequest = {
75
- baseUrl: string;
76
- apiKey: string;
77
- vault_id: string,
78
- vault_url: string,
79
- data: {
80
- [key: string]: any;
81
- }
82
- }
83
- export type TokensRequest = {
84
- vault_id: string,
85
- vault_url: string,
86
- data: {
87
- [key: string]: any;
88
- }
89
- }
90
-
91
- export type StartCheckoutFullRequest = {
92
- order: {
93
- items: IItem[];
94
- };
95
- total: number;
96
- customer: {
97
- name: string;
98
- lastname: string;
99
- email: string;
100
- phone: string;
101
- };
102
- skyflowTokens: {
103
- cardholder_name: string;
104
- card_number: string;
105
- cvv: string;
106
- expiration_year: string;
107
- expiration_month: string;
108
- skyflow_id: string;
109
- };
110
- return_url: string;
111
- isSandbox: boolean;
112
- metadata: any;
113
- currency: string;
114
- payment_method?: string;
1
+ import { OrderItem } from "./commons";
2
+ import { SkyflowRecord } from "./skyflow";
3
+
4
+ export interface CreateOrderRequest {
5
+ business: string,
6
+ client: string,
7
+ billing_address_id?: number | null,
8
+ shipping_address_id?: number | null,
9
+ amount: number,
10
+ status?: string,
11
+ reference: string | number,
12
+ is_oneclick: boolean,
13
+ items: OrderItem[]
14
+ }
15
+
16
+ export type CreatePaymentRequest = {
17
+ business_pk?: string | number,
18
+ amount: number,
19
+ date?: string,
20
+ order_id?: string | number
21
+ client_id?: string | number
22
+ }
23
+
24
+ export type StartCheckoutRequestBase = {
25
+ name: any,
26
+ last_name: string,
27
+ email_client: any,
28
+ phone_number: any,
29
+ return_url?: string,
30
+ id_product: string,
31
+ quantity_product: number,
32
+ id_ship: string,
33
+ instance_id_ship: string,
34
+ amount: any,
35
+ title_ship: string,
36
+ description: string,
37
+ device_session_id: any,
38
+ token_id: string,
39
+ order_id: any,
40
+ business_id: any,
41
+ payment_id: any,
42
+ source: string,
43
+ browser_info?: any,
44
+ metadata: any,
45
+ currency: string,
46
+ }
47
+
48
+ export type StartCheckoutRequestWithCard = StartCheckoutRequestBase & {
49
+ card: any,
50
+ payment_method?: never,
51
+ }
52
+
53
+ export type StartCheckoutRequestWithPaymentMethod = StartCheckoutRequestBase & {
54
+ card?: never,
55
+ payment_method: string,
56
+ }
57
+
58
+ export type StartCheckoutRequest = StartCheckoutRequestWithCard | StartCheckoutRequestWithPaymentMethod;
59
+
60
+ export type StartCheckoutIdRequest = {
61
+ checkout_id: any
62
+ }
63
+
64
+ export interface VaultRequest extends SkyflowRecord {
65
+ records: SkyflowRecord[],
66
+ continueOnError?: boolean,
67
+ byot?: "DISABLE" | "ENABLE" | "ENABLE_STRICT"
68
+ }
69
+
70
+ export type RegisterCustomerCardRequest = {
71
+ skyflow_id: string;
72
+ }
73
+
74
+ export type TokensRequest = {
75
+ vault_id: string,
76
+ vault_url: string,
77
+ data: {
78
+ [key: string]: any;
79
+ }
80
+ }
81
+
82
+ export type StartCheckoutFullRequest = {
83
+ order: {
84
+ items: OrderItem[];
85
+ };
86
+ total: number;
87
+ customer: {
88
+ name: string;
89
+ lastname: string;
90
+ email: string;
91
+ phone: string;
92
+ };
93
+ skyflowTokens: {
94
+ cardholder_name: string;
95
+ card_number: string;
96
+ cvv: string;
97
+ expiration_year: string;
98
+ expiration_month: string;
99
+ skyflow_id: string;
100
+ };
101
+ return_url: string;
102
+ isSandbox: boolean;
103
+ metadata: any;
104
+ currency: string;
105
+ payment_method?: string;
115
106
  }