@infosoftas/s4-orders-js-sdk 0.1.21 → 0.2.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/.editorconfig +8 -8
- package/.release-it.json +10 -10
- package/README.md +565 -471
- package/package.json +62 -58
- package/src/App.completion.test.tsx +738 -0
- package/src/App.tsx +753 -639
- package/src/ErrorBoundary.tsx +41 -41
- package/src/api/InvoiceApi.ts +23 -23
- package/src/api/OrdersApi.ts +74 -59
- package/src/api/SubscribeApi.ts +18 -18
- package/src/bundle.ts +4 -4
- package/src/components/Alert/Alert.tsx +23 -23
- package/src/components/Button/Button.tsx +39 -39
- package/src/components/EHFForm/EHFForm.tsx +253 -253
- package/src/components/FormFields/AddressField.tsx +55 -55
- package/src/components/FormFields/EmailField.tsx +53 -53
- package/src/components/FormFields/FormFields.helper.ts +34 -34
- package/src/components/FormFields/FormFieldsMapper.ts +34 -34
- package/src/components/FormFields/InputField.tsx +52 -52
- package/src/components/FormFields/NameField.tsx +52 -52
- package/src/components/FormFields/PhoneField.tsx +53 -53
- package/src/components/FormFields/TermsCheckbox.tsx +70 -70
- package/src/components/FormFields/ToggleFiled.tsx +52 -52
- package/src/components/FormFields/fieldValidators.ts +71 -71
- package/src/components/MainIframe/MainIframe.tsx +42 -42
- package/src/components/OIOForm/OIOForm.tsx +307 -307
- package/src/components/OrderDenialModal/OrderDenialModal.tsx +102 -102
- package/src/components/OrderForm/ContactDetailsSection.tsx +71 -71
- package/src/components/OrderForm/OrderForm.tsx +420 -420
- package/src/components/OrderForm/PaymentMethodContent.tsx +62 -62
- package/src/components/OrderForm/PaymentMethodSection.tsx +79 -79
- package/src/components/OrderForm/SubmitConfirmationDialog.tsx +55 -55
- package/src/components/OrderForm/orderFormState.ts +171 -171
- package/src/components/OrderForm/useSlotElement.tsx +89 -89
- package/src/constants/index.ts +13 -13
- package/src/enums/api.ts +5 -5
- package/src/enums/general.ts +40 -40
- package/src/hooks/useIframe.tsx +59 -59
- package/src/hooks/useMessageEvent.tsx +194 -194
- package/src/hooks/useOrderForm.tsx +403 -403
- package/src/hooks/useQueryParams.ts +5 -5
- package/src/index.tsx +30 -30
- package/src/lib/utils.ts +1 -1
- package/src/types/api.ts +28 -28
- package/src/types/general.ts +154 -136
- package/src/types/order.ts +91 -70
- package/src/utils/fetcher.ts +131 -113
- package/src/utils/helper.ts +78 -78
- package/src/utils/order.helper.ts +272 -272
- package/src/utils/waitForOrderCompletion.ts +125 -0
- package/tsconfig.json +38 -38
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function useQueryParams(): URLSearchParams {
|
|
2
|
-
return new URLSearchParams(location.search);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export default useQueryParams;
|
|
1
|
+
function useQueryParams(): URLSearchParams {
|
|
2
|
+
return new URLSearchParams(location.search);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export default useQueryParams;
|
package/src/index.tsx
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { createRoot, type Root } from 'react-dom/client';
|
|
2
|
-
import { createElement } from 'react';
|
|
3
|
-
|
|
4
|
-
import type { ConfigType } from './types/general';
|
|
5
|
-
import { createSubscriber } from './api/SubscribeApi';
|
|
6
|
-
import App from './App';
|
|
7
|
-
|
|
8
|
-
export const orderComponent = {
|
|
9
|
-
root: null as Root | null,
|
|
10
|
-
init: function (config: ConfigType) {
|
|
11
|
-
if (!config.apiKey) {
|
|
12
|
-
console.error('"apiKey" should be set');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (!config.apiUrl) {
|
|
16
|
-
console.error('"apiUrl" should be set');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const domNode = document.getElementById(config.domElementId);
|
|
20
|
-
orderComponent.root = createRoot(
|
|
21
|
-
domNode || document.createElement('div')
|
|
22
|
-
);
|
|
23
|
-
const reactElement = createElement(App, config);
|
|
24
|
-
orderComponent.root.render(reactElement);
|
|
25
|
-
},
|
|
26
|
-
remove: function () {
|
|
27
|
-
(orderComponent.root as Root)?.unmount();
|
|
28
|
-
},
|
|
29
|
-
createSubscriber,
|
|
30
|
-
};
|
|
1
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { ConfigType } from './types/general';
|
|
5
|
+
import { createSubscriber } from './api/SubscribeApi';
|
|
6
|
+
import App from './App';
|
|
7
|
+
|
|
8
|
+
export const orderComponent = {
|
|
9
|
+
root: null as Root | null,
|
|
10
|
+
init: function (config: ConfigType) {
|
|
11
|
+
if (!config.apiKey) {
|
|
12
|
+
console.error('"apiKey" should be set');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!config.apiUrl) {
|
|
16
|
+
console.error('"apiUrl" should be set');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const domNode = document.getElementById(config.domElementId);
|
|
20
|
+
orderComponent.root = createRoot(
|
|
21
|
+
domNode || document.createElement('div')
|
|
22
|
+
);
|
|
23
|
+
const reactElement = createElement(App, config);
|
|
24
|
+
orderComponent.root.render(reactElement);
|
|
25
|
+
},
|
|
26
|
+
remove: function () {
|
|
27
|
+
(orderComponent.root as Root)?.unmount();
|
|
28
|
+
},
|
|
29
|
+
createSubscriber,
|
|
30
|
+
};
|
package/src/lib/utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cn } from 'cn';
|
|
1
|
+
export { cn } from 'cn';
|
package/src/types/api.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { HttpStatusCode } from '../enums/api';
|
|
2
|
-
|
|
3
|
-
export interface ApiResponseType<T> {
|
|
4
|
-
status: HttpStatusCode;
|
|
5
|
-
text: string;
|
|
6
|
-
error: string;
|
|
7
|
-
code: HttpStatusCode;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
data: T;
|
|
10
|
-
query: string;
|
|
11
|
-
url: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type CreateSubscriberRequestType = {
|
|
15
|
-
name?: string;
|
|
16
|
-
email?: string;
|
|
17
|
-
phone?: string;
|
|
18
|
-
country?: string;
|
|
19
|
-
city?: string;
|
|
20
|
-
addressLines?: string[];
|
|
21
|
-
zip?: string;
|
|
22
|
-
careOf?: string;
|
|
23
|
-
buyerReference?: string;
|
|
24
|
-
gln?: string;
|
|
25
|
-
organizationNumber?: string;
|
|
26
|
-
identityProviderId?: string;
|
|
27
|
-
userId?: string;
|
|
28
|
-
};
|
|
1
|
+
import { HttpStatusCode } from '../enums/api';
|
|
2
|
+
|
|
3
|
+
export interface ApiResponseType<T> {
|
|
4
|
+
status: HttpStatusCode;
|
|
5
|
+
text: string;
|
|
6
|
+
error: string;
|
|
7
|
+
code: HttpStatusCode;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
data: T;
|
|
10
|
+
query: string;
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type CreateSubscriberRequestType = {
|
|
15
|
+
name?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
country?: string;
|
|
19
|
+
city?: string;
|
|
20
|
+
addressLines?: string[];
|
|
21
|
+
zip?: string;
|
|
22
|
+
careOf?: string;
|
|
23
|
+
buyerReference?: string;
|
|
24
|
+
gln?: string;
|
|
25
|
+
organizationNumber?: string;
|
|
26
|
+
identityProviderId?: string;
|
|
27
|
+
userId?: string;
|
|
28
|
+
};
|
package/src/types/general.ts
CHANGED
|
@@ -1,136 +1,154 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { PaymentMethodEnum, UserActionEnum } from '../enums/general';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
+
showIframe?: boolean;
|
|
102
|
+
availablePaymentMethods?: PaymentMethodOptionType[];
|
|
103
|
+
allowedPaymentMethods?: PaymentMethodEnum[];
|
|
104
|
+
paymentMethodsOptions?: PaymentMethodSettingsType;
|
|
105
|
+
requireTermsAcceptance?: boolean;
|
|
106
|
+
language?: string;
|
|
107
|
+
merchantAgreementUrl?: string;
|
|
108
|
+
invoiceAddressSelection?: {
|
|
109
|
+
enabled?: boolean;
|
|
110
|
+
label?: string;
|
|
111
|
+
fields?: OrderFormFieldType[];
|
|
112
|
+
};
|
|
113
|
+
settings?: {
|
|
114
|
+
successText?: string;
|
|
115
|
+
orderProcessingText?: string;
|
|
116
|
+
orderReceivedText?: string;
|
|
117
|
+
orderDelayedText?: string;
|
|
118
|
+
failureText?: string;
|
|
119
|
+
submitButtonText?: string;
|
|
120
|
+
backButtonText?: string;
|
|
121
|
+
verifyButtonText?: string;
|
|
122
|
+
orderDenialCloseButtonText?: string;
|
|
123
|
+
orderDenialContinueButtonText?: string;
|
|
124
|
+
organizationNumberLabel?: string;
|
|
125
|
+
cvrLabel?: string;
|
|
126
|
+
glnLabel?: string;
|
|
127
|
+
orderDefaultValues?: OrderFormInputsType;
|
|
128
|
+
paymentMethodLabel?: string;
|
|
129
|
+
contactDetailsLabel?: string;
|
|
130
|
+
paymentMethodElementId?: string;
|
|
131
|
+
contactDetailsElementId?: string;
|
|
132
|
+
errorReqMsg?: string;
|
|
133
|
+
errorInvalidEmailMsg?: string;
|
|
134
|
+
errorInvalidPhoneMsg?: string;
|
|
135
|
+
errorTermsMsg?: string;
|
|
136
|
+
paymentMethodNotAllowedMsg?: string;
|
|
137
|
+
invoiceLookupNotFoundText?: string;
|
|
138
|
+
errorValidationTitleMsg?: string;
|
|
139
|
+
errorValidationDenialOrderBlockingMsg?: string;
|
|
140
|
+
errorValidationBlockingOffersMsg?: string;
|
|
141
|
+
orderDenialOfferBaseText?: string;
|
|
142
|
+
orderDenialOfferWithFallbackText?: string;
|
|
143
|
+
orderDenialAmountText?: string;
|
|
144
|
+
fetchDenialFallbackOffer?: (
|
|
145
|
+
organizationId: string
|
|
146
|
+
) => Promise<OrderDenialFallbackOfferType | undefined>;
|
|
147
|
+
termsAndConditionsText?: string | ReactNode;
|
|
148
|
+
submitConfirmation?: SubmitConfirmationType;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export type ErrorsMsg = {
|
|
153
|
+
[key: string]: string[];
|
|
154
|
+
};
|
package/src/types/order.ts
CHANGED
|
@@ -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
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
+
};
|