@tonder.io/ionic-lite-sdk 0.0.42-beta.1 → 0.0.42-beta.3

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 (55) hide show
  1. package/.gitlab-ci.yml +28 -28
  2. package/README.md +532 -532
  3. package/dist/classes/BaseInlineCheckout.d.ts +1 -1
  4. package/dist/classes/liteCheckout.d.ts +1 -1
  5. package/dist/data/cardApi.d.ts +3 -3
  6. package/dist/index.js +1 -1
  7. package/dist/types/liteInlineCheckout.d.ts +1 -1
  8. package/jest.config.ts +14 -14
  9. package/package.json +41 -41
  10. package/rollup.config.js +16 -16
  11. package/src/classes/3dsHandler.ts +347 -347
  12. package/src/classes/BaseInlineCheckout.ts +424 -424
  13. package/src/classes/errorResponse.ts +16 -16
  14. package/src/classes/liteCheckout.ts +589 -591
  15. package/src/data/api.ts +20 -20
  16. package/src/data/businessApi.ts +18 -18
  17. package/src/data/cardApi.ts +91 -87
  18. package/src/data/checkoutApi.ts +84 -84
  19. package/src/data/customerApi.ts +31 -31
  20. package/src/data/openPayApi.ts +12 -12
  21. package/src/data/paymentMethodApi.ts +37 -37
  22. package/src/data/skyflowApi.ts +20 -20
  23. package/src/helpers/constants.ts +63 -63
  24. package/src/helpers/mercadopago.ts +15 -15
  25. package/src/helpers/skyflow.ts +91 -91
  26. package/src/helpers/utils.ts +120 -120
  27. package/src/helpers/validations.ts +55 -55
  28. package/src/index.ts +12 -12
  29. package/src/shared/catalog/paymentMethodsCatalog.ts +247 -247
  30. package/src/shared/constants/messages.ts +10 -10
  31. package/src/shared/constants/paymentMethodAPM.ts +63 -63
  32. package/src/shared/constants/tonderUrl.ts +8 -8
  33. package/src/types/card.ts +35 -35
  34. package/src/types/checkout.ts +123 -123
  35. package/src/types/commons.ts +143 -143
  36. package/src/types/customer.ts +22 -22
  37. package/src/types/liteInlineCheckout.ts +216 -216
  38. package/src/types/paymentMethod.ts +23 -23
  39. package/src/types/requests.ts +114 -114
  40. package/src/types/responses.ts +192 -192
  41. package/src/types/skyflow.ts +17 -17
  42. package/src/types/transaction.ts +101 -101
  43. package/src/types/validations.d.ts +11 -11
  44. package/tests/classes/liteCheckout.test.ts +57 -57
  45. package/tests/methods/createOrder.test.ts +141 -141
  46. package/tests/methods/createPayment.test.ts +121 -121
  47. package/tests/methods/customerRegister.test.ts +118 -118
  48. package/tests/methods/getBusiness.test.ts +114 -114
  49. package/tests/methods/getCustomerCards.test.ts +112 -112
  50. package/tests/methods/registerCustomerCard.test.ts +117 -117
  51. package/tests/methods/startCheckoutRouter.test.ts +119 -119
  52. package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
  53. package/tests/utils/defaultMock.ts +21 -21
  54. package/tests/utils/mockClasses.ts +659 -659
  55. package/tsconfig.json +18 -18
@@ -1,63 +1,63 @@
1
- const PAYMENT_METHOD_APM = Object.freeze({
2
- SORIANA: "SORIANA",
3
- OXXO: "OXXO",
4
- SPEI: "SPEI",
5
- CODI: "CODI",
6
- MERCADOPAGO: "MERCADOPAGO",
7
- PAYPAL: "PAYPAL",
8
- COMERCIALMEXICANA: "COMERCIALMEXICANA",
9
- BANCOMER: "BANCOMER",
10
- WALMART: "WALMART",
11
- BODEGA: "BODEGA",
12
- SAMSCLUB: "SAMSCLUB",
13
- SUPERAMA: "SUPERAMA",
14
- CALIMAX: "CALIMAX",
15
- EXTRA: "EXTRA",
16
- CIRCULOK: "CIRCULOK",
17
- SEVEN11: "7ELEVEN",
18
- TELECOMM: "TELECOMM",
19
- BANORTE: "BANORTE",
20
- BENAVIDES: "BENAVIDES",
21
- DELAHORRO: "DELAHORRO",
22
- ELASTURIANO: "ELASTURIANO",
23
- WALDOS: "WALDOS",
24
- ALSUPER: "ALSUPER",
25
- KIOSKO: "KIOSKO",
26
- STAMARIA: "STAMARIA",
27
- LAMASBARATA: "LAMASBARATA",
28
- FARMROMA: "FARMROMA",
29
- FARMUNION: "FARMUNION",
30
- FARMATODO: "FARMATODO",
31
- SFDEASIS: "SFDEASIS",
32
- FARM911: "FARM911",
33
- FARMECONOMICAS: "FARMECONOMICAS",
34
- FARMMEDICITY: "FARMMEDICITY",
35
- RIANXEIRA: "RIANXEIRA",
36
- WESTERNUNION: "WESTERNUNION",
37
- ZONAPAGO: "ZONAPAGO",
38
- CAJALOSANDES: "CAJALOSANDES",
39
- CAJAPAITA: "CAJAPAITA",
40
- CAJASANTA: "CAJASANTA",
41
- CAJASULLANA: "CAJASULLANA",
42
- CAJATRUJILLO: "CAJATRUJILLO",
43
- EDPYME: "EDPYME",
44
- KASNET: "KASNET",
45
- NORANDINO: "NORANDINO",
46
- QAPAQ: "QAPAQ",
47
- RAIZ: "RAIZ",
48
- PAYSER: "PAYSER",
49
- WUNION: "WUNION",
50
- BANCOCONTINENTAL: "BANCOCONTINENTAL",
51
- GMONEY: "GMONEY",
52
- GOPAY: "GOPAY",
53
- WU: "WU",
54
- PUNTOSHEY: "PUNTOSHEY",
55
- AMPM: "AMPM",
56
- JUMBOMARKET: "JUMBOMARKET",
57
- SMELPUEBLO: "SMELPUEBLO",
58
- BAM: "BAM",
59
- REFACIL: "REFACIL",
60
- ACYVALORES: "ACYVALORES",
61
- });
62
-
63
- export { PAYMENT_METHOD_APM };
1
+ const PAYMENT_METHOD_APM = Object.freeze({
2
+ SORIANA: "SORIANA",
3
+ OXXO: "OXXO",
4
+ SPEI: "SPEI",
5
+ CODI: "CODI",
6
+ MERCADOPAGO: "MERCADOPAGO",
7
+ PAYPAL: "PAYPAL",
8
+ COMERCIALMEXICANA: "COMERCIALMEXICANA",
9
+ BANCOMER: "BANCOMER",
10
+ WALMART: "WALMART",
11
+ BODEGA: "BODEGA",
12
+ SAMSCLUB: "SAMSCLUB",
13
+ SUPERAMA: "SUPERAMA",
14
+ CALIMAX: "CALIMAX",
15
+ EXTRA: "EXTRA",
16
+ CIRCULOK: "CIRCULOK",
17
+ SEVEN11: "7ELEVEN",
18
+ TELECOMM: "TELECOMM",
19
+ BANORTE: "BANORTE",
20
+ BENAVIDES: "BENAVIDES",
21
+ DELAHORRO: "DELAHORRO",
22
+ ELASTURIANO: "ELASTURIANO",
23
+ WALDOS: "WALDOS",
24
+ ALSUPER: "ALSUPER",
25
+ KIOSKO: "KIOSKO",
26
+ STAMARIA: "STAMARIA",
27
+ LAMASBARATA: "LAMASBARATA",
28
+ FARMROMA: "FARMROMA",
29
+ FARMUNION: "FARMUNION",
30
+ FARMATODO: "FARMATODO",
31
+ SFDEASIS: "SFDEASIS",
32
+ FARM911: "FARM911",
33
+ FARMECONOMICAS: "FARMECONOMICAS",
34
+ FARMMEDICITY: "FARMMEDICITY",
35
+ RIANXEIRA: "RIANXEIRA",
36
+ WESTERNUNION: "WESTERNUNION",
37
+ ZONAPAGO: "ZONAPAGO",
38
+ CAJALOSANDES: "CAJALOSANDES",
39
+ CAJAPAITA: "CAJAPAITA",
40
+ CAJASANTA: "CAJASANTA",
41
+ CAJASULLANA: "CAJASULLANA",
42
+ CAJATRUJILLO: "CAJATRUJILLO",
43
+ EDPYME: "EDPYME",
44
+ KASNET: "KASNET",
45
+ NORANDINO: "NORANDINO",
46
+ QAPAQ: "QAPAQ",
47
+ RAIZ: "RAIZ",
48
+ PAYSER: "PAYSER",
49
+ WUNION: "WUNION",
50
+ BANCOCONTINENTAL: "BANCOCONTINENTAL",
51
+ GMONEY: "GMONEY",
52
+ GOPAY: "GOPAY",
53
+ WU: "WU",
54
+ PUNTOSHEY: "PUNTOSHEY",
55
+ AMPM: "AMPM",
56
+ JUMBOMARKET: "JUMBOMARKET",
57
+ SMELPUEBLO: "SMELPUEBLO",
58
+ BAM: "BAM",
59
+ REFACIL: "REFACIL",
60
+ ACYVALORES: "ACYVALORES",
61
+ });
62
+
63
+ export { PAYMENT_METHOD_APM };
@@ -1,8 +1,8 @@
1
- const TONDER_URL_BY_MODE = Object.freeze({
2
- production: "https://app.tonder.io",
3
- sandbox: "https://sandbox.tonder.io",
4
- stage: "https://stage.tonder.io",
5
- development: "http://localhost:8000",
6
- });
7
-
8
- export { TONDER_URL_BY_MODE };
1
+ const TONDER_URL_BY_MODE = Object.freeze({
2
+ production: "https://app.tonder.io",
3
+ sandbox: "https://sandbox.tonder.io",
4
+ stage: "https://stage.tonder.io",
5
+ development: "http://localhost:8000",
6
+ });
7
+
8
+ export { TONDER_URL_BY_MODE };
package/src/types/card.ts CHANGED
@@ -1,35 +1,35 @@
1
- export interface ICard {
2
- fields: ICardSkyflowFields;
3
- icon?: string;
4
- }
5
-
6
- export interface ICardSkyflowFields {
7
- card_number: string;
8
- expiration_month: string;
9
- expiration_year: string;
10
- skyflow_id: string;
11
- card_scheme: string;
12
- cardholder_name: string;
13
- }
14
-
15
- export interface ICustomerCardsResponse {
16
- user_id: number;
17
- cards: ICard[];
18
- }
19
-
20
- export interface ISaveCardResponse {
21
- skyflow_id: string;
22
- user_id: number;
23
- }
24
-
25
- export interface ISaveCardSkyflowRequest {
26
- skyflow_id: string;
27
- }
28
-
29
- export interface ISaveCardRequest {
30
- card_number: string;
31
- cvv: string;
32
- expiration_month: string;
33
- expiration_year: string;
34
- cardholder_name: string;
35
- }
1
+ export interface ICard {
2
+ fields: ICardSkyflowFields;
3
+ icon?: string;
4
+ }
5
+
6
+ export interface ICardSkyflowFields {
7
+ card_number: string;
8
+ expiration_month: string;
9
+ expiration_year: string;
10
+ skyflow_id: string;
11
+ card_scheme: string;
12
+ cardholder_name: string;
13
+ }
14
+
15
+ export interface ICustomerCardsResponse {
16
+ user_id: number;
17
+ cards: ICard[];
18
+ }
19
+
20
+ export interface ISaveCardResponse {
21
+ skyflow_id: string;
22
+ user_id: number;
23
+ }
24
+
25
+ export interface ISaveCardSkyflowRequest {
26
+ skyflow_id: string;
27
+ }
28
+
29
+ export interface ISaveCardRequest {
30
+ card_number: string;
31
+ cvv: string;
32
+ expiration_month: string;
33
+ expiration_year: string;
34
+ cardholder_name: string;
35
+ }
@@ -1,124 +1,124 @@
1
- import {ICustomer} from "./customer";
2
-
3
- export interface IStartCheckoutRequestBase {
4
- name: any;
5
- last_name: string;
6
- email_client: any;
7
- phone_number: any;
8
- return_url?: string;
9
- id_product: string;
10
- quantity_product: number;
11
- id_ship: string;
12
- instance_id_ship: string;
13
- amount: any;
14
- title_ship: string;
15
- description: string;
16
- device_session_id: any;
17
- token_id: string;
18
- order_id: any;
19
- business_id: any;
20
- payment_id: any;
21
- source: string;
22
- browser_info?: any;
23
- metadata: any;
24
- currency: string;
25
- }
26
-
27
- export type IStartCheckoutRequestWithCard = IStartCheckoutRequestBase & {
28
- card: any;
29
- payment_method?: never;
30
- };
31
-
32
- export type IStartCheckoutRequestWithPaymentMethod =
33
- IStartCheckoutRequestBase & {
34
- card?: never;
35
- payment_method: string;
36
- };
37
-
38
- export type IStartCheckoutRequest =
39
- | IStartCheckoutRequestWithCard
40
- | IStartCheckoutRequestWithPaymentMethod;
41
-
42
- export interface IStartCheckoutIdRequest {
43
- checkout_id: string;
44
- }
45
-
46
- export interface IStartCheckoutErrorResponse {
47
- status: string;
48
- message: string;
49
- psp_response: [
50
- {
51
- status: number;
52
- response: Object;
53
- },
54
- ];
55
- checkout_id: string;
56
- is_route_finished: boolean;
57
- }
58
-
59
- export interface IStartCheckoutResponse {
60
- status: string;
61
- message: string;
62
- psp_response: Record<string, any>;
63
- checkout_id: string;
64
- is_route_finished: Boolean;
65
- transaction_status: string;
66
- transaction_id: number;
67
- payment_id: number;
68
- provider: string;
69
- next_action: {
70
- redirect_to_url?: {
71
- url: string;
72
- return_url: string;
73
- verify_transaction_status_url: string;
74
- };
75
- iframe_resources?: {
76
- iframe: string;
77
- };
78
- };
79
- actions: IStartCheckoutActionResponse[];
80
- }
81
-
82
- export interface IStartCheckoutActionResponse {
83
- name: string;
84
- url: string;
85
- method: string;
86
- }
87
-
88
-
89
- export interface IItem {
90
- description: string;
91
- quantity: number;
92
- price_unit: number;
93
- discount: number;
94
- taxes: number;
95
- product_reference: string | number;
96
- name: string;
97
- amount_total: number;
98
- }
99
-
100
- export interface IProcessPaymentRequest {
101
- customer: ICustomer;
102
- cart: {
103
- total: string | number;
104
- items: IItem[];
105
- };
106
- metadata?: Record<string, any>;
107
- currency?: string;
108
- payment_method?: string;
109
- card?: ICardFields | string;
110
- isSandbox?: boolean;
111
- /**
112
- * @deprecated This property is deprecated and will be removed in a future release.
113
- * Use the `returnUrl` field when creating the instance of LiteCheckout or InlineCheckout.
114
- */
115
- returnUrl?: string;
116
- }
117
-
118
- export interface ICardFields {
119
- card_number: string;
120
- cvv: string;
121
- expiration_month: string;
122
- expiration_year: string;
123
- cardholder_name: string;
1
+ import {ICustomer} from "./customer";
2
+
3
+ export interface IStartCheckoutRequestBase {
4
+ name: any;
5
+ last_name: string;
6
+ email_client: any;
7
+ phone_number: any;
8
+ return_url?: string;
9
+ id_product: string;
10
+ quantity_product: number;
11
+ id_ship: string;
12
+ instance_id_ship: string;
13
+ amount: any;
14
+ title_ship: string;
15
+ description: string;
16
+ device_session_id: any;
17
+ token_id: string;
18
+ order_id: any;
19
+ business_id: any;
20
+ payment_id: any;
21
+ source: string;
22
+ browser_info?: any;
23
+ metadata: any;
24
+ currency: string;
25
+ }
26
+
27
+ export type IStartCheckoutRequestWithCard = IStartCheckoutRequestBase & {
28
+ card: any;
29
+ payment_method?: never;
30
+ };
31
+
32
+ export type IStartCheckoutRequestWithPaymentMethod =
33
+ IStartCheckoutRequestBase & {
34
+ card?: never;
35
+ payment_method: string;
36
+ };
37
+
38
+ export type IStartCheckoutRequest =
39
+ | IStartCheckoutRequestWithCard
40
+ | IStartCheckoutRequestWithPaymentMethod;
41
+
42
+ export interface IStartCheckoutIdRequest {
43
+ checkout_id: string;
44
+ }
45
+
46
+ export interface IStartCheckoutErrorResponse {
47
+ status: string;
48
+ message: string;
49
+ psp_response: [
50
+ {
51
+ status: number;
52
+ response: Object;
53
+ },
54
+ ];
55
+ checkout_id: string;
56
+ is_route_finished: boolean;
57
+ }
58
+
59
+ export interface IStartCheckoutResponse {
60
+ status: string;
61
+ message: string;
62
+ psp_response: Record<string, any>;
63
+ checkout_id: string;
64
+ is_route_finished: Boolean;
65
+ transaction_status: string;
66
+ transaction_id: number;
67
+ payment_id: number;
68
+ provider: string;
69
+ next_action: {
70
+ redirect_to_url?: {
71
+ url: string;
72
+ return_url: string;
73
+ verify_transaction_status_url: string;
74
+ };
75
+ iframe_resources?: {
76
+ iframe: string;
77
+ };
78
+ };
79
+ actions: IStartCheckoutActionResponse[];
80
+ }
81
+
82
+ export interface IStartCheckoutActionResponse {
83
+ name: string;
84
+ url: string;
85
+ method: string;
86
+ }
87
+
88
+
89
+ export interface IItem {
90
+ description: string;
91
+ quantity: number;
92
+ price_unit: number;
93
+ discount: number;
94
+ taxes: number;
95
+ product_reference: string | number;
96
+ name: string;
97
+ amount_total: number;
98
+ }
99
+
100
+ export interface IProcessPaymentRequest {
101
+ customer: ICustomer;
102
+ cart: {
103
+ total: string | number;
104
+ items: IItem[];
105
+ };
106
+ metadata?: Record<string, any>;
107
+ currency?: string;
108
+ payment_method?: string;
109
+ card?: ICardFields | string;
110
+ isSandbox?: boolean;
111
+ /**
112
+ * @deprecated This property is deprecated and will be removed in a future release.
113
+ * Use the `returnUrl` field when creating the instance of LiteCheckout or InlineCheckout.
114
+ */
115
+ returnUrl?: string;
116
+ }
117
+
118
+ export interface ICardFields {
119
+ card_number: string;
120
+ cvv: string;
121
+ expiration_month: string;
122
+ expiration_year: string;
123
+ cardholder_name: string;
124
124
  }