@stackonward/onex-checkout 0.2.0 → 0.3.0

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.
package/README.md CHANGED
@@ -29,12 +29,13 @@ if (choice) {
29
29
  }
30
30
  ```
31
31
 
32
- Use the application's authenticated `ApiClient` transport. Each explicit start, cancel, and payment-free completion takes an idempotency key. Reuse that key when retrying the same operation with the same input. Pass a request-scoped `AbortSignal` to stop local requests when a view unmounts. Only an explicit `cancel()` requests cancellation of an execution.
32
+ Use the application's authenticated `ApiClient` transport. Each currency revision, execution start, cancellation, and payment-free completion takes an idempotency key. Reuse that key when retrying the same operation with the same input. Pass a request-scoped `AbortSignal` to stop local requests when a view unmounts. Only an explicit `cancel()` requests cancellation of an execution.
33
33
 
34
34
  | Method | Buyer endpoint relative to the supplied base path |
35
35
  | ---------------------------------------------- | ------------------------------------------------- |
36
36
  | `session(no, signal?)` | GET `/:no/state` |
37
37
  | `methods(no, signal?)` | GET `/:no/payment-methods` |
38
+ | `revise(no, input, key, signal?)` | POST `/:no/revisions` |
38
39
  | `start(no, input, key, signal?)` | POST `/:no/executions` |
39
40
  | `execution(no, executionNo, signal?)` | GET `/:no/executions/:executionNo` |
40
41
  | `reconcile(no, executionNo, signal?)` | POST `/:no/executions/:executionNo/reconcile` |
@@ -47,6 +48,8 @@ Restore an active attempt with `execution()`. The optional presentation carries
47
48
 
48
49
  The built-in decoder supports `embedded/airwallex_dropin@2`. All three methods require an execution-bound payment intent and its short-lived secret. A standalone authorization also requires a zero amount, customer, and scheduled consent. Wallets require the merchant country. The product backend negotiates supported flows with OneX. An additional `PresentationDecoder` can be supplied in `presentations` when another embedded flow is negotiated. The decoder owns its payload validation. Unknown flow/version pairs fail with `CheckoutProtocolError`. Transport failures retain the application's original error.
49
50
 
51
+ When the state includes `pricing_input`, display its current currency and offer its `available_currencies`. Call `revise(no, { currency, expected_revision }, key, signal)` after the buyer selects another currency. Read state and rediscover payment methods before enabling payment for the new revision.
52
+
50
53
  A payment integration registers its own `PresentationDecoder` for one exact flow and version in `createCheckoutClient({ presentations })`. Calling `client.assertMethod(method, execution)` applies the shared binding check and the selected adapter’s checks using that registration. The built-in `airwallex_dropin@2` decoder, its three supported `airwallexMethods`, and `airwallexSession(execution)` live together. The product selects a renderer by flow, version and method, and passes localized labels and renewal terms. Each client captures its own list of adapters when created. A client can register several flows or versions and TypeScript derives the result from that list. The original seven-operation `CheckoutClient` interface remains available to consumers that implement their own transport facade.
51
54
 
52
55
  ## Integrating an embedded flow
package/dist/index.d.mts CHANGED
@@ -29,9 +29,9 @@ declare const purchaseOption: z.ZodObject<{
29
29
  billing_interval: number;
30
30
  }>>;
31
31
  }, "strip", z.ZodTypeAny, {
32
- item_name: string;
33
32
  amount: string;
34
33
  currency: string;
34
+ item_name: string;
35
35
  purchase_option_id?: number | undefined;
36
36
  complete_without_payment?: true | undefined;
37
37
  renewal_terms?: {
@@ -41,9 +41,9 @@ declare const purchaseOption: z.ZodObject<{
41
41
  billing_interval: number;
42
42
  } | undefined;
43
43
  }, {
44
- item_name: string;
45
44
  amount: string;
46
45
  currency: string;
46
+ item_name: string;
47
47
  purchase_option_id?: number | undefined;
48
48
  complete_without_payment?: true | undefined;
49
49
  renewal_terms?: {
@@ -59,6 +59,16 @@ declare const session: z.ZodObject<{
59
59
  revision: z.ZodNumber;
60
60
  expires_at: z.ZodString;
61
61
  active_execution_no: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
62
+ pricing_input: z.ZodOptional<z.ZodObject<{
63
+ currency: z.ZodString;
64
+ available_currencies: z.ZodArray<z.ZodString, "many">;
65
+ }, "strip", z.ZodTypeAny, {
66
+ currency: string;
67
+ available_currencies: string[];
68
+ }, {
69
+ currency: string;
70
+ available_currencies: string[];
71
+ }>>;
62
72
  purchase_options: z.ZodArray<z.ZodObject<{
63
73
  purchase_option_id: z.ZodOptional<z.ZodNumber>;
64
74
  complete_without_payment: z.ZodOptional<z.ZodLiteral<true>>;
@@ -82,9 +92,9 @@ declare const session: z.ZodObject<{
82
92
  billing_interval: number;
83
93
  }>>;
84
94
  }, "strip", z.ZodTypeAny, {
85
- item_name: string;
86
95
  amount: string;
87
96
  currency: string;
97
+ item_name: string;
88
98
  purchase_option_id?: number | undefined;
89
99
  complete_without_payment?: true | undefined;
90
100
  renewal_terms?: {
@@ -94,9 +104,9 @@ declare const session: z.ZodObject<{
94
104
  billing_interval: number;
95
105
  } | undefined;
96
106
  }, {
97
- item_name: string;
98
107
  amount: string;
99
108
  currency: string;
109
+ item_name: string;
100
110
  purchase_option_id?: number | undefined;
101
111
  complete_without_payment?: true | undefined;
102
112
  renewal_terms?: {
@@ -108,15 +118,15 @@ declare const session: z.ZodObject<{
108
118
  }>, "many">;
109
119
  available_actions: z.ZodArray<z.ZodEnum<["list_payment_methods", "complete_without_payment"]>, "many">;
110
120
  }, "strip", z.ZodTypeAny, {
111
- checkout_session_no: string;
112
121
  status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
122
+ checkout_session_no: string;
113
123
  revision: number;
114
124
  expires_at: string;
115
125
  active_execution_no: string | null;
116
126
  purchase_options: {
117
- item_name: string;
118
127
  amount: string;
119
128
  currency: string;
129
+ item_name: string;
120
130
  purchase_option_id?: number | undefined;
121
131
  complete_without_payment?: true | undefined;
122
132
  renewal_terms?: {
@@ -127,16 +137,20 @@ declare const session: z.ZodObject<{
127
137
  } | undefined;
128
138
  }[];
129
139
  available_actions: ("complete_without_payment" | "list_payment_methods")[];
140
+ pricing_input?: {
141
+ currency: string;
142
+ available_currencies: string[];
143
+ } | undefined;
130
144
  }, {
131
- checkout_session_no: string;
132
145
  status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
146
+ checkout_session_no: string;
133
147
  revision: number;
134
148
  expires_at: string;
135
149
  active_execution_no: string | null;
136
150
  purchase_options: {
137
- item_name: string;
138
151
  amount: string;
139
152
  currency: string;
153
+ item_name: string;
140
154
  purchase_option_id?: number | undefined;
141
155
  complete_without_payment?: true | undefined;
142
156
  renewal_terms?: {
@@ -147,6 +161,10 @@ declare const session: z.ZodObject<{
147
161
  } | undefined;
148
162
  }[];
149
163
  available_actions: ("complete_without_payment" | "list_payment_methods")[];
164
+ pricing_input?: {
165
+ currency: string;
166
+ available_currencies: string[];
167
+ } | undefined;
150
168
  }>;
151
169
  declare const checkoutField: z.ZodObject<{
152
170
  requirement: z.ZodEnum<["required", "conditional", "recommended", "provider_auto", "internal", "not_collected"]>;
@@ -204,8 +222,6 @@ declare const method: z.ZodObject<{
204
222
  reason?: string | undefined;
205
223
  }>>;
206
224
  }, "strip", z.ZodTypeAny, {
207
- amount: string;
208
- currency: string;
209
225
  method_reference: string;
210
226
  method_binding: string;
211
227
  provider: string;
@@ -213,6 +229,8 @@ declare const method: z.ZodObject<{
213
229
  pm_id: string;
214
230
  name: string;
215
231
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
232
+ amount: string;
233
+ currency: string;
216
234
  payment_required: boolean;
217
235
  provider_setup_required: boolean;
218
236
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -227,14 +245,12 @@ declare const method: z.ZodObject<{
227
245
  required_countries?: string[] | undefined;
228
246
  reason?: string | undefined;
229
247
  }>;
230
- purchase_option_id?: number | undefined;
231
248
  logo?: string | undefined;
249
+ purchase_option_id?: number | undefined;
232
250
  purchase_option_label?: string | undefined;
233
251
  renewal_policy?: "manual" | "auto" | undefined;
234
252
  country_code?: string | null | undefined;
235
253
  }, {
236
- amount: string;
237
- currency: string;
238
254
  method_reference: string;
239
255
  method_binding: string;
240
256
  provider: string;
@@ -242,6 +258,8 @@ declare const method: z.ZodObject<{
242
258
  pm_id: string;
243
259
  name: string;
244
260
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
261
+ amount: string;
262
+ currency: string;
245
263
  payment_required: boolean;
246
264
  provider_setup_required: boolean;
247
265
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -256,8 +274,8 @@ declare const method: z.ZodObject<{
256
274
  required_countries?: string[] | undefined;
257
275
  reason?: string | undefined;
258
276
  }>;
259
- purchase_option_id?: number | undefined;
260
277
  logo?: string | undefined;
278
+ purchase_option_id?: number | undefined;
261
279
  purchase_option_label?: string | undefined;
262
280
  renewal_policy?: "manual" | "auto" | undefined;
263
281
  country_code?: string | null | undefined;
@@ -307,8 +325,6 @@ declare const methods: z.ZodObject<{
307
325
  reason?: string | undefined;
308
326
  }>>;
309
327
  }, "strip", z.ZodTypeAny, {
310
- amount: string;
311
- currency: string;
312
328
  method_reference: string;
313
329
  method_binding: string;
314
330
  provider: string;
@@ -316,6 +332,8 @@ declare const methods: z.ZodObject<{
316
332
  pm_id: string;
317
333
  name: string;
318
334
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
335
+ amount: string;
336
+ currency: string;
319
337
  payment_required: boolean;
320
338
  provider_setup_required: boolean;
321
339
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -330,14 +348,12 @@ declare const methods: z.ZodObject<{
330
348
  required_countries?: string[] | undefined;
331
349
  reason?: string | undefined;
332
350
  }>;
333
- purchase_option_id?: number | undefined;
334
351
  logo?: string | undefined;
352
+ purchase_option_id?: number | undefined;
335
353
  purchase_option_label?: string | undefined;
336
354
  renewal_policy?: "manual" | "auto" | undefined;
337
355
  country_code?: string | null | undefined;
338
356
  }, {
339
- amount: string;
340
- currency: string;
341
357
  method_reference: string;
342
358
  method_binding: string;
343
359
  provider: string;
@@ -345,6 +361,8 @@ declare const methods: z.ZodObject<{
345
361
  pm_id: string;
346
362
  name: string;
347
363
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
364
+ amount: string;
365
+ currency: string;
348
366
  payment_required: boolean;
349
367
  provider_setup_required: boolean;
350
368
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -359,8 +377,8 @@ declare const methods: z.ZodObject<{
359
377
  required_countries?: string[] | undefined;
360
378
  reason?: string | undefined;
361
379
  }>;
362
- purchase_option_id?: number | undefined;
363
380
  logo?: string | undefined;
381
+ purchase_option_id?: number | undefined;
364
382
  purchase_option_label?: string | undefined;
365
383
  renewal_policy?: "manual" | "auto" | undefined;
366
384
  country_code?: string | null | undefined;
@@ -369,8 +387,6 @@ declare const methods: z.ZodObject<{
369
387
  key: string;
370
388
  label: string;
371
389
  methods: {
372
- amount: string;
373
- currency: string;
374
390
  method_reference: string;
375
391
  method_binding: string;
376
392
  provider: string;
@@ -378,6 +394,8 @@ declare const methods: z.ZodObject<{
378
394
  pm_id: string;
379
395
  name: string;
380
396
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
397
+ amount: string;
398
+ currency: string;
381
399
  payment_required: boolean;
382
400
  provider_setup_required: boolean;
383
401
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -392,8 +410,8 @@ declare const methods: z.ZodObject<{
392
410
  required_countries?: string[] | undefined;
393
411
  reason?: string | undefined;
394
412
  }>;
395
- purchase_option_id?: number | undefined;
396
413
  logo?: string | undefined;
414
+ purchase_option_id?: number | undefined;
397
415
  purchase_option_label?: string | undefined;
398
416
  renewal_policy?: "manual" | "auto" | undefined;
399
417
  country_code?: string | null | undefined;
@@ -402,8 +420,6 @@ declare const methods: z.ZodObject<{
402
420
  key: string;
403
421
  label: string;
404
422
  methods: {
405
- amount: string;
406
- currency: string;
407
423
  method_reference: string;
408
424
  method_binding: string;
409
425
  provider: string;
@@ -411,6 +427,8 @@ declare const methods: z.ZodObject<{
411
427
  pm_id: string;
412
428
  name: string;
413
429
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
430
+ amount: string;
431
+ currency: string;
414
432
  payment_required: boolean;
415
433
  provider_setup_required: boolean;
416
434
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -425,8 +443,8 @@ declare const methods: z.ZodObject<{
425
443
  required_countries?: string[] | undefined;
426
444
  reason?: string | undefined;
427
445
  }>;
428
- purchase_option_id?: number | undefined;
429
446
  logo?: string | undefined;
447
+ purchase_option_id?: number | undefined;
430
448
  purchase_option_label?: string | undefined;
431
449
  renewal_policy?: "manual" | "auto" | undefined;
432
450
  country_code?: string | null | undefined;
@@ -438,8 +456,6 @@ declare const methods: z.ZodObject<{
438
456
  key: string;
439
457
  label: string;
440
458
  methods: {
441
- amount: string;
442
- currency: string;
443
459
  method_reference: string;
444
460
  method_binding: string;
445
461
  provider: string;
@@ -447,6 +463,8 @@ declare const methods: z.ZodObject<{
447
463
  pm_id: string;
448
464
  name: string;
449
465
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
466
+ amount: string;
467
+ currency: string;
450
468
  payment_required: boolean;
451
469
  provider_setup_required: boolean;
452
470
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -461,8 +479,8 @@ declare const methods: z.ZodObject<{
461
479
  required_countries?: string[] | undefined;
462
480
  reason?: string | undefined;
463
481
  }>;
464
- purchase_option_id?: number | undefined;
465
482
  logo?: string | undefined;
483
+ purchase_option_id?: number | undefined;
466
484
  purchase_option_label?: string | undefined;
467
485
  renewal_policy?: "manual" | "auto" | undefined;
468
486
  country_code?: string | null | undefined;
@@ -474,8 +492,6 @@ declare const methods: z.ZodObject<{
474
492
  key: string;
475
493
  label: string;
476
494
  methods: {
477
- amount: string;
478
- currency: string;
479
495
  method_reference: string;
480
496
  method_binding: string;
481
497
  provider: string;
@@ -483,6 +499,8 @@ declare const methods: z.ZodObject<{
483
499
  pm_id: string;
484
500
  name: string;
485
501
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
502
+ amount: string;
503
+ currency: string;
486
504
  payment_required: boolean;
487
505
  provider_setup_required: boolean;
488
506
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -497,8 +515,8 @@ declare const methods: z.ZodObject<{
497
515
  required_countries?: string[] | undefined;
498
516
  reason?: string | undefined;
499
517
  }>;
500
- purchase_option_id?: number | undefined;
501
518
  logo?: string | undefined;
519
+ purchase_option_id?: number | undefined;
502
520
  purchase_option_label?: string | undefined;
503
521
  renewal_policy?: "manual" | "auto" | undefined;
504
522
  country_code?: string | null | undefined;
@@ -516,16 +534,16 @@ declare const billingAddress: z.ZodObject<{
516
534
  line1?: string | undefined;
517
535
  line2?: string | undefined;
518
536
  city?: string | undefined;
537
+ country?: string | undefined;
519
538
  state?: string | undefined;
520
539
  postal_code?: string | undefined;
521
- country?: string | undefined;
522
540
  }, {
523
541
  line1?: string | undefined;
524
542
  line2?: string | undefined;
525
543
  city?: string | undefined;
544
+ country?: string | undefined;
526
545
  state?: string | undefined;
527
546
  postal_code?: string | undefined;
528
- country?: string | undefined;
529
547
  }>;
530
548
  declare const execution: z.ZodObject<{
531
549
  checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
@@ -546,16 +564,16 @@ declare const execution: z.ZodObject<{
546
564
  line1?: string | undefined;
547
565
  line2?: string | undefined;
548
566
  city?: string | undefined;
567
+ country?: string | undefined;
549
568
  state?: string | undefined;
550
569
  postal_code?: string | undefined;
551
- country?: string | undefined;
552
570
  }, {
553
571
  line1?: string | undefined;
554
572
  line2?: string | undefined;
555
573
  city?: string | undefined;
574
+ country?: string | undefined;
556
575
  state?: string | undefined;
557
576
  postal_code?: string | undefined;
558
- country?: string | undefined;
559
577
  }>>;
560
578
  payment_no: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
561
579
  provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -586,12 +604,12 @@ declare const execution: z.ZodObject<{
586
604
  }>>;
587
605
  command_status: z.ZodOptional<z.ZodString>;
588
606
  }, "strip", z.ZodTypeAny, {
589
- checkout_session_no: string;
590
- status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
591
- amount: string;
592
- currency: string;
607
+ status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
593
608
  method_binding: string;
594
609
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
610
+ amount: string;
611
+ currency: string;
612
+ checkout_session_no: string;
595
613
  execution_no: string;
596
614
  purpose: "payment" | "provider_setup";
597
615
  presentation: {
@@ -601,9 +619,9 @@ declare const execution: z.ZodObject<{
601
619
  checkout_url?: string | null | undefined;
602
620
  payload?: unknown;
603
621
  } | null;
604
- purchase_option_id?: number | undefined;
605
622
  provider?: string | undefined;
606
623
  pm_id?: string | undefined;
624
+ purchase_option_id?: number | undefined;
607
625
  selection_status?: "active" | "superseded" | "session_closed" | undefined;
608
626
  order_no?: string | undefined;
609
627
  customer_name?: string | undefined;
@@ -611,19 +629,19 @@ declare const execution: z.ZodObject<{
611
629
  line1?: string | undefined;
612
630
  line2?: string | undefined;
613
631
  city?: string | undefined;
632
+ country?: string | undefined;
614
633
  state?: string | undefined;
615
634
  postal_code?: string | undefined;
616
- country?: string | undefined;
617
635
  } | undefined;
618
636
  payment_no?: string | null | undefined;
619
637
  command_status?: string | undefined;
620
638
  }, {
621
- checkout_session_no: string;
622
- status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
623
- amount: string;
624
- currency: string;
639
+ status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
625
640
  method_binding: string;
626
641
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
642
+ amount: string;
643
+ currency: string;
644
+ checkout_session_no: string;
627
645
  execution_no: string;
628
646
  purpose: "payment" | "provider_setup";
629
647
  presentation: {
@@ -633,9 +651,9 @@ declare const execution: z.ZodObject<{
633
651
  checkout_url?: string | null | undefined;
634
652
  payload?: unknown;
635
653
  } | null;
636
- purchase_option_id?: number | undefined;
637
654
  provider?: string | undefined;
638
655
  pm_id?: string | undefined;
656
+ purchase_option_id?: number | undefined;
639
657
  selection_status?: "active" | "superseded" | "session_closed" | undefined;
640
658
  order_no?: string | undefined;
641
659
  customer_name?: string | undefined;
@@ -643,9 +661,9 @@ declare const execution: z.ZodObject<{
643
661
  line1?: string | undefined;
644
662
  line2?: string | undefined;
645
663
  city?: string | undefined;
664
+ country?: string | undefined;
646
665
  state?: string | undefined;
647
666
  postal_code?: string | undefined;
648
- country?: string | undefined;
649
667
  } | undefined;
650
668
  payment_no?: string | null | undefined;
651
669
  command_status?: string | undefined;
@@ -662,14 +680,14 @@ declare const cancellation: z.ZodObject<{
662
680
  execution_no: string;
663
681
  command_status: string;
664
682
  session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
665
- execution_status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
683
+ execution_status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
666
684
  pending_provider_commands: number;
667
685
  }, {
668
686
  checkout_session_no: string;
669
687
  execution_no: string;
670
688
  command_status: string;
671
689
  session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
672
- execution_status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
690
+ execution_status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
673
691
  pending_provider_commands: number;
674
692
  }>;
675
693
  declare const completion: z.ZodObject<{
@@ -688,6 +706,29 @@ declare const completion: z.ZodObject<{
688
706
  session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
689
707
  fulfillment_status: string;
690
708
  }>;
709
+ declare const reviseInput: z.ZodObject<{
710
+ currency: z.ZodString;
711
+ expected_revision: z.ZodNumber;
712
+ }, "strict", z.ZodTypeAny, {
713
+ currency: string;
714
+ expected_revision: number;
715
+ }, {
716
+ currency: string;
717
+ expected_revision: number;
718
+ }>;
719
+ declare const revisionResult: z.ZodObject<{
720
+ checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
721
+ revision: z.ZodNumber;
722
+ currency: z.ZodString;
723
+ }, "strip", z.ZodTypeAny, {
724
+ currency: string;
725
+ checkout_session_no: string;
726
+ revision: number;
727
+ }, {
728
+ currency: string;
729
+ checkout_session_no: string;
730
+ revision: number;
731
+ }>;
691
732
  declare const startInput: z.ZodObject<{
692
733
  session_revision: z.ZodNumber;
693
734
  method_reference: z.ZodEffects<z.ZodString, string, string>;
@@ -703,40 +744,40 @@ declare const startInput: z.ZodObject<{
703
744
  line1?: string | undefined;
704
745
  line2?: string | undefined;
705
746
  city?: string | undefined;
747
+ country?: string | undefined;
706
748
  state?: string | undefined;
707
749
  postal_code?: string | undefined;
708
- country?: string | undefined;
709
750
  }, {
710
751
  line1?: string | undefined;
711
752
  line2?: string | undefined;
712
753
  city?: string | undefined;
754
+ country?: string | undefined;
713
755
  state?: string | undefined;
714
756
  postal_code?: string | undefined;
715
- country?: string | undefined;
716
757
  }>>;
717
758
  }, "strict", z.ZodTypeAny, {
718
- session_revision: number;
719
759
  method_reference: string;
760
+ session_revision: number;
720
761
  customer_name?: string | undefined;
721
762
  billing_address?: {
722
763
  line1?: string | undefined;
723
764
  line2?: string | undefined;
724
765
  city?: string | undefined;
766
+ country?: string | undefined;
725
767
  state?: string | undefined;
726
768
  postal_code?: string | undefined;
727
- country?: string | undefined;
728
769
  } | undefined;
729
770
  }, {
730
- session_revision: number;
731
771
  method_reference: string;
772
+ session_revision: number;
732
773
  customer_name?: string | undefined;
733
774
  billing_address?: {
734
775
  line1?: string | undefined;
735
776
  line2?: string | undefined;
736
777
  city?: string | undefined;
778
+ country?: string | undefined;
737
779
  state?: string | undefined;
738
780
  postal_code?: string | undefined;
739
- country?: string | undefined;
740
781
  } | undefined;
741
782
  }>;
742
783
  type PurchaseOption = z.infer<typeof purchaseOption>;
@@ -746,6 +787,8 @@ type CheckoutMethod = z.infer<typeof method>;
746
787
  type CheckoutField = z.infer<typeof checkoutField>;
747
788
  type BillingAddress = z.infer<typeof billingAddress>;
748
789
  type StartInput = z.infer<typeof startInput>;
790
+ type ReviseInput = z.infer<typeof reviseInput>;
791
+ type RevisionResult = z.infer<typeof revisionResult>;
749
792
  type Cancellation = z.infer<typeof cancellation>;
750
793
  type Completion = z.infer<typeof completion>;
751
794
  type ExecutionResponse = z.infer<typeof execution>;
@@ -873,6 +916,7 @@ interface CheckoutClient<T extends Presentation = never> {
873
916
  complete(no: string, expectedRevision: number, idempotencyKey: string, signal?: AbortSignal): Promise<Completion>;
874
917
  }
875
918
  interface RegisteredCheckoutClient<T extends Presentation = never> extends CheckoutClient<T> {
919
+ revise(no: string, input: ReviseInput, idempotencyKey: string, signal?: AbortSignal): Promise<RevisionResult>;
876
920
  assertMethod(method: CheckoutMethod, execution: Execution<AirwallexPresentation | T>): void;
877
921
  }
878
922
  type ClientOptions = Omit<CheckoutClientOptions, "presentations">;
@@ -936,4 +980,4 @@ declare function billingAddressInput(fields: readonly PayerField[], values: Paye
936
980
  declare function supportsPayerFields(fields: CheckoutMethod["checkout_fields"]): boolean;
937
981
 
938
982
  export { CheckoutProtocolError, airwallexEnvironment, airwallexMethods, airwallexSession, assertExecutionMethod, billingAddressInput, collectPayerFields, createCheckoutClient, hasValidPayerValues, isCardholderNameValid, parsePresentation, supportsPayerFields };
939
- export type { AirwallexPresentation, BillingAddress, Cancellation, CheckoutClient, CheckoutClientOptions, CheckoutField, CheckoutMethod, Completion, Execution, PayerField, PayerValues, PaymentMethods, Presentation, PresentationContext, PresentationDecoder, ProtocolErrorCode, PurchaseOption, RegisteredCheckoutClient, SessionState, StartInput };
983
+ export type { AirwallexPresentation, BillingAddress, Cancellation, CheckoutClient, CheckoutClientOptions, CheckoutField, CheckoutMethod, Completion, Execution, PayerField, PayerValues, PaymentMethods, Presentation, PresentationContext, PresentationDecoder, ProtocolErrorCode, PurchaseOption, RegisteredCheckoutClient, ReviseInput, RevisionResult, SessionState, StartInput };
package/dist/index.d.ts CHANGED
@@ -29,9 +29,9 @@ declare const purchaseOption: z.ZodObject<{
29
29
  billing_interval: number;
30
30
  }>>;
31
31
  }, "strip", z.ZodTypeAny, {
32
- item_name: string;
33
32
  amount: string;
34
33
  currency: string;
34
+ item_name: string;
35
35
  purchase_option_id?: number | undefined;
36
36
  complete_without_payment?: true | undefined;
37
37
  renewal_terms?: {
@@ -41,9 +41,9 @@ declare const purchaseOption: z.ZodObject<{
41
41
  billing_interval: number;
42
42
  } | undefined;
43
43
  }, {
44
- item_name: string;
45
44
  amount: string;
46
45
  currency: string;
46
+ item_name: string;
47
47
  purchase_option_id?: number | undefined;
48
48
  complete_without_payment?: true | undefined;
49
49
  renewal_terms?: {
@@ -59,6 +59,16 @@ declare const session: z.ZodObject<{
59
59
  revision: z.ZodNumber;
60
60
  expires_at: z.ZodString;
61
61
  active_execution_no: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
62
+ pricing_input: z.ZodOptional<z.ZodObject<{
63
+ currency: z.ZodString;
64
+ available_currencies: z.ZodArray<z.ZodString, "many">;
65
+ }, "strip", z.ZodTypeAny, {
66
+ currency: string;
67
+ available_currencies: string[];
68
+ }, {
69
+ currency: string;
70
+ available_currencies: string[];
71
+ }>>;
62
72
  purchase_options: z.ZodArray<z.ZodObject<{
63
73
  purchase_option_id: z.ZodOptional<z.ZodNumber>;
64
74
  complete_without_payment: z.ZodOptional<z.ZodLiteral<true>>;
@@ -82,9 +92,9 @@ declare const session: z.ZodObject<{
82
92
  billing_interval: number;
83
93
  }>>;
84
94
  }, "strip", z.ZodTypeAny, {
85
- item_name: string;
86
95
  amount: string;
87
96
  currency: string;
97
+ item_name: string;
88
98
  purchase_option_id?: number | undefined;
89
99
  complete_without_payment?: true | undefined;
90
100
  renewal_terms?: {
@@ -94,9 +104,9 @@ declare const session: z.ZodObject<{
94
104
  billing_interval: number;
95
105
  } | undefined;
96
106
  }, {
97
- item_name: string;
98
107
  amount: string;
99
108
  currency: string;
109
+ item_name: string;
100
110
  purchase_option_id?: number | undefined;
101
111
  complete_without_payment?: true | undefined;
102
112
  renewal_terms?: {
@@ -108,15 +118,15 @@ declare const session: z.ZodObject<{
108
118
  }>, "many">;
109
119
  available_actions: z.ZodArray<z.ZodEnum<["list_payment_methods", "complete_without_payment"]>, "many">;
110
120
  }, "strip", z.ZodTypeAny, {
111
- checkout_session_no: string;
112
121
  status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
122
+ checkout_session_no: string;
113
123
  revision: number;
114
124
  expires_at: string;
115
125
  active_execution_no: string | null;
116
126
  purchase_options: {
117
- item_name: string;
118
127
  amount: string;
119
128
  currency: string;
129
+ item_name: string;
120
130
  purchase_option_id?: number | undefined;
121
131
  complete_without_payment?: true | undefined;
122
132
  renewal_terms?: {
@@ -127,16 +137,20 @@ declare const session: z.ZodObject<{
127
137
  } | undefined;
128
138
  }[];
129
139
  available_actions: ("complete_without_payment" | "list_payment_methods")[];
140
+ pricing_input?: {
141
+ currency: string;
142
+ available_currencies: string[];
143
+ } | undefined;
130
144
  }, {
131
- checkout_session_no: string;
132
145
  status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
146
+ checkout_session_no: string;
133
147
  revision: number;
134
148
  expires_at: string;
135
149
  active_execution_no: string | null;
136
150
  purchase_options: {
137
- item_name: string;
138
151
  amount: string;
139
152
  currency: string;
153
+ item_name: string;
140
154
  purchase_option_id?: number | undefined;
141
155
  complete_without_payment?: true | undefined;
142
156
  renewal_terms?: {
@@ -147,6 +161,10 @@ declare const session: z.ZodObject<{
147
161
  } | undefined;
148
162
  }[];
149
163
  available_actions: ("complete_without_payment" | "list_payment_methods")[];
164
+ pricing_input?: {
165
+ currency: string;
166
+ available_currencies: string[];
167
+ } | undefined;
150
168
  }>;
151
169
  declare const checkoutField: z.ZodObject<{
152
170
  requirement: z.ZodEnum<["required", "conditional", "recommended", "provider_auto", "internal", "not_collected"]>;
@@ -204,8 +222,6 @@ declare const method: z.ZodObject<{
204
222
  reason?: string | undefined;
205
223
  }>>;
206
224
  }, "strip", z.ZodTypeAny, {
207
- amount: string;
208
- currency: string;
209
225
  method_reference: string;
210
226
  method_binding: string;
211
227
  provider: string;
@@ -213,6 +229,8 @@ declare const method: z.ZodObject<{
213
229
  pm_id: string;
214
230
  name: string;
215
231
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
232
+ amount: string;
233
+ currency: string;
216
234
  payment_required: boolean;
217
235
  provider_setup_required: boolean;
218
236
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -227,14 +245,12 @@ declare const method: z.ZodObject<{
227
245
  required_countries?: string[] | undefined;
228
246
  reason?: string | undefined;
229
247
  }>;
230
- purchase_option_id?: number | undefined;
231
248
  logo?: string | undefined;
249
+ purchase_option_id?: number | undefined;
232
250
  purchase_option_label?: string | undefined;
233
251
  renewal_policy?: "manual" | "auto" | undefined;
234
252
  country_code?: string | null | undefined;
235
253
  }, {
236
- amount: string;
237
- currency: string;
238
254
  method_reference: string;
239
255
  method_binding: string;
240
256
  provider: string;
@@ -242,6 +258,8 @@ declare const method: z.ZodObject<{
242
258
  pm_id: string;
243
259
  name: string;
244
260
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
261
+ amount: string;
262
+ currency: string;
245
263
  payment_required: boolean;
246
264
  provider_setup_required: boolean;
247
265
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -256,8 +274,8 @@ declare const method: z.ZodObject<{
256
274
  required_countries?: string[] | undefined;
257
275
  reason?: string | undefined;
258
276
  }>;
259
- purchase_option_id?: number | undefined;
260
277
  logo?: string | undefined;
278
+ purchase_option_id?: number | undefined;
261
279
  purchase_option_label?: string | undefined;
262
280
  renewal_policy?: "manual" | "auto" | undefined;
263
281
  country_code?: string | null | undefined;
@@ -307,8 +325,6 @@ declare const methods: z.ZodObject<{
307
325
  reason?: string | undefined;
308
326
  }>>;
309
327
  }, "strip", z.ZodTypeAny, {
310
- amount: string;
311
- currency: string;
312
328
  method_reference: string;
313
329
  method_binding: string;
314
330
  provider: string;
@@ -316,6 +332,8 @@ declare const methods: z.ZodObject<{
316
332
  pm_id: string;
317
333
  name: string;
318
334
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
335
+ amount: string;
336
+ currency: string;
319
337
  payment_required: boolean;
320
338
  provider_setup_required: boolean;
321
339
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -330,14 +348,12 @@ declare const methods: z.ZodObject<{
330
348
  required_countries?: string[] | undefined;
331
349
  reason?: string | undefined;
332
350
  }>;
333
- purchase_option_id?: number | undefined;
334
351
  logo?: string | undefined;
352
+ purchase_option_id?: number | undefined;
335
353
  purchase_option_label?: string | undefined;
336
354
  renewal_policy?: "manual" | "auto" | undefined;
337
355
  country_code?: string | null | undefined;
338
356
  }, {
339
- amount: string;
340
- currency: string;
341
357
  method_reference: string;
342
358
  method_binding: string;
343
359
  provider: string;
@@ -345,6 +361,8 @@ declare const methods: z.ZodObject<{
345
361
  pm_id: string;
346
362
  name: string;
347
363
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
364
+ amount: string;
365
+ currency: string;
348
366
  payment_required: boolean;
349
367
  provider_setup_required: boolean;
350
368
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -359,8 +377,8 @@ declare const methods: z.ZodObject<{
359
377
  required_countries?: string[] | undefined;
360
378
  reason?: string | undefined;
361
379
  }>;
362
- purchase_option_id?: number | undefined;
363
380
  logo?: string | undefined;
381
+ purchase_option_id?: number | undefined;
364
382
  purchase_option_label?: string | undefined;
365
383
  renewal_policy?: "manual" | "auto" | undefined;
366
384
  country_code?: string | null | undefined;
@@ -369,8 +387,6 @@ declare const methods: z.ZodObject<{
369
387
  key: string;
370
388
  label: string;
371
389
  methods: {
372
- amount: string;
373
- currency: string;
374
390
  method_reference: string;
375
391
  method_binding: string;
376
392
  provider: string;
@@ -378,6 +394,8 @@ declare const methods: z.ZodObject<{
378
394
  pm_id: string;
379
395
  name: string;
380
396
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
397
+ amount: string;
398
+ currency: string;
381
399
  payment_required: boolean;
382
400
  provider_setup_required: boolean;
383
401
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -392,8 +410,8 @@ declare const methods: z.ZodObject<{
392
410
  required_countries?: string[] | undefined;
393
411
  reason?: string | undefined;
394
412
  }>;
395
- purchase_option_id?: number | undefined;
396
413
  logo?: string | undefined;
414
+ purchase_option_id?: number | undefined;
397
415
  purchase_option_label?: string | undefined;
398
416
  renewal_policy?: "manual" | "auto" | undefined;
399
417
  country_code?: string | null | undefined;
@@ -402,8 +420,6 @@ declare const methods: z.ZodObject<{
402
420
  key: string;
403
421
  label: string;
404
422
  methods: {
405
- amount: string;
406
- currency: string;
407
423
  method_reference: string;
408
424
  method_binding: string;
409
425
  provider: string;
@@ -411,6 +427,8 @@ declare const methods: z.ZodObject<{
411
427
  pm_id: string;
412
428
  name: string;
413
429
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
430
+ amount: string;
431
+ currency: string;
414
432
  payment_required: boolean;
415
433
  provider_setup_required: boolean;
416
434
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -425,8 +443,8 @@ declare const methods: z.ZodObject<{
425
443
  required_countries?: string[] | undefined;
426
444
  reason?: string | undefined;
427
445
  }>;
428
- purchase_option_id?: number | undefined;
429
446
  logo?: string | undefined;
447
+ purchase_option_id?: number | undefined;
430
448
  purchase_option_label?: string | undefined;
431
449
  renewal_policy?: "manual" | "auto" | undefined;
432
450
  country_code?: string | null | undefined;
@@ -438,8 +456,6 @@ declare const methods: z.ZodObject<{
438
456
  key: string;
439
457
  label: string;
440
458
  methods: {
441
- amount: string;
442
- currency: string;
443
459
  method_reference: string;
444
460
  method_binding: string;
445
461
  provider: string;
@@ -447,6 +463,8 @@ declare const methods: z.ZodObject<{
447
463
  pm_id: string;
448
464
  name: string;
449
465
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
466
+ amount: string;
467
+ currency: string;
450
468
  payment_required: boolean;
451
469
  provider_setup_required: boolean;
452
470
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -461,8 +479,8 @@ declare const methods: z.ZodObject<{
461
479
  required_countries?: string[] | undefined;
462
480
  reason?: string | undefined;
463
481
  }>;
464
- purchase_option_id?: number | undefined;
465
482
  logo?: string | undefined;
483
+ purchase_option_id?: number | undefined;
466
484
  purchase_option_label?: string | undefined;
467
485
  renewal_policy?: "manual" | "auto" | undefined;
468
486
  country_code?: string | null | undefined;
@@ -474,8 +492,6 @@ declare const methods: z.ZodObject<{
474
492
  key: string;
475
493
  label: string;
476
494
  methods: {
477
- amount: string;
478
- currency: string;
479
495
  method_reference: string;
480
496
  method_binding: string;
481
497
  provider: string;
@@ -483,6 +499,8 @@ declare const methods: z.ZodObject<{
483
499
  pm_id: string;
484
500
  name: string;
485
501
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
502
+ amount: string;
503
+ currency: string;
486
504
  payment_required: boolean;
487
505
  provider_setup_required: boolean;
488
506
  setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
@@ -497,8 +515,8 @@ declare const methods: z.ZodObject<{
497
515
  required_countries?: string[] | undefined;
498
516
  reason?: string | undefined;
499
517
  }>;
500
- purchase_option_id?: number | undefined;
501
518
  logo?: string | undefined;
519
+ purchase_option_id?: number | undefined;
502
520
  purchase_option_label?: string | undefined;
503
521
  renewal_policy?: "manual" | "auto" | undefined;
504
522
  country_code?: string | null | undefined;
@@ -516,16 +534,16 @@ declare const billingAddress: z.ZodObject<{
516
534
  line1?: string | undefined;
517
535
  line2?: string | undefined;
518
536
  city?: string | undefined;
537
+ country?: string | undefined;
519
538
  state?: string | undefined;
520
539
  postal_code?: string | undefined;
521
- country?: string | undefined;
522
540
  }, {
523
541
  line1?: string | undefined;
524
542
  line2?: string | undefined;
525
543
  city?: string | undefined;
544
+ country?: string | undefined;
526
545
  state?: string | undefined;
527
546
  postal_code?: string | undefined;
528
- country?: string | undefined;
529
547
  }>;
530
548
  declare const execution: z.ZodObject<{
531
549
  checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
@@ -546,16 +564,16 @@ declare const execution: z.ZodObject<{
546
564
  line1?: string | undefined;
547
565
  line2?: string | undefined;
548
566
  city?: string | undefined;
567
+ country?: string | undefined;
549
568
  state?: string | undefined;
550
569
  postal_code?: string | undefined;
551
- country?: string | undefined;
552
570
  }, {
553
571
  line1?: string | undefined;
554
572
  line2?: string | undefined;
555
573
  city?: string | undefined;
574
+ country?: string | undefined;
556
575
  state?: string | undefined;
557
576
  postal_code?: string | undefined;
558
- country?: string | undefined;
559
577
  }>>;
560
578
  payment_no: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
561
579
  provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -586,12 +604,12 @@ declare const execution: z.ZodObject<{
586
604
  }>>;
587
605
  command_status: z.ZodOptional<z.ZodString>;
588
606
  }, "strip", z.ZodTypeAny, {
589
- checkout_session_no: string;
590
- status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
591
- amount: string;
592
- currency: string;
607
+ status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
593
608
  method_binding: string;
594
609
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
610
+ amount: string;
611
+ currency: string;
612
+ checkout_session_no: string;
595
613
  execution_no: string;
596
614
  purpose: "payment" | "provider_setup";
597
615
  presentation: {
@@ -601,9 +619,9 @@ declare const execution: z.ZodObject<{
601
619
  checkout_url?: string | null | undefined;
602
620
  payload?: unknown;
603
621
  } | null;
604
- purchase_option_id?: number | undefined;
605
622
  provider?: string | undefined;
606
623
  pm_id?: string | undefined;
624
+ purchase_option_id?: number | undefined;
607
625
  selection_status?: "active" | "superseded" | "session_closed" | undefined;
608
626
  order_no?: string | undefined;
609
627
  customer_name?: string | undefined;
@@ -611,19 +629,19 @@ declare const execution: z.ZodObject<{
611
629
  line1?: string | undefined;
612
630
  line2?: string | undefined;
613
631
  city?: string | undefined;
632
+ country?: string | undefined;
614
633
  state?: string | undefined;
615
634
  postal_code?: string | undefined;
616
- country?: string | undefined;
617
635
  } | undefined;
618
636
  payment_no?: string | null | undefined;
619
637
  command_status?: string | undefined;
620
638
  }, {
621
- checkout_session_no: string;
622
- status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
623
- amount: string;
624
- currency: string;
639
+ status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
625
640
  method_binding: string;
626
641
  payment_authority_kind: "catalog_purchase_option" | "target_policy";
642
+ amount: string;
643
+ currency: string;
644
+ checkout_session_no: string;
627
645
  execution_no: string;
628
646
  purpose: "payment" | "provider_setup";
629
647
  presentation: {
@@ -633,9 +651,9 @@ declare const execution: z.ZodObject<{
633
651
  checkout_url?: string | null | undefined;
634
652
  payload?: unknown;
635
653
  } | null;
636
- purchase_option_id?: number | undefined;
637
654
  provider?: string | undefined;
638
655
  pm_id?: string | undefined;
656
+ purchase_option_id?: number | undefined;
639
657
  selection_status?: "active" | "superseded" | "session_closed" | undefined;
640
658
  order_no?: string | undefined;
641
659
  customer_name?: string | undefined;
@@ -643,9 +661,9 @@ declare const execution: z.ZodObject<{
643
661
  line1?: string | undefined;
644
662
  line2?: string | undefined;
645
663
  city?: string | undefined;
664
+ country?: string | undefined;
646
665
  state?: string | undefined;
647
666
  postal_code?: string | undefined;
648
- country?: string | undefined;
649
667
  } | undefined;
650
668
  payment_no?: string | null | undefined;
651
669
  command_status?: string | undefined;
@@ -662,14 +680,14 @@ declare const cancellation: z.ZodObject<{
662
680
  execution_no: string;
663
681
  command_status: string;
664
682
  session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
665
- execution_status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
683
+ execution_status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
666
684
  pending_provider_commands: number;
667
685
  }, {
668
686
  checkout_session_no: string;
669
687
  execution_no: string;
670
688
  command_status: string;
671
689
  session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
672
- execution_status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
690
+ execution_status: "unknown" | "canceled" | "expired" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
673
691
  pending_provider_commands: number;
674
692
  }>;
675
693
  declare const completion: z.ZodObject<{
@@ -688,6 +706,29 @@ declare const completion: z.ZodObject<{
688
706
  session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
689
707
  fulfillment_status: string;
690
708
  }>;
709
+ declare const reviseInput: z.ZodObject<{
710
+ currency: z.ZodString;
711
+ expected_revision: z.ZodNumber;
712
+ }, "strict", z.ZodTypeAny, {
713
+ currency: string;
714
+ expected_revision: number;
715
+ }, {
716
+ currency: string;
717
+ expected_revision: number;
718
+ }>;
719
+ declare const revisionResult: z.ZodObject<{
720
+ checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
721
+ revision: z.ZodNumber;
722
+ currency: z.ZodString;
723
+ }, "strip", z.ZodTypeAny, {
724
+ currency: string;
725
+ checkout_session_no: string;
726
+ revision: number;
727
+ }, {
728
+ currency: string;
729
+ checkout_session_no: string;
730
+ revision: number;
731
+ }>;
691
732
  declare const startInput: z.ZodObject<{
692
733
  session_revision: z.ZodNumber;
693
734
  method_reference: z.ZodEffects<z.ZodString, string, string>;
@@ -703,40 +744,40 @@ declare const startInput: z.ZodObject<{
703
744
  line1?: string | undefined;
704
745
  line2?: string | undefined;
705
746
  city?: string | undefined;
747
+ country?: string | undefined;
706
748
  state?: string | undefined;
707
749
  postal_code?: string | undefined;
708
- country?: string | undefined;
709
750
  }, {
710
751
  line1?: string | undefined;
711
752
  line2?: string | undefined;
712
753
  city?: string | undefined;
754
+ country?: string | undefined;
713
755
  state?: string | undefined;
714
756
  postal_code?: string | undefined;
715
- country?: string | undefined;
716
757
  }>>;
717
758
  }, "strict", z.ZodTypeAny, {
718
- session_revision: number;
719
759
  method_reference: string;
760
+ session_revision: number;
720
761
  customer_name?: string | undefined;
721
762
  billing_address?: {
722
763
  line1?: string | undefined;
723
764
  line2?: string | undefined;
724
765
  city?: string | undefined;
766
+ country?: string | undefined;
725
767
  state?: string | undefined;
726
768
  postal_code?: string | undefined;
727
- country?: string | undefined;
728
769
  } | undefined;
729
770
  }, {
730
- session_revision: number;
731
771
  method_reference: string;
772
+ session_revision: number;
732
773
  customer_name?: string | undefined;
733
774
  billing_address?: {
734
775
  line1?: string | undefined;
735
776
  line2?: string | undefined;
736
777
  city?: string | undefined;
778
+ country?: string | undefined;
737
779
  state?: string | undefined;
738
780
  postal_code?: string | undefined;
739
- country?: string | undefined;
740
781
  } | undefined;
741
782
  }>;
742
783
  type PurchaseOption = z.infer<typeof purchaseOption>;
@@ -746,6 +787,8 @@ type CheckoutMethod = z.infer<typeof method>;
746
787
  type CheckoutField = z.infer<typeof checkoutField>;
747
788
  type BillingAddress = z.infer<typeof billingAddress>;
748
789
  type StartInput = z.infer<typeof startInput>;
790
+ type ReviseInput = z.infer<typeof reviseInput>;
791
+ type RevisionResult = z.infer<typeof revisionResult>;
749
792
  type Cancellation = z.infer<typeof cancellation>;
750
793
  type Completion = z.infer<typeof completion>;
751
794
  type ExecutionResponse = z.infer<typeof execution>;
@@ -873,6 +916,7 @@ interface CheckoutClient<T extends Presentation = never> {
873
916
  complete(no: string, expectedRevision: number, idempotencyKey: string, signal?: AbortSignal): Promise<Completion>;
874
917
  }
875
918
  interface RegisteredCheckoutClient<T extends Presentation = never> extends CheckoutClient<T> {
919
+ revise(no: string, input: ReviseInput, idempotencyKey: string, signal?: AbortSignal): Promise<RevisionResult>;
876
920
  assertMethod(method: CheckoutMethod, execution: Execution<AirwallexPresentation | T>): void;
877
921
  }
878
922
  type ClientOptions = Omit<CheckoutClientOptions, "presentations">;
@@ -936,4 +980,4 @@ declare function billingAddressInput(fields: readonly PayerField[], values: Paye
936
980
  declare function supportsPayerFields(fields: CheckoutMethod["checkout_fields"]): boolean;
937
981
 
938
982
  export { CheckoutProtocolError, airwallexEnvironment, airwallexMethods, airwallexSession, assertExecutionMethod, billingAddressInput, collectPayerFields, createCheckoutClient, hasValidPayerValues, isCardholderNameValid, parsePresentation, supportsPayerFields };
939
- export type { AirwallexPresentation, BillingAddress, Cancellation, CheckoutClient, CheckoutClientOptions, CheckoutField, CheckoutMethod, Completion, Execution, PayerField, PayerValues, PaymentMethods, Presentation, PresentationContext, PresentationDecoder, ProtocolErrorCode, PurchaseOption, RegisteredCheckoutClient, SessionState, StartInput };
983
+ export type { AirwallexPresentation, BillingAddress, Cancellation, CheckoutClient, CheckoutClientOptions, CheckoutField, CheckoutMethod, Completion, Execution, PayerField, PayerValues, PaymentMethods, Presentation, PresentationContext, PresentationDecoder, ProtocolErrorCode, PurchaseOption, RegisteredCheckoutClient, ReviseInput, RevisionResult, SessionState, StartInput };
package/dist/index.mjs CHANGED
@@ -64,6 +64,7 @@ const session = z.object({
64
64
  revision,
65
65
  expires_at: z.string().datetime({ offset: true }),
66
66
  active_execution_no: nonblank.nullable(),
67
+ pricing_input: z.object({ currency, available_currencies: z.array(currency) }).optional(),
67
68
  purchase_options: z.array(purchaseOption),
68
69
  available_actions: z.array(z.enum(["list_payment_methods", "complete_without_payment"]))
69
70
  });
@@ -174,6 +175,8 @@ const completion = z.object({
174
175
  order_no: nonblank,
175
176
  fulfillment_status: nonblank
176
177
  });
178
+ const reviseInput = z.object({ currency, expected_revision: revision }).strict();
179
+ const revisionResult = z.object({ checkout_session_no: nonblank, revision, currency });
177
180
  const startInput = z.object({
178
181
  session_revision: revision,
179
182
  method_reference: nonblank,
@@ -359,6 +362,19 @@ function createCheckoutClient(options) {
359
362
  const raw = await transport.get(sessionPath(no) + "/payment-methods", { signal });
360
363
  return decode(methods, raw, "payment methods");
361
364
  },
365
+ async revise(no, input, idempotencyKey, signal) {
366
+ const body = decode(reviseInput, input, "revise session", "invalid_request");
367
+ const raw = await post(
368
+ sessionPath(no) + "/revisions",
369
+ body,
370
+ signal,
371
+ checkIdempotencyKey(idempotencyKey)
372
+ );
373
+ const updated = verifyScope(decode(revisionResult, raw, "session revision"), no);
374
+ if (updated.currency !== body.currency)
375
+ throw new CheckoutProtocolError("invalid_response", "revision currency");
376
+ return updated;
377
+ },
362
378
  async start(no, input, idempotencyKey, signal) {
363
379
  const body = decode(startInput, input, "start execution", "invalid_request");
364
380
  const raw = await post(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackonward/onex-checkout",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Browser-facing buyer checkout contracts for OneX integrations",
5
5
  "license": "MIT",
6
6
  "type": "module",