@rebilly/instruments 3.29.3 → 3.31.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/CHANGELOG.md +14 -0
- package/dist/index.js +19 -11
- package/dist/index.min.js +19 -11
- package/package.json +4 -2
- package/src/data/options-schema/index.js +93 -0
- package/src/data/options-schema/schemas/options-schema.js +425 -0
- package/src/functions/mount/setup-options.js +56 -151
- package/src/functions/mount/setup-options.spec.js +287 -94
- package/src/functions/update.js +1 -25
- package/src/functions/update.spec.js +1 -0
- package/src/instance.spec.js +5 -1
- package/src/style/base/__snapshots__/theme.spec.js.snap +1 -1
- package/tests/mocks/rebilly-instruments-mock.js +19 -10
package/src/instance.spec.js
CHANGED
|
@@ -25,7 +25,11 @@ describe('RebillyInstruments instance', () => {
|
|
|
25
25
|
const options = {
|
|
26
26
|
form: '.form-selector',
|
|
27
27
|
summary: '.summary-selector',
|
|
28
|
-
|
|
28
|
+
apiMode: 'sandbox',
|
|
29
|
+
items: [{
|
|
30
|
+
planId: 'test-plan-id',
|
|
31
|
+
quantity: 1,
|
|
32
|
+
}],
|
|
29
33
|
setupFramepay: setupFramepayMock,
|
|
30
34
|
};
|
|
31
35
|
|
|
@@ -78,6 +78,7 @@ export async function RenderMockRebillyInstruments(options = {}) {
|
|
|
78
78
|
form: '.form-selector',
|
|
79
79
|
summary: '.summary-selector',
|
|
80
80
|
locale: 'auto',
|
|
81
|
+
apiMode: 'sandbox',
|
|
81
82
|
_dev: {
|
|
82
83
|
paymentMethodsUrl: 'https://forms.test.rebilly.dev',
|
|
83
84
|
framePayStyleLink: 'https://dev.framepay.rebilly.com/rebilly.css'
|
|
@@ -100,6 +101,10 @@ export async function RenderMockRebillyInstruments(options = {}) {
|
|
|
100
101
|
];
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
if ((options.invoiceId || options.transactionid) && !options.jwt) {
|
|
105
|
+
defaultOptions.jwt = 'test-jwt';
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
const mergedOptions = merge({...defaultOptions}, options);
|
|
104
109
|
|
|
105
110
|
const framepayMock = createFramepayMock();
|
|
@@ -113,16 +118,20 @@ export async function RenderMockRebillyInstruments(options = {}) {
|
|
|
113
118
|
summary.classList.add(`${mergedOptions.summary.replace('.', '')}`);
|
|
114
119
|
document.body.appendChild(summary);
|
|
115
120
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
try {
|
|
122
|
+
await RebillyInstruments.mount({
|
|
123
|
+
setupFramepay: setupFramepayMock,
|
|
124
|
+
...mergedOptions,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
RebillyInstruments.mock = {
|
|
128
|
+
data: (data) => {
|
|
129
|
+
RebillyInstruments.state.data = new DataInstance(data);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
} catch(e) {
|
|
133
|
+
console.log(e);
|
|
134
|
+
}
|
|
126
135
|
|
|
127
136
|
return RebillyInstruments;
|
|
128
137
|
}
|