@motopays/pay-form 1.0.10-rc.2 → 1.0.10-rc.4
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 +47 -0
- package/README.md +109 -174
- package/lib/index.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.10
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
|
|
7
|
+
##### Payment model
|
|
8
|
+
- cusomterAuthToken field renamed to userAuthToken
|
|
9
|
+
- customerId field renamed to userId
|
|
10
|
+
- env field deleted (set urls.billingProfiles and urls.processing from 'settings' model instead)
|
|
11
|
+
|
|
12
|
+
##### Settings model
|
|
13
|
+
- the model has become mandatory
|
|
14
|
+
- isEmailFieldVisible field deleted
|
|
15
|
+
- merchantInfo field type changed. Now it's: {
|
|
16
|
+
 visible: boolean,
|
|
17
|
+
 text: string,
|
|
18
|
+
 links?: ILink[]
|
|
19
|
+
}
|
|
20
|
+
- isMerchantInfoVisible field renamed and moved to merchantInfo.visible
|
|
21
|
+
- merchantLinks field renamed and moved to merchantInfo.links
|
|
22
|
+
- urls field added instead of env field from 'payment'. Now it's: {
|
|
23
|
+
//example: "https://processing.dev.motopays.com"
|
|
24
|
+
 processing: string;
|
|
25
|
+
 billingProfiles: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- chargeTerms field added to settings model. This field allows to configure checkboxes that have to be selected by users (otherwise, users cannot make payments).
|
|
30
|
+
The interface of the field: {
|
|
31
|
+
 visible: boolean,
|
|
32
|
+
 checkboxes?: ITermCheckbox[],
|
|
33
|
+
 text: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
The interface of ITermCheckbox: {
|
|
37
|
+
 text: string;
|
|
38
|
+
 link?: ILink;
|
|
39
|
+
}
|
|
40
|
+
- availableCardBrands field added to settings model. It's an array of strings which will be shown to users as available card payment methods. Now it supports these strings: "american-express" | "discover" | "jcb" | "maestro" | "mastercard" | "unionpay" | "visa"
|
|
41
|
+
- Checkboxes
|
|
42
|
+
- Text for the checkboxes
|
|
43
|
+
- Payment methods icons
|
|
44
|
+
- Transactions secured icons
|
|
45
|
+
|
|
46
|
+
### Changes
|
|
47
|
+
- Styles for links, indent and text at the bottom of the payment form
|
package/README.md
CHANGED
|
@@ -23,9 +23,8 @@ import "@motopays/pay-form/lib/styles/styles.css";
|
|
|
23
23
|
const payment$ = document.querySelector("#payment");
|
|
24
24
|
|
|
25
25
|
payment$.payment = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
env: EnvironmentType; //one of strings: dev, stage, live, prod
|
|
26
|
+
userAuthToken?: string;
|
|
27
|
+
userId: string;
|
|
29
28
|
|
|
30
29
|
paymentId: string;
|
|
31
30
|
amount: number;
|
|
@@ -33,12 +32,11 @@ payment$.payment = {
|
|
|
33
32
|
tax?: number;
|
|
34
33
|
orderType?: OrderType; //one of numbers: Regular, FreeTrial
|
|
35
34
|
currency: string;
|
|
36
|
-
customerId: string;
|
|
37
35
|
merchantId: string;
|
|
38
36
|
initiator?: PaymentInitiatorType; //one of strings: Customer, Merchant
|
|
39
37
|
|
|
40
|
-
webhookUrl
|
|
41
|
-
returnUrl
|
|
38
|
+
webhookUrl?: string;
|
|
39
|
+
returnUrl?: string;
|
|
42
40
|
|
|
43
41
|
description: string;
|
|
44
42
|
email?: string;
|
|
@@ -53,20 +51,41 @@ payment$.payment = {
|
|
|
53
51
|
country: string;
|
|
54
52
|
zip: string;
|
|
55
53
|
}
|
|
56
|
-
|
|
57
|
-
customEndpoints?: {
|
|
58
|
-
billingProfiles?: string;
|
|
59
|
-
processing?: string
|
|
60
|
-
}
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
payment$.settings = {
|
|
64
|
-
isPhoneNumberFieldVisible:
|
|
65
|
-
isCloseButtonVisible:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
isPhoneNumberFieldVisible: boolean;
|
|
58
|
+
isCloseButtonVisible: boolean;
|
|
59
|
+
|
|
60
|
+
urls: {
|
|
61
|
+
//For example, "https://billingprofiles.dating.com
|
|
62
|
+
billingProfiles: string;
|
|
63
|
+
processing: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
//Now it supports these strings: "american-express" | "discover" | "jcb" | "maestro" | "mastercard" | "unionpay" | "visa"
|
|
67
|
+
availableCardBrands: string[] or CreditCardTypeCardBrandId[];
|
|
68
|
+
|
|
69
|
+
chargeTerms: {
|
|
70
|
+
visible: boolean;
|
|
71
|
+
text?: string;
|
|
72
|
+
checkboxes?: {
|
|
73
|
+
text: string;
|
|
74
|
+
link: {
|
|
75
|
+
text: string;
|
|
76
|
+
href: string;
|
|
77
|
+
}
|
|
78
|
+
} [];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
merchantInfo: {
|
|
82
|
+
visible: boolean;
|
|
83
|
+
text?: string;
|
|
84
|
+
links?: {
|
|
85
|
+
text: string;
|
|
86
|
+
href: string;
|
|
87
|
+
} [];
|
|
88
|
+
};
|
|
70
89
|
}
|
|
71
90
|
|
|
72
91
|
payment$.addEventListener("close", (event) => {
|
|
@@ -88,19 +107,18 @@ declare module "@motopays/pay-form/pay";
|
|
|
88
107
|
|
|
89
108
|
| Field | Type | Description |
|
|
90
109
|
| ------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
91
|
-
|
|
|
92
|
-
|
|
|
110
|
+
| userAuthToken | string | End-user authorization token to access Motopays services |
|
|
111
|
+
| userId **\*required** | string | External end-user Id generated on the merchant side (not Motopays) |
|
|
93
112
|
| paymentId **\*required** | string | Id of a payment |
|
|
94
113
|
| amount **\*required** | number | Payment amount |
|
|
95
114
|
| amountType | AmountType or string | Type of amount can be only one of the following values: {GrossWithoutGst, Net, Gross} |
|
|
96
115
|
| tax | number | Payment tax |
|
|
97
116
|
| orderType | OrderType or string | Type of order can be only one of the following values: {Regular, FreeTrial} |
|
|
98
117
|
| currency **\*required** | string | Payment currency in ISO_4217 format. Currently accepted: {gbp, eur, usd} |
|
|
99
|
-
|
|
|
100
|
-
| merchantId **\*required** | string | Merchant's identificator, issued by Moto. |
|
|
118
|
+
| merchantId **\*required** | string | Merchant's identificator, issued by Motopays. |
|
|
101
119
|
| initiator | PaymentInitiatorType or string | Identifies who of 2 types initiated the payment. Currently accepted: {Merchant, Customer} |
|
|
102
|
-
| webhookUrl | string | URL where the
|
|
103
|
-
| returnUrl
|
|
120
|
+
| webhookUrl | string | URL where the Motopays will send hooks about the payment status changes |
|
|
121
|
+
| returnUrl | string | The URL to which the user will be redirected after completing some types of payment, such as PayPal |
|
|
104
122
|
| description | string | Short order description for the customer |
|
|
105
123
|
| email | string | End-customer e-mail. That parameter can be used to find a best button appearance for the particular customer. |
|
|
106
124
|
| details | ISimple<any> | Additional information about payment |
|
|
@@ -112,31 +130,83 @@ declare module "@motopays/pay-form/pay";
|
|
|
112
130
|
| billingAddress.state | string | State of a customer bank account |
|
|
113
131
|
| billingAddress.country | string | Country of a customer bank account (ISO 3166-1 alpha-2 country code). Example: US |
|
|
114
132
|
| billingAddress.zip | string | Zip of a customer bank account |
|
|
115
|
-
| customEndpoints.billingProfiles | string | Custom set endpoint for BillingProfiles |
|
|
116
|
-
| customEndpoints.processing | string | Custom set endpoint for Processing
|
|
117
133
|
|
|
118
134
|
### Settings interface
|
|
119
135
|
|
|
120
136
|
| Field | Type | Description |
|
|
121
137
|
|-----------------------------|---------|-----------------------------------------------------------------------------|
|
|
138
|
+
| urls **\*required** | IServicesUrls | The necessary services urls |
|
|
139
|
+
| urls.processing **\*required** | string | The processing service URL |
|
|
140
|
+
| urls.billingprofiles **\*required** | string | The billing profiles service URL |
|
|
122
141
|
| isPhoneNumberFieldVisible | boolean | Whether to show the phone input field when creating a map |
|
|
123
142
|
| isCloseButtonVisible | boolean | Whether to show a window close button in the top right corner of the screen |
|
|
124
|
-
|
|
|
125
|
-
| merchantInfo
|
|
126
|
-
|
|
|
143
|
+
| merchantInfo | IMerchantInfoSettings | The information displays in merchant info section |
|
|
144
|
+
| merchantInfo.visible | boolean | Whether to show the merchant information |
|
|
145
|
+
| merchantInfo.text | string | The information about a merchant |
|
|
146
|
+
| merchantInfo.links | ILink[] | The array of merchant links. For example, Policy and Terms |
|
|
147
|
+
| chargeTerms | IChargeTermsSettings | The charge terms section |
|
|
148
|
+
| chargeTerms.visible | boolean | Whether to show the charge terms |
|
|
149
|
+
| chargeTerms.checkboxes | ITermCheckbox[] | The checkboxes that, without being selected, the user will not be able to make a payment. All these checkboxes have to be selected by user to be able to make a payment |
|
|
150
|
+
| chargeTerms.text | string | The text of charge terms. For example, description of subscription plan |
|
|
151
|
+
| availableCardBrands | string[] or CreditCardTypeCardBrandId[] | The сard brands for which icons will be displayed on the form as card payment methods. Currently accepted: {american-express, discover, jcb, maestro, mastercard, unionpay, visa} |
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
ILink interface:
|
|
155
|
+
```
|
|
156
|
+
interface ILink {
|
|
157
|
+
text: string;
|
|
158
|
+
href: string;
|
|
159
|
+
}
|
|
160
|
+
```
|
|
127
161
|
|
|
128
|
-
|
|
162
|
+
ITermCheckbox interface:
|
|
129
163
|
```
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
164
|
+
interface ITermCheckbox {
|
|
165
|
+
text: string;
|
|
166
|
+
link?: ILink;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Example of merchantInfo:
|
|
171
|
+
```
|
|
172
|
+
merchantInfo: {
|
|
173
|
+
"visible": true,
|
|
174
|
+
"text": "The vendor prides itself on designing and implementing state-of-the-art payment infrastructures that cater to a wide range of commercial activities. Specializing in the creation of robust payment processing platforms, the merchant provides tailored solutions that support the dynamic needs of the global market",
|
|
175
|
+
"links": [
|
|
176
|
+
{
|
|
177
|
+
"text": "Terms",
|
|
178
|
+
"href": "https://www.google.com/"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"text": "Policy",
|
|
182
|
+
"href": "https://www.google.com/"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Example of chargeTerms:
|
|
189
|
+
```
|
|
190
|
+
chargeTerms: {
|
|
191
|
+
"visible": true,
|
|
192
|
+
"text": "By checking this box, I am affirming my full and complete understanding of, as well as my agreement to, all the terms and conditions that were previously presented to me, acknowledging that they form a binding contractual agreement.",
|
|
193
|
+
"checkboxes": [
|
|
194
|
+
{
|
|
195
|
+
"text": "I hereby agree to the conditions previously outlined.",
|
|
196
|
+
"link": {
|
|
197
|
+
"text": "Link to the application",
|
|
198
|
+
"href": "https://www.google.com/"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"text": "I validate the foregoing stipulations.",
|
|
203
|
+
"link": {
|
|
204
|
+
"text": "Google",
|
|
205
|
+
"href": "https://www.google.com/"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
},
|
|
140
210
|
```
|
|
141
211
|
|
|
142
212
|
### Output events
|
|
@@ -201,141 +271,6 @@ IThreeDsData {
|
|
|
201
271
|
IRedirectData {
|
|
202
272
|
location: string;
|
|
203
273
|
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Custom Endpoints
|
|
207
|
-
|
|
208
|
-
If it's necessary to override endpoints, It's possible to do by overriding them through CustomEndpoint field.
|
|
209
|
-
|
|
210
|
-
BillingProfiles endpoints in use of this form:
|
|
211
|
-
```
|
|
212
|
-
Get method: {billingProfilesEndpoint}/api/UserPaymentMethods
|
|
213
|
-
Description: Payment methods user's already used before
|
|
214
|
-
Returns: [
|
|
215
|
-
{
|
|
216
|
-
id: string;
|
|
217
|
-
isDefault: boolean;
|
|
218
|
-
name: string;
|
|
219
|
-
rebill: string;
|
|
220
|
-
type: string;
|
|
221
|
-
},
|
|
222
|
-
...
|
|
223
|
-
]
|
|
224
|
-
|
|
225
|
-
Delete method: {billingProfilesEndpoint}/api/UserPaymentMethods/${cardId}
|
|
226
|
-
Description: delete card user's used before
|
|
227
|
-
Returns: void
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Processing endpoints in use of this form:
|
|
231
|
-
```
|
|
232
|
-
Get method: {processingEndpoint}/api/merchants/${merchantId}/settings
|
|
233
|
-
Description: Available apms
|
|
234
|
-
Query params: {
|
|
235
|
-
currency: string,
|
|
236
|
-
payerId: string
|
|
237
|
-
}
|
|
238
|
-
Returns: {
|
|
239
|
-
payments: [
|
|
240
|
-
{
|
|
241
|
-
name: string;
|
|
242
|
-
logo: string;
|
|
243
|
-
},
|
|
244
|
-
...
|
|
245
|
-
]
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
Get method: {processingEndpoint}/api/merchants/${merchantId}/payments/${paymentId}
|
|
249
|
-
Description: Get payment info
|
|
250
|
-
Returns:
|
|
251
|
-
{
|
|
252
|
-
action?: {
|
|
253
|
-
name: string;
|
|
254
|
-
data: IThreeDsData | IRedirectData | any;
|
|
255
|
-
}
|
|
256
|
-
ip: string;
|
|
257
|
-
merchant: string;
|
|
258
|
-
order: {
|
|
259
|
-
invoiceId: string;
|
|
260
|
-
details: string;
|
|
261
|
-
}
|
|
262
|
-
payment: {
|
|
263
|
-
paymentId: string;
|
|
264
|
-
state: PaymentState;
|
|
265
|
-
rebillAnchor: string;
|
|
266
|
-
info: {
|
|
267
|
-
completeProcessingTime?: Date;
|
|
268
|
-
currency: string;
|
|
269
|
-
paymentType: string;
|
|
270
|
-
paymentSystem: string;
|
|
271
|
-
paymentRequisites?: string;
|
|
272
|
-
price: number
|
|
273
|
-
}
|
|
274
|
-
rejectionDetails?: {
|
|
275
|
-
hardDecline: boolean;
|
|
276
|
-
message?: string;
|
|
277
|
-
problemSolvingTips: string[];
|
|
278
|
-
rejectionCode: number;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
taxInfo: {
|
|
282
|
-
abbreviation: string;
|
|
283
|
-
price: number;
|
|
284
|
-
priceNet: number;
|
|
285
|
-
tax: number;
|
|
286
|
-
}
|
|
287
|
-
user: {
|
|
288
|
-
id: string;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
Get method: {processingEndpoint}/api/security/key/${secretId}
|
|
293
|
-
Description: Get secret key for encryption (it's better to contact Moto team). By default secretId = 2
|
|
294
|
-
Returns: string
|
|
295
|
-
|
|
296
|
-
Post method: {processingEndpoint}/api/merchants/{merchantId}/payments
|
|
297
|
-
Description: Make payment
|
|
298
|
-
Body: It's better to contact Moto team
|
|
299
|
-
Returns: {
|
|
300
|
-
action?: {
|
|
301
|
-
name: string;
|
|
302
|
-
data: IThreeDsData | IRedirectData | any;
|
|
303
|
-
}
|
|
304
|
-
ip: string;
|
|
305
|
-
merchant: string;
|
|
306
|
-
order: {
|
|
307
|
-
invoiceId: string;
|
|
308
|
-
details: string;
|
|
309
|
-
}
|
|
310
|
-
payment: {
|
|
311
|
-
paymentId: string;
|
|
312
|
-
state: PaymentState;
|
|
313
|
-
rebillAnchor: string;
|
|
314
|
-
info: {
|
|
315
|
-
completeProcessingTime?: Date;
|
|
316
|
-
currency: string;
|
|
317
|
-
paymentType: string;
|
|
318
|
-
paymentSystem: string;
|
|
319
|
-
paymentRequisites?: string;
|
|
320
|
-
price: number
|
|
321
|
-
}
|
|
322
|
-
rejectionDetails?: {
|
|
323
|
-
hardDecline: boolean;
|
|
324
|
-
message?: string;
|
|
325
|
-
problemSolvingTips: string[];
|
|
326
|
-
rejectionCode: number;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
taxInfo: {
|
|
330
|
-
abbreviation: string;
|
|
331
|
-
price: number;
|
|
332
|
-
priceNet: number;
|
|
333
|
-
tax: number;
|
|
334
|
-
}
|
|
335
|
-
user: {
|
|
336
|
-
id: string;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
274
|
```
|
|
340
275
|
|
|
341
276
|
### Webpack 5 Issues
|