@tonder.io/ionic-lite-sdk 0.0.35-beta.8 → 0.0.37-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 (83) hide show
  1. package/.gitlab-ci.yml +28 -28
  2. package/README.md +532 -202
  3. package/dist/classes/BaseInlineCheckout.d.ts +21 -19
  4. package/dist/classes/errorResponse.d.ts +1 -1
  5. package/dist/classes/liteCheckout.d.ts +15 -43
  6. package/dist/data/api.d.ts +1 -1
  7. package/dist/data/businessApi.d.ts +1 -1
  8. package/dist/data/cardApi.d.ts +1 -1
  9. package/dist/data/checkoutApi.d.ts +2 -1
  10. package/dist/data/customerApi.d.ts +1 -1
  11. package/dist/data/paymentMethodApi.d.ts +2 -2
  12. package/dist/helpers/skyflow.d.ts +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +1 -1
  15. package/dist/types/card.d.ts +1 -0
  16. package/dist/types/checkout.d.ts +7 -1
  17. package/dist/types/commons.d.ts +8 -3
  18. package/dist/types/customer.d.ts +10 -0
  19. package/{src → dist}/types/liteInlineCheckout.d.ts +33 -73
  20. package/dist/types/responses.d.ts +3 -0
  21. package/jest.config.ts +14 -14
  22. package/package.json +41 -38
  23. package/rollup.config.js +16 -16
  24. package/src/classes/3dsHandler.ts +237 -237
  25. package/src/classes/BaseInlineCheckout.ts +385 -356
  26. package/src/classes/errorResponse.ts +16 -16
  27. package/src/classes/liteCheckout.ts +588 -598
  28. package/src/data/api.ts +20 -20
  29. package/src/data/businessApi.ts +18 -18
  30. package/src/data/cardApi.ts +85 -89
  31. package/src/data/checkoutApi.ts +84 -87
  32. package/src/data/customerApi.ts +31 -31
  33. package/src/data/openPayApi.ts +12 -12
  34. package/src/data/paymentMethodApi.ts +37 -37
  35. package/src/data/skyflowApi.ts +20 -20
  36. package/src/helpers/constants.ts +63 -63
  37. package/src/helpers/mercadopago.ts +15 -15
  38. package/src/helpers/skyflow.ts +91 -91
  39. package/src/helpers/utils.ts +120 -120
  40. package/src/helpers/validations.ts +55 -55
  41. package/src/index.ts +12 -10
  42. package/src/shared/catalog/paymentMethodsCatalog.ts +247 -247
  43. package/src/shared/constants/messages.ts +10 -10
  44. package/src/shared/constants/paymentMethodAPM.ts +63 -63
  45. package/src/shared/constants/tonderUrl.ts +8 -8
  46. package/src/types/card.ts +35 -34
  47. package/src/types/checkout.ts +123 -117
  48. package/src/types/commons.ts +130 -125
  49. package/src/types/customer.ts +22 -12
  50. package/src/types/liteInlineCheckout.ts +216 -0
  51. package/src/types/paymentMethod.ts +23 -23
  52. package/src/types/requests.ts +114 -114
  53. package/src/types/responses.ts +193 -189
  54. package/src/types/skyflow.ts +17 -17
  55. package/src/types/transaction.ts +101 -101
  56. package/src/types/validations.d.ts +11 -11
  57. package/tests/classes/liteCheckout.test.ts +57 -57
  58. package/tests/methods/createOrder.test.ts +141 -142
  59. package/tests/methods/createPayment.test.ts +121 -122
  60. package/tests/methods/customerRegister.test.ts +118 -119
  61. package/tests/methods/getBusiness.test.ts +114 -115
  62. package/tests/methods/getCustomerCards.test.ts +112 -113
  63. package/tests/methods/registerCustomerCard.test.ts +117 -117
  64. package/tests/methods/startCheckoutRouter.test.ts +119 -119
  65. package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
  66. package/tests/utils/defaultMock.ts +21 -21
  67. package/tests/utils/mockClasses.ts +659 -659
  68. package/tsconfig.json +18 -18
  69. package/types/classes/liteCheckout.d.ts +29 -0
  70. package/types/classes/liteCheckout.js +225 -0
  71. package/types/classes/liteCheckout.js.map +1 -0
  72. package/types/helpers/utils.d.ts +3 -0
  73. package/types/helpers/utils.js +27 -0
  74. package/types/helpers/utils.js.map +1 -0
  75. package/types/index.d.ts +2 -0
  76. package/types/index.js +6 -0
  77. package/types/index.js.map +1 -0
  78. package/.idea/aws.xml +0 -17
  79. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  80. package/.idea/prettier.xml +0 -6
  81. package/.idea/vcs.xml +0 -6
  82. package/.idea/workspace.xml +0 -133
  83. package/src/types/index.d.ts +0 -10
@@ -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,34 +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
- }
13
-
14
- export interface ICustomerCardsResponse {
15
- user_id: number;
16
- cards: ICard[];
17
- }
18
-
19
- export interface ISaveCardResponse {
20
- skyflow_id: string;
21
- user_id: number;
22
- }
23
-
24
- export interface ISaveCardSkyflowRequest {
25
- skyflow_id: string;
26
- }
27
-
28
- export interface ISaveCardRequest {
29
- card_number: string;
30
- cvv: string;
31
- expiration_month: string;
32
- expiration_year: string;
33
- cardholder_name: string;
34
- }
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,118 +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
- }
111
-
112
- export interface ICardFields {
113
- card_number: string;
114
- cvv: string;
115
- expiration_month: string;
116
- expiration_year: string;
117
- 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;
118
124
  }