@astropay/payments-lib 2.0.8 → 2.0.9

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.
@@ -197,146 +197,81 @@ type APCore = {
197
197
  styles?: TDeepPartial<APComponentStyles>;
198
198
  tracking?: boolean;
199
199
  };
200
- type APFullCheckout = {
201
- amount: number;
202
- currency: string;
203
- country: string;
204
- paymentExternalId?: string;
205
- showTitle?: boolean;
206
- showDescription?: boolean;
207
- cardConfig?: {
208
- showPaymentSummary?: boolean | undefined;
209
- expirationDateFormat?: 'MM/YYYY' | 'MM/YY' | undefined;
210
- } | undefined;
211
- user?: {
212
- phoneNumber?: string;
213
- email?: string;
214
- firstName?: string;
215
- lastName?: string;
216
- documentNumber?: string;
217
- } | undefined;
218
- order?: {
219
- id?: string;
220
- items?: Array<{
221
- name: string;
222
- description?: string;
223
- units: number;
200
+ type TOrderProps = {
201
+ id?: string;
202
+ items?: Array<{
203
+ name: string;
204
+ description?: string;
205
+ units: number;
206
+ amount: {
207
+ currency: string;
208
+ value: number;
209
+ };
210
+ }>;
211
+ summary?: {
212
+ totalAmount: {
213
+ currency: string;
214
+ value: number;
215
+ };
216
+ shipping?: {
217
+ label: string;
224
218
  amount: {
225
219
  currency: string;
226
220
  value: number;
227
221
  };
228
- }>;
229
- summary?: {
230
- totalAmount: {
222
+ };
223
+ fees?: {
224
+ label: string;
225
+ amount: {
231
226
  currency: string;
232
227
  value: number;
233
228
  };
234
- shipping?: {
235
- label: string;
236
- amount: {
237
- currency: string;
238
- value: number;
239
- };
240
- };
241
- fees?: {
242
- label: string;
243
- amount: {
244
- currency: string;
245
- value: number;
246
- };
247
- };
248
229
  };
249
- } | undefined;
250
- onSuccess?: () => void;
251
- onError?: () => void;
230
+ };
231
+ };
232
+ type TUserProps = {
233
+ phoneNumber?: string;
234
+ email?: string;
235
+ firstName?: string;
236
+ lastName?: string;
237
+ documentNumber?: string;
252
238
  };
253
- type APPayment = {
239
+ type TNewPayment = {
254
240
  amount: number;
255
241
  currency: string;
256
242
  country: string;
257
- paymentExternalId?: string;
258
- user?: {
259
- phoneNumber?: string;
260
- email?: string;
261
- firstName?: string;
262
- lastName?: string;
263
- documentNumber?: string;
264
- } | undefined;
265
- order?: {
266
- id?: string;
267
- items?: Array<{
268
- name: string;
269
- description?: string;
270
- units: number;
271
- amount: {
272
- currency: string;
273
- value: number;
274
- };
275
- }>;
276
- summary?: {
277
- totalAmount: {
278
- currency: string;
279
- value: number;
280
- };
281
- shipping?: {
282
- label: string;
283
- amount: {
284
- currency: string;
285
- value: number;
286
- };
287
- };
288
- fees?: {
289
- label: string;
290
- amount: {
291
- currency: string;
292
- value: number;
293
- };
294
- };
295
- };
243
+ paymentExternalId?: never;
244
+ };
245
+ type TExistingPayment = {
246
+ paymentExternalId: string;
247
+ amount?: never;
248
+ currency?: never;
249
+ country?: never;
250
+ };
251
+ type TPaymentIdentity = TNewPayment | TExistingPayment;
252
+ type APFullCheckout = TPaymentIdentity & {
253
+ showTitle?: boolean;
254
+ showDescription?: boolean;
255
+ cardConfig?: {
256
+ showPaymentSummary?: boolean | undefined;
257
+ expirationDateFormat?: 'MM/YYYY' | 'MM/YY' | undefined;
296
258
  } | undefined;
259
+ user?: TUserProps | undefined;
260
+ order?: TOrderProps | undefined;
297
261
  onSuccess?: () => void;
298
262
  onError?: () => void;
299
263
  };
300
- type APCardPayment = {
301
- amount: number;
302
- currency: string;
303
- country: string;
304
- paymentExternalId?: string;
264
+ type APPayment = TPaymentIdentity & {
265
+ user?: TUserProps | undefined;
266
+ order?: TOrderProps | undefined;
267
+ onSuccess?: () => void;
268
+ onError?: () => void;
269
+ };
270
+ type APCardPayment = TPaymentIdentity & {
305
271
  showPaymentSummary?: boolean | undefined;
306
272
  expirationDateFormat?: 'MM/YYYY' | 'MM/YY' | undefined;
307
- order?: {
308
- id?: string;
309
- items?: Array<{
310
- name: string;
311
- description?: string;
312
- units: number;
313
- amount: {
314
- currency: string;
315
- value: number;
316
- };
317
- }>;
318
- summary?: {
319
- totalAmount: {
320
- currency: string;
321
- value: number;
322
- };
323
- shipping?: {
324
- label: string;
325
- amount: {
326
- currency: string;
327
- value: number;
328
- };
329
- };
330
- fees?: {
331
- label: string;
332
- amount: {
333
- currency: string;
334
- value: number;
335
- };
336
- };
337
- };
338
- } | undefined;
273
+ order?: TOrderProps | undefined;
339
274
  onSuccess?: () => void;
340
275
  onError?: () => void;
341
276
  };
342
- export type { APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APAvailableFontScale, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, };
277
+ export type { APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APAvailableFontScale, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, TNewPayment, };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.8",
2
+ "version": "2.0.9",
3
3
  "type": "module",
4
4
  "name": "@astropay/payments-lib",
5
5
  "description": "Official AstroPay payments library for web and mobile.",