@rebilly/instruments 4.5.0 → 4.6.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/.babelrc +24 -26
- package/CHANGELOG.md +7 -0
- package/dist/index.js +8 -8
- package/dist/index.min.js +8 -8
- package/package.json +14 -3
- package/project.json +9 -0
- package/rollup.config.mjs +21 -26
- package/src/data/options-schema/index.js +94 -78
- package/src/data/options-schema/schemas/options-schema.js +419 -411
- package/src/events/base-event.js +34 -34
- package/src/events/events.spec.js +6 -6
- package/src/events/index.js +5 -5
- package/src/functions/destroy.js +19 -19
- package/src/functions/destroy.spec.js +41 -41
- package/src/functions/mount/fetch-data.js +200 -193
- package/src/functions/mount/fetch-data.spec.js +287 -285
- package/src/functions/mount/get-lead-source-data.js +31 -31
- package/src/functions/mount/get-lead-source-data.spec.js +19 -19
- package/src/functions/mount/index.js +73 -65
- package/src/functions/mount/mount.spec.js +77 -66
- package/src/functions/mount/setup-element.js +23 -23
- package/src/functions/mount/setup-framepay-theme.js +86 -68
- package/src/functions/mount/setup-framepay.js +9 -5
- package/src/functions/mount/setup-i18n.js +15 -15
- package/src/functions/mount/setup-options.js +74 -74
- package/src/functions/mount/setup-options.spec.js +323 -287
- package/src/functions/mount/setup-storefront.js +15 -20
- package/src/functions/mount/setup-styles-vars.js +19 -22
- package/src/functions/mount/setup-user-flow.js +51 -47
- package/src/functions/on.js +5 -5
- package/src/functions/on.spec.js +60 -51
- package/src/functions/purchase.js +151 -146
- package/src/functions/purchase.spec.js +59 -56
- package/src/functions/setup.js +53 -53
- package/src/functions/setup.spec.js +88 -75
- package/src/functions/show.js +13 -14
- package/src/functions/show.spec.js +53 -53
- package/src/functions/update.js +30 -28
- package/src/functions/update.spec.js +94 -93
- package/src/i18n/en.json +32 -32
- package/src/i18n/es.json +29 -29
- package/src/i18n/i18n.spec.js +18 -18
- package/src/i18n/index.js +48 -48
- package/src/instance.js +36 -36
- package/src/instance.spec.js +29 -27
- package/src/loader/index.js +95 -70
- package/src/loader/loader.spec.js +63 -63
- package/src/state/iframes.js +21 -21
- package/src/state/index.js +56 -54
- package/src/storefront/account-and-website.js +10 -8
- package/src/storefront/account-and-website.spec.js +55 -55
- package/src/storefront/deposit-requests.js +6 -6
- package/src/storefront/fetch-plans-from-addons-bumpOffer.js +21 -19
- package/src/storefront/fetch-products-from-plans.js +52 -51
- package/src/storefront/fetch-products-from-plans.spec.js +90 -87
- package/src/storefront/index.js +56 -49
- package/src/storefront/invoices.js +15 -15
- package/src/storefront/invoices.spec.js +69 -65
- package/src/storefront/models/account-model.js +29 -32
- package/src/storefront/models/base-model.js +6 -9
- package/src/storefront/models/deposit-request-model.js +22 -13
- package/src/storefront/models/invoice-model.js +16 -16
- package/src/storefront/models/payment-metadata.js +4 -4
- package/src/storefront/models/plan-model.js +73 -64
- package/src/storefront/models/ready-to-pay-model.js +59 -59
- package/src/storefront/models/summary-model.js +43 -46
- package/src/storefront/models/transaction-model.js +11 -14
- package/src/storefront/payment-instruments.js +38 -35
- package/src/storefront/payment-instruments.spec.js +81 -62
- package/src/storefront/purchase.js +50 -44
- package/src/storefront/purchase.spec.js +40 -40
- package/src/storefront/ready-to-pay.js +75 -77
- package/src/storefront/ready-to-pay.spec.js +59 -54
- package/src/storefront/storefront.spec.js +9 -9
- package/src/storefront/summary.js +93 -67
- package/src/storefront/summary.spec.js +108 -106
- package/src/storefront/transactions.js +6 -6
- package/src/style/base/default-theme.js +928 -923
- package/src/style/base/theme.js +21 -21
- package/src/style/base/theme.spec.js +13 -13
- package/src/style/index.js +3 -3
- package/src/style/utils/border.js +40 -27
- package/src/style/utils/color-values.js +18 -18
- package/src/style/utils/minifyCss.js +6 -6
- package/src/utils/add-dom-element.js +14 -14
- package/src/utils/format-currency.js +6 -5
- package/src/utils/has-valid-css-selector.js +2 -2
- package/src/utils/index.js +6 -6
- package/src/utils/is-dom-element.js +1 -1
- package/src/utils/process-property-as-dom-element.js +22 -22
- package/src/utils/quantity.js +26 -28
- package/src/utils/sleep.js +3 -1
- package/src/views/amount-selector.js +37 -36
- package/src/views/common/iframe/base-iframe.js +53 -52
- package/src/views/common/iframe/events/change-iframe-src-handler.js +5 -5
- package/src/views/common/iframe/events/dispatch-event-handler.js +4 -4
- package/src/views/common/iframe/events/resize-component-handler.js +8 -8
- package/src/views/common/iframe/events/show-error-handler.js +2 -2
- package/src/views/common/iframe/events/stop-loader-handler.js +8 -8
- package/src/views/common/iframe/events/update-addons-handler.js +20 -13
- package/src/views/common/iframe/events/update-coupons-handler.js +9 -9
- package/src/views/common/iframe/events/update-items-handler.js +26 -22
- package/src/views/common/iframe/modal-iframe.js +67 -56
- package/src/views/common/iframe/view-iframe.js +11 -11
- package/src/views/common/render-utilities.js +2 -2
- package/src/views/confirmation.js +33 -30
- package/src/views/errors.js +89 -79
- package/src/views/form.js +41 -37
- package/src/views/method-selector/express-methods.js +46 -46
- package/src/views/method-selector/generate-digital-wallet.js +46 -45
- package/src/views/method-selector/generate-digital-wallet.spec.js +104 -102
- package/src/views/method-selector/generate-framepay-config.js +53 -51
- package/src/views/method-selector/generate-framepay-config.spec.js +197 -173
- package/src/views/method-selector/get-method-data.js +5 -6
- package/src/views/method-selector/get-payment-methods.js +18 -16
- package/src/views/method-selector/get-payment-methods.spec.js +29 -27
- package/src/views/method-selector/index.js +154 -139
- package/src/views/method-selector/method-selector.spec.js +13 -13
- package/src/views/method-selector/mount-bump-offer.js +65 -49
- package/src/views/method-selector/mount-express-methods.js +89 -85
- package/src/views/modal.js +74 -67
- package/src/views/result.js +14 -14
- package/src/views/summary.js +25 -26
- package/tests/async-utilities.js +13 -13
- package/tests/mocks/framepay-mock.js +9 -8
- package/tests/mocks/rebilly-api-mock.js +5 -3
- package/tests/mocks/rebilly-instruments-mock.js +121 -117
- package/tests/mocks/storefront-api-mock.js +55 -48
- package/tests/mocks/storefront-mock.js +10 -14
- package/tests/msw/server.js +6 -6
- package/tests/setup-test.js +14 -16
- package/vitest.config.js +14 -14
- package/.eslintrc.js +0 -34
- package/.prettierrc.js +0 -11
|
@@ -1,192 +1,216 @@
|
|
|
1
|
-
import {generateFramepayConfig} from './generate-framepay-config';
|
|
1
|
+
import { generateFramepayConfig } from './generate-framepay-config';
|
|
2
2
|
import state from '@/state';
|
|
3
3
|
|
|
4
4
|
describe('Generate FramePay Config', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('should generate default config', () => {
|
|
18
|
-
const config = generateFramepayConfig({
|
|
19
|
-
state,
|
|
20
|
-
methodIds: []
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
state.options = {
|
|
7
|
+
themeFramepay: {},
|
|
8
|
+
locale: 'en-CA',
|
|
9
|
+
organizationId: 'test-organization-id',
|
|
10
|
+
websiteId: 'test-website-id',
|
|
11
|
+
};
|
|
12
|
+
state.data = {
|
|
13
|
+
readyToPay: [],
|
|
14
|
+
};
|
|
21
15
|
});
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
it('should generate default config', () => {
|
|
18
|
+
const config = generateFramepayConfig({
|
|
19
|
+
state,
|
|
20
|
+
methodIds: [],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const { options, data } = state;
|
|
24
|
+
|
|
25
|
+
expect(config).toEqual(
|
|
26
|
+
expect.objectContaining({
|
|
27
|
+
style: options.themeFramepay,
|
|
28
|
+
locale: options.locale,
|
|
29
|
+
organizationId: options.organizationId,
|
|
30
|
+
websiteId: options.websiteId,
|
|
31
|
+
methods: data.readyToPay,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
40
34
|
});
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}));
|
|
45
|
-
});
|
|
36
|
+
it('should add publishableKey', () => {
|
|
37
|
+
state.options.publishableKey = 'test-publishable-key';
|
|
46
38
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
const config = generateFramepayConfig({
|
|
40
|
+
state,
|
|
41
|
+
methodIds: [],
|
|
42
|
+
});
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
expect(config).toEqual(
|
|
45
|
+
expect.objectContaining({
|
|
46
|
+
publishableKey: state.options.publishableKey,
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
54
49
|
});
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const config = generateFramepayConfig({
|
|
74
|
-
state,
|
|
75
|
-
methodIds: ['pay-pal-billing-agreement']
|
|
51
|
+
it('should add jwt', () => {
|
|
52
|
+
state.options.jwt = 'test-jwt';
|
|
53
|
+
state.options.apiMode = 'sandbox';
|
|
54
|
+
|
|
55
|
+
const config = generateFramepayConfig({
|
|
56
|
+
state,
|
|
57
|
+
methodIds: [],
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(config).toEqual(
|
|
61
|
+
expect.objectContaining({
|
|
62
|
+
jwt: state.options.jwt,
|
|
63
|
+
sandbox: true,
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
76
66
|
});
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
68
|
+
it('should add configurations for PayPal', () => {
|
|
69
|
+
state.data.amountAndCurrency = {
|
|
70
|
+
amount: 10,
|
|
71
|
+
currency: 'CAD',
|
|
72
|
+
};
|
|
73
|
+
state.options.paymentInstruments = {
|
|
74
|
+
paypal: {
|
|
75
|
+
test: 'key',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const config = generateFramepayConfig({
|
|
80
|
+
state,
|
|
81
|
+
methodIds: ['pay-pal-billing-agreement'],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(config).toEqual(
|
|
85
|
+
expect.objectContaining({
|
|
86
|
+
transactionData: expect.objectContaining(
|
|
87
|
+
state.data.amountAndCurrency,
|
|
88
|
+
),
|
|
89
|
+
paypal: state.options.paymentInstruments.paypal,
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
101
92
|
});
|
|
102
93
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
94
|
+
it('should add configurations for Google Pay', () => {
|
|
95
|
+
state.options.digitalWallet = {
|
|
96
|
+
googlePay: {
|
|
97
|
+
transactionData: {
|
|
98
|
+
test: 'key',
|
|
99
|
+
},
|
|
100
|
+
googlePayDisplayOptions: {
|
|
101
|
+
test: 'key',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const config = generateFramepayConfig({
|
|
107
|
+
state,
|
|
108
|
+
methodIds: ['google-pay'],
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(config).toEqual(
|
|
112
|
+
expect.objectContaining({
|
|
113
|
+
transactionData: expect.objectContaining(
|
|
114
|
+
state.options.digitalWallet.googlePay.transactionData,
|
|
115
|
+
),
|
|
116
|
+
googlePay:
|
|
117
|
+
state.options.digitalWallet.googlePay
|
|
118
|
+
.googlePayDisplayOptions,
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
126
121
|
});
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
applePay: {
|
|
156
|
-
transactionData: {
|
|
157
|
-
test: 'key'
|
|
158
|
-
},
|
|
159
|
-
applePayDisplayOptions: {
|
|
160
|
-
test: 'key'
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const config = generateFramepayConfig({
|
|
167
|
-
state,
|
|
168
|
-
methodIds: ['pay-pal-billing-agreement', 'google-pay', 'apple-pay']
|
|
123
|
+
it('should add configurations for Apple Pay', () => {
|
|
124
|
+
state.options.digitalWallet = {
|
|
125
|
+
applePay: {
|
|
126
|
+
transactionData: {
|
|
127
|
+
test: 'key',
|
|
128
|
+
},
|
|
129
|
+
applePayDisplayOptions: {
|
|
130
|
+
test: 'key',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const config = generateFramepayConfig({
|
|
136
|
+
state,
|
|
137
|
+
methodIds: ['apple-pay'],
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
expect(config).toEqual(
|
|
141
|
+
expect.objectContaining({
|
|
142
|
+
transactionData: expect.objectContaining(
|
|
143
|
+
state.options.digitalWallet.applePay.transactionData,
|
|
144
|
+
),
|
|
145
|
+
applePay:
|
|
146
|
+
state.options.digitalWallet.applePay.applePayDisplayOptions,
|
|
147
|
+
}),
|
|
148
|
+
);
|
|
169
149
|
});
|
|
170
150
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
151
|
+
it('should add all instrument methods together', () => {
|
|
152
|
+
state.data.amountAndCurrency = {
|
|
153
|
+
test: 'key',
|
|
154
|
+
};
|
|
155
|
+
state.options = {
|
|
156
|
+
paymentInstruments: {
|
|
157
|
+
paypal: {
|
|
158
|
+
test: 'key',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
digitalWallet: {
|
|
162
|
+
googlePay: {
|
|
163
|
+
transactionData: {
|
|
164
|
+
test: 'key',
|
|
165
|
+
},
|
|
166
|
+
googlePayDisplayOptions: {
|
|
167
|
+
test: 'key',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
applePay: {
|
|
171
|
+
transactionData: {
|
|
172
|
+
test: 'key',
|
|
173
|
+
},
|
|
174
|
+
applePayDisplayOptions: {
|
|
175
|
+
test: 'key',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const config = generateFramepayConfig({
|
|
182
|
+
state,
|
|
183
|
+
methodIds: ['pay-pal-billing-agreement', 'google-pay', 'apple-pay'],
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
expect(config).toEqual(
|
|
187
|
+
expect.objectContaining({
|
|
188
|
+
transactionData: expect.objectContaining(
|
|
189
|
+
state.data.amountAndCurrency,
|
|
190
|
+
),
|
|
191
|
+
paypal: state.options.paymentInstruments.paypal,
|
|
192
|
+
}),
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
expect(config).toEqual(
|
|
196
|
+
expect.objectContaining({
|
|
197
|
+
transactionData: expect.objectContaining(
|
|
198
|
+
state.options.digitalWallet.googlePay.transactionData,
|
|
199
|
+
),
|
|
200
|
+
googlePay:
|
|
201
|
+
state.options.digitalWallet.googlePay
|
|
202
|
+
.googlePayDisplayOptions,
|
|
203
|
+
}),
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
expect(config).toEqual(
|
|
207
|
+
expect.objectContaining({
|
|
208
|
+
transactionData: expect.objectContaining(
|
|
209
|
+
state.options.digitalWallet.applePay.transactionData,
|
|
210
|
+
),
|
|
211
|
+
applePay:
|
|
212
|
+
state.options.digitalWallet.applePay.applePayDisplayOptions,
|
|
213
|
+
}),
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
@@ -2,11 +2,10 @@ import kebabCase from 'lodash.kebabcase';
|
|
|
2
2
|
import camelCase from 'lodash.camelcase';
|
|
3
3
|
|
|
4
4
|
export const getMethodData = (method) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
''
|
|
9
|
-
);
|
|
5
|
+
const METHOD_ID = kebabCase(method.feature?.name || method.method);
|
|
6
|
+
const METHOD_TYPE = camelCase(
|
|
7
|
+
method.feature?.name || method.method,
|
|
8
|
+
).replace('-', '');
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
return { METHOD_ID, METHOD_TYPE };
|
|
12
11
|
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import state from '../../state';
|
|
2
2
|
|
|
3
3
|
export function getPaymentMethods() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const result = {
|
|
5
|
+
expressMethods: [],
|
|
6
|
+
methods: [],
|
|
7
|
+
};
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
state.data.readyToPay?.forEach((method) => {
|
|
10
|
+
if (method.metadata.isExpressMethod) {
|
|
11
|
+
result.expressMethods.push(method);
|
|
12
|
+
} else {
|
|
13
|
+
result.methods.push(method);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (!window.ApplePaySession) {
|
|
18
|
+
result.expressMethods = result.expressMethods.filter(
|
|
19
|
+
(method) => method?.feature?.name !== 'Apple Pay',
|
|
20
|
+
);
|
|
21
|
+
state.loader.stopLoading({ id: 'applePay-express' });
|
|
22
|
+
}
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
return result;
|
|
23
25
|
}
|
|
@@ -7,33 +7,35 @@ import { fetchReadyToPay } from '@/storefront/ready-to-pay';
|
|
|
7
7
|
import state from '@/state';
|
|
8
8
|
|
|
9
9
|
it('should only return the allowed methods', async () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
StorefontTestingInstance();
|
|
11
|
+
when(post(`${storefrontURL}/ready-to-pay`)).thenReturn(
|
|
12
|
+
ok([
|
|
13
|
+
{
|
|
14
|
+
method: 'payment-card',
|
|
15
|
+
feature: {
|
|
16
|
+
name: 'Google Pay',
|
|
17
|
+
merchantName: 'google-pay-merchant-name',
|
|
18
|
+
merchantOrigin: 'google-pay-merchant-origin',
|
|
19
|
+
},
|
|
20
|
+
brands: ['Visa'],
|
|
21
|
+
filters: [],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
method: 'fake-method',
|
|
25
|
+
filters: [],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
method: 'payment-card',
|
|
29
|
+
brands: ['Visa'],
|
|
30
|
+
filters: [],
|
|
31
|
+
},
|
|
32
|
+
]),
|
|
33
|
+
);
|
|
34
|
+
state.data.readyToPay = await fetchReadyToPay({});
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
const results = getPaymentMethods();
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
expect(results.hasOwnProperty('expressMethods')).toEqual(true);
|
|
39
|
+
expect(results['expressMethods'].length).toEqual(1);
|
|
40
|
+
expect(results['methods'].length).toEqual(1);
|
|
39
41
|
});
|