@infosoftas/s4-orders-js-sdk 0.1.21 → 0.2.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 (72) hide show
  1. package/.editorconfig +0 -0
  2. package/.release-it.json +0 -0
  3. package/README.md +572 -471
  4. package/build/postcss-scope-tailwind.cjs +0 -0
  5. package/components.json +0 -0
  6. package/package.json +62 -58
  7. package/src/App.completion.test.tsx +677 -0
  8. package/src/App.css +0 -14
  9. package/src/App.paymentReturn.test.tsx +341 -0
  10. package/src/App.tsx +722 -639
  11. package/src/ErrorBoundary.tsx +0 -0
  12. package/src/api/InvoiceApi.ts +0 -0
  13. package/src/api/OrdersApi.ts +74 -59
  14. package/src/api/SubscribeApi.ts +0 -0
  15. package/src/bundle.ts +0 -0
  16. package/src/components/Alert/Alert.tsx +0 -0
  17. package/src/components/Button/Button.tsx +0 -0
  18. package/src/components/EHFForm/EHFForm.tsx +250 -253
  19. package/src/components/FormFields/AddressField.tsx +0 -0
  20. package/src/components/FormFields/EmailField.tsx +0 -0
  21. package/src/components/FormFields/FormFields.helper.ts +0 -0
  22. package/src/components/FormFields/FormFieldsMapper.ts +0 -0
  23. package/src/components/FormFields/InputField.tsx +0 -0
  24. package/src/components/FormFields/NameField.tsx +0 -0
  25. package/src/components/FormFields/PhoneField.tsx +0 -0
  26. package/src/components/FormFields/TermsCheckbox.tsx +0 -0
  27. package/src/components/FormFields/ToggleFiled.tsx +0 -0
  28. package/src/components/FormFields/fieldValidators.ts +0 -0
  29. package/src/components/OIOForm/OIOForm.tsx +304 -307
  30. package/src/components/OrderDenialModal/OrderDenialModal.tsx +0 -0
  31. package/src/components/OrderForm/ContactDetailsSection.tsx +0 -0
  32. package/src/components/OrderForm/OrderForm.tsx +417 -420
  33. package/src/components/OrderForm/PaymentMethodContent.tsx +0 -0
  34. package/src/components/OrderForm/PaymentMethodSection.tsx +0 -0
  35. package/src/components/OrderForm/SubmitConfirmationDialog.tsx +0 -0
  36. package/src/components/OrderForm/orderFormState.ts +0 -0
  37. package/src/components/OrderForm/useSlotElement.tsx +0 -0
  38. package/src/components/ui/alert-dialog.tsx +0 -0
  39. package/src/components/ui/alert.tsx +0 -0
  40. package/src/components/ui/button.tsx +0 -0
  41. package/src/components/ui/card.tsx +0 -0
  42. package/src/components/ui/checkbox.tsx +0 -0
  43. package/src/components/ui/field.tsx +0 -0
  44. package/src/components/ui/input.tsx +0 -0
  45. package/src/components/ui/label.tsx +0 -0
  46. package/src/components/ui/radio-group.tsx +0 -0
  47. package/src/components/ui/separator.tsx +0 -0
  48. package/src/components/ui/skeleton.tsx +0 -0
  49. package/src/components/ui/spinner.tsx +0 -0
  50. package/src/components/ui/switch.tsx +0 -0
  51. package/src/components/ui/textarea.tsx +0 -0
  52. package/src/constants/index.ts +0 -0
  53. package/src/custom.d.ts +0 -0
  54. package/src/enums/api.ts +0 -0
  55. package/src/enums/general.ts +42 -40
  56. package/src/hooks/useOrderForm.tsx +400 -403
  57. package/src/hooks/usePaymentReturn.tsx +139 -0
  58. package/src/hooks/useQueryParams.ts +0 -0
  59. package/src/index.tsx +0 -0
  60. package/src/lib/utils.ts +0 -0
  61. package/src/types/api.ts +0 -0
  62. package/src/types/general.ts +153 -136
  63. package/src/types/order.ts +91 -70
  64. package/src/utils/fetcher.ts +131 -113
  65. package/src/utils/helper.ts +0 -0
  66. package/src/utils/order.helper.test.ts +81 -0
  67. package/src/utils/order.helper.ts +285 -272
  68. package/src/utils/waitForOrderCompletion.ts +125 -0
  69. package/tsconfig.json +39 -38
  70. package/src/components/MainIframe/MainIframe.tsx +0 -42
  71. package/src/hooks/useIframe.tsx +0 -59
  72. package/src/hooks/useMessageEvent.tsx +0 -194
@@ -0,0 +1,139 @@
1
+ import { useEffect, useRef } from 'react';
2
+
3
+ import { PaymentMethodEnum, PaymentReturnActionEnum } from '../enums/general';
4
+ import type { CompleteOrderParamsType, OrderInfoType } from '../types/order';
5
+ import useQueryParams from './useQueryParams';
6
+
7
+ const MOLLIE_ORDER_TTL_MS = 20 * 60 * 1000;
8
+
9
+ // Reads and consumes the persisted Mollie order id. The key is always removed:
10
+ // the return leg gets one chance to use it, whether or not it is still valid.
11
+ const takeStoredMollieOrderId = (): string | null => {
12
+ const raw = sessionStorage.getItem('mollieOrderId');
13
+ if (!raw) {
14
+ return null;
15
+ }
16
+
17
+ sessionStorage.removeItem('mollieOrderId');
18
+
19
+ try {
20
+ const { id, ts } = JSON.parse(raw) as { id: string; ts: number };
21
+
22
+ return Date.now() - ts <= MOLLIE_ORDER_TTL_MS ? id : null;
23
+ } catch {
24
+ return null;
25
+ }
26
+ };
27
+
28
+ // Temporary, remove in the next release: checkouts started on the previous
29
+ // version open SwedbankPay in an iframe, so the provider returns inside that
30
+ // frame. A framed SDK renders nothing and no longer notifies the parent, so
31
+ // hand the return to the top-level page, which then handles it once.
32
+ const breakOutOfLegacyPaymentFrame = (): boolean => {
33
+ if (!window.top || window.top === window) {
34
+ return false;
35
+ }
36
+ try {
37
+ if (window.top.location.origin !== window.location.origin) {
38
+ return false;
39
+ }
40
+ window.top.location.replace(window.location.href);
41
+ return true;
42
+ } catch {
43
+ return false;
44
+ }
45
+ };
46
+
47
+ const usePaymentReturn = (
48
+ onPaymentComplete: (data: CompleteOrderParamsType) => Promise<void>,
49
+ onPaymentCancel: (orderId?: string) => void,
50
+ orderInfo: OrderInfoType | null
51
+ ) => {
52
+ const queryParams = useQueryParams();
53
+ const isBreakingOut = useRef(false);
54
+ const hasPaymentReturn =
55
+ queryParams.get('action') === PaymentReturnActionEnum.COMPLETE ||
56
+ queryParams.get('action') === PaymentReturnActionEnum.CANCEL ||
57
+ (!!queryParams.get('orderId') && !!queryParams.get('agreementId'));
58
+
59
+ useEffect(() => {
60
+ if (hasPaymentReturn) {
61
+ isBreakingOut.current = breakOutOfLegacyPaymentFrame();
62
+ }
63
+ }, [hasPaymentReturn]);
64
+
65
+ // Vipps / MobilePay
66
+ useEffect(() => {
67
+ if (isBreakingOut.current) {
68
+ return;
69
+ }
70
+ if (queryParams.get('orderId') && queryParams.get('agreementId')) {
71
+ onPaymentComplete({
72
+ orderId: queryParams.get('orderId') || '',
73
+ agreementId: queryParams.get('agreementId') || '',
74
+ orderInfo: orderInfo || null,
75
+ paymentMethod: PaymentMethodEnum.Vipps,
76
+ });
77
+ }
78
+ }, [queryParams.get('orderId'), queryParams.get('agreementId')]);
79
+
80
+ // SwedbankPay completion, and cancellation for every redirect provider
81
+ useEffect(() => {
82
+ if (isBreakingOut.current) {
83
+ return;
84
+ }
85
+ if (
86
+ queryParams.get('S4OrderId') &&
87
+ queryParams.get('TransactionId') &&
88
+ queryParams.get('action') === PaymentReturnActionEnum.COMPLETE
89
+ ) {
90
+ onPaymentComplete({
91
+ orderId: queryParams.get('S4OrderId') || '',
92
+ agreementId: queryParams.get('TransactionId') || '',
93
+ orderInfo: orderInfo || null,
94
+ });
95
+ }
96
+
97
+ if (queryParams.get('action') === PaymentReturnActionEnum.CANCEL) {
98
+ const cancelOrderId =
99
+ queryParams.get('S4OrderId') || takeStoredMollieOrderId();
100
+ onPaymentCancel(cancelOrderId || undefined);
101
+ }
102
+ }, [
103
+ queryParams.get('action'),
104
+ queryParams.get('S4OrderId'),
105
+ queryParams.get('TransactionId'),
106
+ ]);
107
+
108
+ // Mollie: a completion return with no TransactionId (that one is SwedbankPay's).
109
+ useEffect(() => {
110
+ if (isBreakingOut.current) {
111
+ return;
112
+ }
113
+ if (
114
+ queryParams.get('action') !== PaymentReturnActionEnum.COMPLETE ||
115
+ queryParams.get('TransactionId')
116
+ ) {
117
+ return;
118
+ }
119
+
120
+ const s4OrderId = queryParams.get('S4OrderId');
121
+ const storedOrderId = takeStoredMollieOrderId();
122
+ const mollieOrderId = s4OrderId || storedOrderId;
123
+ if (!mollieOrderId) {
124
+ return;
125
+ }
126
+
127
+ onPaymentComplete({
128
+ orderId: mollieOrderId,
129
+ agreementId: '',
130
+ orderInfo: orderInfo || null,
131
+ });
132
+ }, [
133
+ queryParams.get('action'),
134
+ queryParams.get('S4OrderId'),
135
+ queryParams.get('TransactionId'),
136
+ ]);
137
+ };
138
+
139
+ export default usePaymentReturn;
File without changes
package/src/index.tsx CHANGED
File without changes
package/src/lib/utils.ts CHANGED
File without changes
package/src/types/api.ts CHANGED
File without changes
@@ -1,136 +1,153 @@
1
- import type { ReactNode } from 'react';
2
-
3
- import { PaymentMethodEnum, UserActionEnum } from '../enums/general';
4
- import type { OrderFormInputsType } from './order';
5
-
6
- declare global {
7
- interface Window {
8
- sdkOrderCallback: () => void;
9
- }
10
- }
11
-
12
- export type OrderFormFieldType = {
13
- name: string;
14
- required?: boolean;
15
- readOnly?: boolean;
16
- label?: string;
17
- };
18
-
19
- export type PaymentMethodSettingsType = {
20
- [key in PaymentMethodEnum]?: {
21
- generateSubscriberContact?: boolean;
22
- accountId?: string;
23
- orderFormFields?: OrderFormFieldType[];
24
- paymentInvoiceFields?: OrderFormFieldType[] | never[] | null;
25
- };
26
- };
27
-
28
- export type ContactRequestType = {
29
- addressLines?: Array<string> | undefined;
30
- name?: string;
31
- email?: string;
32
- phone?: string;
33
- country?: string;
34
- city?: string;
35
- zip?: string;
36
- careOf?: string;
37
- organizationNumber?: string;
38
- gln?: string;
39
- };
40
-
41
- export type OrderDenialFallbackOfferType = {
42
- title?: string;
43
- description?: string;
44
- price?: string;
45
- templatePackageId?: string;
46
- };
47
-
48
- export type PaymentIconType = {
49
- src: string;
50
- alt?: string;
51
- className?: string;
52
- };
53
-
54
- export type PaymentMethodOptionType = {
55
- label: string;
56
- value: PaymentMethodEnum;
57
- description?: string;
58
- icons?: PaymentIconType[];
59
- };
60
-
61
- export type SubmitConfirmationType = {
62
- title: string;
63
- description?: string;
64
- confirmText: string;
65
- cancelText: string;
66
- };
67
-
68
- export type ConfigType = {
69
- submitStartCallback?: (subscriberId: string) => void;
70
- userActionCallback?: (
71
- action: UserActionEnum,
72
- args: object | null | undefined
73
- ) => void;
74
- setContactCallback?: (contactInfo: ContactRequestType) => void;
75
- cancelVippsCallback?: () => void;
76
- domElementId: string;
77
- moduleTitle?: string;
78
- templatePackageId: string;
79
- subscriberId: string;
80
- userId: string;
81
- identityProviderId: string;
82
- organizationId: string;
83
- apiKey?: string;
84
- apiUrl?: string;
85
- redirectUrl?: string;
86
- showIframe?: boolean;
87
- availablePaymentMethods?: PaymentMethodOptionType[];
88
- allowedPaymentMethods?: PaymentMethodEnum[];
89
- paymentMethodsOptions?: PaymentMethodSettingsType;
90
- requireTermsAcceptance?: boolean;
91
- language?: string;
92
- merchantAgreementUrl?: string;
93
- invoiceAddressSelection?: {
94
- enabled?: boolean;
95
- label?: string;
96
- fields?: OrderFormFieldType[];
97
- };
98
- settings?: {
99
- successText?: string;
100
- failureText?: string;
101
- submitButtonText?: string;
102
- backButtonText?: string;
103
- verifyButtonText?: string;
104
- orderDenialCloseButtonText?: string;
105
- orderDenialContinueButtonText?: string;
106
- organizationNumberLabel?: string;
107
- cvrLabel?: string;
108
- glnLabel?: string;
109
- orderDefaultValues?: OrderFormInputsType;
110
- paymentMethodLabel?: string;
111
- contactDetailsLabel?: string;
112
- paymentMethodElementId?: string;
113
- contactDetailsElementId?: string;
114
- errorReqMsg?: string;
115
- errorInvalidEmailMsg?: string;
116
- errorInvalidPhoneMsg?: string;
117
- errorTermsMsg?: string;
118
- paymentMethodNotAllowedMsg?: string;
119
- invoiceLookupNotFoundText?: string;
120
- errorValidationTitleMsg?: string;
121
- errorValidationDenialOrderBlockingMsg?: string;
122
- errorValidationBlockingOffersMsg?: string;
123
- orderDenialOfferBaseText?: string;
124
- orderDenialOfferWithFallbackText?: string;
125
- orderDenialAmountText?: string;
126
- fetchDenialFallbackOffer?: (
127
- organizationId: string
128
- ) => Promise<OrderDenialFallbackOfferType | undefined>;
129
- termsAndConditionsText?: string | ReactNode;
130
- submitConfirmation?: SubmitConfirmationType;
131
- };
132
- };
133
-
134
- export type ErrorsMsg = {
135
- [key: string]: string[];
136
- };
1
+ import type { ReactNode } from 'react';
2
+
3
+ import { PaymentMethodEnum, UserActionEnum } from '../enums/general';
4
+ import type {
5
+ OrderCompletionEventType,
6
+ OrderCompletionDelayedEventType,
7
+ OrderCompletionFailedEventType,
8
+ OrderFormInputsType,
9
+ } from './order';
10
+
11
+ declare global {
12
+ interface Window {
13
+ sdkOrderCallback: () => void;
14
+ }
15
+ }
16
+
17
+ export type OrderFormFieldType = {
18
+ name: string;
19
+ required?: boolean;
20
+ readOnly?: boolean;
21
+ label?: string;
22
+ };
23
+
24
+ export type PaymentMethodSettingsType = {
25
+ [key in PaymentMethodEnum]?: {
26
+ generateSubscriberContact?: boolean;
27
+ accountId?: string;
28
+ orderFormFields?: OrderFormFieldType[];
29
+ paymentInvoiceFields?: OrderFormFieldType[] | never[] | null;
30
+ };
31
+ };
32
+
33
+ export type ContactRequestType = {
34
+ addressLines?: Array<string> | undefined;
35
+ name?: string;
36
+ email?: string;
37
+ phone?: string;
38
+ country?: string;
39
+ city?: string;
40
+ zip?: string;
41
+ careOf?: string;
42
+ organizationNumber?: string;
43
+ gln?: string;
44
+ };
45
+
46
+ export type OrderDenialFallbackOfferType = {
47
+ title?: string;
48
+ description?: string;
49
+ price?: string;
50
+ templatePackageId?: string;
51
+ };
52
+
53
+ export type PaymentIconType = {
54
+ src: string;
55
+ alt?: string;
56
+ className?: string;
57
+ };
58
+
59
+ export type PaymentMethodOptionType = {
60
+ label: string;
61
+ value: PaymentMethodEnum;
62
+ description?: string;
63
+ icons?: PaymentIconType[];
64
+ };
65
+
66
+ export type SubmitConfirmationType = {
67
+ title: string;
68
+ description?: string;
69
+ confirmText: string;
70
+ cancelText: string;
71
+ };
72
+
73
+ export type ConfigType = {
74
+ /** SDK polling is the default. External mode delegates confirmation to the host. */
75
+ completionMode?: 'sdk' | 'external';
76
+ orderAcceptedCallback?: (event: OrderCompletionEventType) => void;
77
+ orderCompletedCallback?: (event: OrderCompletionEventType) => void;
78
+ orderCompletionDelayedCallback?: (
79
+ event: OrderCompletionDelayedEventType
80
+ ) => void;
81
+ orderCompletionFailedCallback?: (
82
+ event: OrderCompletionFailedEventType
83
+ ) => void;
84
+ submitStartCallback?: (subscriberId: string) => void;
85
+ userActionCallback?: (
86
+ action: UserActionEnum,
87
+ args: object | null | undefined
88
+ ) => void;
89
+ setContactCallback?: (contactInfo: ContactRequestType) => void;
90
+ cancelVippsCallback?: () => void;
91
+ domElementId: string;
92
+ moduleTitle?: string;
93
+ templatePackageId: string;
94
+ subscriberId: string;
95
+ userId: string;
96
+ identityProviderId: string;
97
+ organizationId: string;
98
+ apiKey?: string;
99
+ apiUrl?: string;
100
+ redirectUrl?: string;
101
+ availablePaymentMethods?: PaymentMethodOptionType[];
102
+ allowedPaymentMethods?: PaymentMethodEnum[];
103
+ paymentMethodsOptions?: PaymentMethodSettingsType;
104
+ requireTermsAcceptance?: boolean;
105
+ language?: string;
106
+ merchantAgreementUrl?: string;
107
+ invoiceAddressSelection?: {
108
+ enabled?: boolean;
109
+ label?: string;
110
+ fields?: OrderFormFieldType[];
111
+ };
112
+ settings?: {
113
+ successText?: string;
114
+ orderProcessingText?: string;
115
+ orderReceivedText?: string;
116
+ orderDelayedText?: string;
117
+ failureText?: string;
118
+ submitButtonText?: string;
119
+ backButtonText?: string;
120
+ verifyButtonText?: string;
121
+ orderDenialCloseButtonText?: string;
122
+ orderDenialContinueButtonText?: string;
123
+ organizationNumberLabel?: string;
124
+ cvrLabel?: string;
125
+ glnLabel?: string;
126
+ orderDefaultValues?: OrderFormInputsType;
127
+ paymentMethodLabel?: string;
128
+ contactDetailsLabel?: string;
129
+ paymentMethodElementId?: string;
130
+ contactDetailsElementId?: string;
131
+ errorReqMsg?: string;
132
+ errorInvalidEmailMsg?: string;
133
+ errorInvalidPhoneMsg?: string;
134
+ errorTermsMsg?: string;
135
+ paymentMethodNotAllowedMsg?: string;
136
+ invoiceLookupNotFoundText?: string;
137
+ errorValidationTitleMsg?: string;
138
+ errorValidationDenialOrderBlockingMsg?: string;
139
+ errorValidationBlockingOffersMsg?: string;
140
+ orderDenialOfferBaseText?: string;
141
+ orderDenialOfferWithFallbackText?: string;
142
+ orderDenialAmountText?: string;
143
+ fetchDenialFallbackOffer?: (
144
+ organizationId: string
145
+ ) => Promise<OrderDenialFallbackOfferType | undefined>;
146
+ termsAndConditionsText?: string | ReactNode;
147
+ submitConfirmation?: SubmitConfirmationType;
148
+ };
149
+ };
150
+
151
+ export type ErrorsMsg = {
152
+ [key: string]: string[];
153
+ };
@@ -1,70 +1,91 @@
1
- import { PaymentMethodEnum } from '../enums/general';
2
-
3
- export type OrderFormInputsType = {
4
- name?: string;
5
- email?: string;
6
- phoneNumber?: string;
7
- paymentMethod?: PaymentMethodEnum;
8
- country?: string;
9
- city?: string;
10
- address?: string;
11
- zip?: string;
12
- careOf?: string;
13
- organizationNumber?: string;
14
- invoiceAddressSelection?: boolean;
15
- orderReference?: string;
16
- invoiceName?: string;
17
- invoiceEmail?: string;
18
- invoicePhoneNumber?: string;
19
- invoiceCountry?: string;
20
- invoiceCity?: string;
21
- invoiceAddress?: string;
22
- invoiceZip?: string;
23
- invoiceCareOf?: string;
24
- invoiceBuyerReference?: string;
25
- gln?: string;
26
- cvr?: string;
27
- termsAccept?: boolean;
28
- };
29
-
30
- export type VippsMobilePay = {
31
- phoneNumber?: string;
32
- merchantRedirectUrl: string;
33
- merchantAgreementUrl: string;
34
- generateSubscriberContact?: boolean;
35
- accountId?: string;
36
- };
37
-
38
- export type SwedbankPay = {
39
- accountId?: string;
40
- completeUrl: string;
41
- cancelUrl: string;
42
- language?: string;
43
- };
44
-
45
- export type Mollie = {
46
- accountId?: string;
47
- returnUrl: string;
48
- cancelUrl?: string;
49
- language?: string;
50
- };
51
-
52
- export type AgreementsType = {
53
- paymentProvider: PaymentMethodEnum;
54
- vippsMobilePay?: VippsMobilePay;
55
- swedbankPay?: SwedbankPay;
56
- mollie?: Mollie;
57
- };
58
-
59
- export type OrderInfoType = {
60
- subscriberId: string;
61
- paymentMethod: string;
62
- orderId: string;
63
- };
64
-
65
- export type CompleteOrderParamsType = {
66
- orderId: string;
67
- agreementId: string;
68
- orderInfo: OrderInfoType | null;
69
- paymentMethod?: PaymentMethodEnum | null;
70
- };
1
+ import { PaymentMethodEnum } from '../enums/general';
2
+
3
+ export type OrderFormInputsType = {
4
+ name?: string;
5
+ email?: string;
6
+ phoneNumber?: string;
7
+ paymentMethod?: PaymentMethodEnum;
8
+ country?: string;
9
+ city?: string;
10
+ address?: string;
11
+ zip?: string;
12
+ careOf?: string;
13
+ organizationNumber?: string;
14
+ invoiceAddressSelection?: boolean;
15
+ orderReference?: string;
16
+ invoiceName?: string;
17
+ invoiceEmail?: string;
18
+ invoicePhoneNumber?: string;
19
+ invoiceCountry?: string;
20
+ invoiceCity?: string;
21
+ invoiceAddress?: string;
22
+ invoiceZip?: string;
23
+ invoiceCareOf?: string;
24
+ invoiceBuyerReference?: string;
25
+ gln?: string;
26
+ cvr?: string;
27
+ termsAccept?: boolean;
28
+ };
29
+
30
+ export type VippsMobilePay = {
31
+ phoneNumber?: string;
32
+ merchantRedirectUrl: string;
33
+ merchantAgreementUrl: string;
34
+ generateSubscriberContact?: boolean;
35
+ accountId?: string;
36
+ };
37
+
38
+ export type SwedbankPay = {
39
+ accountId?: string;
40
+ completeUrl: string;
41
+ cancelUrl: string;
42
+ language?: string;
43
+ };
44
+
45
+ export type Mollie = {
46
+ accountId?: string;
47
+ returnUrl: string;
48
+ cancelUrl?: string;
49
+ language?: string;
50
+ };
51
+
52
+ export type AgreementsType = {
53
+ paymentProvider: PaymentMethodEnum;
54
+ vippsMobilePay?: VippsMobilePay;
55
+ swedbankPay?: SwedbankPay;
56
+ mollie?: Mollie;
57
+ };
58
+
59
+ export type OrderInfoType = {
60
+ subscriberId: string;
61
+ paymentMethod: string;
62
+ orderId: string;
63
+ };
64
+
65
+ export type OrderStatusResponseType = {
66
+ id: string;
67
+ status: string;
68
+ orderCreated?: string | null;
69
+ orderCompleted?: string | null;
70
+ orderCancelled?: string | null;
71
+ };
72
+
73
+ export type OrderCompletionEventType = {
74
+ orderId: string;
75
+ orderInfo: OrderInfoType | null;
76
+ };
77
+
78
+ export type OrderCompletionDelayedEventType = OrderCompletionEventType & {
79
+ reason: 'timeout' | 'statusUnavailable';
80
+ };
81
+
82
+ export type OrderCompletionFailedEventType = OrderCompletionEventType & {
83
+ status: 'Cancelled' | 'Rejected';
84
+ };
85
+
86
+ export type CompleteOrderParamsType = {
87
+ orderId: string;
88
+ agreementId: string;
89
+ orderInfo: OrderInfoType | null;
90
+ paymentMethod?: PaymentMethodEnum | null;
91
+ };