@cloudcommerce/types 0.0.35

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.
@@ -0,0 +1,266 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ /**
9
+ * Triggered when listing payments, must return available methods
10
+ */
11
+ export interface ListPaymentsResponse {
12
+ /**
13
+ * Optional default installments option
14
+ */
15
+ installments_option?: {
16
+ /**
17
+ * Minimum installment value
18
+ */
19
+ min_installment?: number;
20
+ /**
21
+ * Maximum number of installments
22
+ */
23
+ max_number: number;
24
+ /**
25
+ * Monthly tax applied, 0 means interest free
26
+ */
27
+ monthly_interest?: number;
28
+ };
29
+ /**
30
+ * Optional default discount option by payment method
31
+ */
32
+ discount_option?: {
33
+ /**
34
+ * Minimum amount to apply the discount
35
+ */
36
+ min_amount?: number;
37
+ /**
38
+ * Name of payment method that handle the discount
39
+ */
40
+ label?: string;
41
+ /**
42
+ * In which value the discount will be applied at checkout
43
+ */
44
+ apply_at?: 'total' | 'subtotal';
45
+ /**
46
+ * Discount type
47
+ */
48
+ type?: 'percentage' | 'fixed';
49
+ /**
50
+ * Discount value, percentage or fixed
51
+ */
52
+ value?: number;
53
+ };
54
+ /**
55
+ * Available loyalty point programs, program ID as property
56
+ */
57
+ loyalty_points_programs?: {
58
+ /**
59
+ * Available loyalty points program object
60
+ *
61
+ * This interface was referenced by `undefined`'s JSON-Schema definition
62
+ * via the `patternProperty` "^[a-z0-9_]{2,30}$".
63
+ */
64
+ [k: string]: {
65
+ /**
66
+ * The name of the loyalty points program
67
+ */
68
+ name?: string;
69
+ /**
70
+ * The ratio of a point when converted to currency
71
+ */
72
+ ratio: number;
73
+ /**
74
+ * Maximum number of points to apply
75
+ */
76
+ max_points?: number;
77
+ /**
78
+ * Minimum cart subtotal to earn new points
79
+ */
80
+ min_subtotal_to_earn?: number;
81
+ /**
82
+ * Subtotal percentage that will be converted into new points on purchase
83
+ */
84
+ earn_percentage?: number;
85
+ };
86
+ };
87
+ /**
88
+ * Payment gateway options list
89
+ *
90
+ * @maxItems 30
91
+ */
92
+ payment_gateways: {
93
+ /**
94
+ * Name of payment method shown to customers
95
+ */
96
+ label: string;
97
+ /**
98
+ * Auxiliary text about the payment method, can contain HTML tags
99
+ */
100
+ text?: string;
101
+ /**
102
+ * Payment icon image URI
103
+ */
104
+ icon?: string;
105
+ /**
106
+ * Payment intermediator
107
+ */
108
+ intermediator?: {
109
+ /**
110
+ * Name of payment intermediator
111
+ */
112
+ name?: string;
113
+ /**
114
+ * URI to intermediator website
115
+ */
116
+ link?: string;
117
+ /**
118
+ * Gateway name standardized as identification code
119
+ */
120
+ code: string;
121
+ };
122
+ /**
123
+ * Base URI to payments
124
+ */
125
+ payment_url?: string;
126
+ /**
127
+ * Transaction type
128
+ */
129
+ type?: 'payment' | 'recurrence';
130
+ /**
131
+ * Payment method object
132
+ */
133
+ payment_method: {
134
+ /**
135
+ * Standardized payment method code
136
+ */
137
+ code:
138
+ | 'credit_card'
139
+ | 'banking_billet'
140
+ | 'online_debit'
141
+ | 'account_deposit'
142
+ | 'debit_card'
143
+ | 'balance_on_intermediary'
144
+ | 'loyalty_points'
145
+ | 'other';
146
+ /**
147
+ * Short description for payment method
148
+ */
149
+ name?: string;
150
+ };
151
+ /**
152
+ * Discount to be applied by payment method
153
+ */
154
+ discount?: {
155
+ /**
156
+ * In which value the discount will be applied at checkout
157
+ */
158
+ apply_at?: 'total' | 'subtotal' | 'freight';
159
+ /**
160
+ * Discount type
161
+ */
162
+ type?: 'percentage' | 'fixed';
163
+ /**
164
+ * Discount value, percentage or fixed
165
+ */
166
+ value?: number;
167
+ };
168
+ /**
169
+ * List of accepted card brands
170
+ *
171
+ * @maxItems 30
172
+ */
173
+ card_companies?: string[];
174
+ /**
175
+ * List of options for installment
176
+ *
177
+ * @maxItems 30
178
+ */
179
+ installment_options?: {
180
+ /**
181
+ * Number of installments
182
+ */
183
+ number: number;
184
+ /**
185
+ * Installment value
186
+ */
187
+ value: number;
188
+ /**
189
+ * Tax applied
190
+ */
191
+ tax?: boolean;
192
+ }[];
193
+ /**
194
+ * Gateway web JS SDK, usually to handle credit cards with encryption
195
+ */
196
+ js_client?: {
197
+ /**
198
+ * Script (JS) link
199
+ */
200
+ script_uri: string;
201
+ /**
202
+ * Optional script link to try if the first URI goes offline
203
+ */
204
+ fallback_script_uri?: string;
205
+ /**
206
+ * JS expression to run (with `eval`) after script load
207
+ */
208
+ onload_expression?: string;
209
+ /**
210
+ * Append HTML to render payment iframe/components on checkout
211
+ */
212
+ container_html?: string;
213
+ /**
214
+ * Checkout promise variable (on `window`) resolved with transaction-like object
215
+ */
216
+ transaction_promise?: string;
217
+ /**
218
+ * Function to call for credit card hash generation, must return hash string
219
+ */
220
+ cc_hash?: {
221
+ /**
222
+ * Func name, receives obj with `name`, `doc`, `number`, `cvc`, `month`, `year`
223
+ */
224
+ function: string;
225
+ /**
226
+ * If it is a Promise, use for async process
227
+ */
228
+ is_promise?: boolean;
229
+ };
230
+ /**
231
+ * Optional function to get `installment_options` array from card number
232
+ */
233
+ cc_installments?: {
234
+ /**
235
+ * Func name, receives obj with `number` and `amount` (total)
236
+ */
237
+ function: string;
238
+ /**
239
+ * If it is a Promise, use for async process
240
+ */
241
+ is_promise?: boolean;
242
+ };
243
+ /**
244
+ * Optional function to call for card validation, returns brand name or false
245
+ */
246
+ cc_brand?: {
247
+ /**
248
+ * Func name, receives obj with `number`
249
+ */
250
+ function: string;
251
+ /**
252
+ * If it is a Promise, use for async process
253
+ */
254
+ is_promise?: boolean;
255
+ };
256
+ };
257
+ /**
258
+ * Resend list payments request if this payment gateway is selected
259
+ */
260
+ fetch_when_selected?: boolean;
261
+ }[];
262
+ /**
263
+ * [DEPRECATED] => use `installments_option` instead
264
+ */
265
+ interest_free_installments?: number;
266
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@cloudcommerce/types",
3
+ "type": "module",
4
+ "version": "0.0.35",
5
+ "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
+ "main": "index.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ecomplus/cloud-commerce.git",
10
+ "directory": "packages/types"
11
+ },
12
+ "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
13
+ "license": "Apache 2.0 with Commons Clause",
14
+ "bugs": {
15
+ "url": "https://github.com/ecomplus/cloud-commerce/issues"
16
+ },
17
+ "homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/types#readme",
18
+ "dependencies": {
19
+ "@cloudcommerce/api": "0.0.35"
20
+ }
21
+ }