-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaymentRequest.js
More file actions
68 lines (60 loc) · 1.37 KB
/
PaymentRequest.js
File metadata and controls
68 lines (60 loc) · 1.37 KB
1
2
3
4
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
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Payment_Request_API
*/
import PaymentResponse from './PaymentResponse.js';
import BasicCardRequest from './BasicCardRequest.js';
import PaymentAddress from './PaymentAddress.js';
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequest
*/
export default class PaymentRequest {
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequest/PaymentRequest
*/
constructor(methodData, {
total,
id = null,
displayItems = [],
shippingOptions = [],
modifiers = null,
} = {}, {
requestPayerName = false,
requestPayerEmail = false,
requestPayerPhone = false,
requestShipping = false,
shippingType = 'shipping',
} = {}) {
console.info({
total, id, displayItems, shippingOptions, modifiers,
requestPayerName, requestPayerEmail, requestPayerPhone, requestShipping, shippingType,
});
this._requestId = id;
this._total = total;
this._displayItems = displayItems;
this._cardRequest = new BasicCardRequest();
this._paymentAddress = new PaymentAddress({
requestPayerName,
});
}
get requestId() {
return this._requestId;
}
get shippingAddress() {
//
}
get shippingOption() {
//
}
get shippingType() {
//
}
async show() {
return new PaymentResponse();
}
abort() {
//
}
canMakePayment() {
return true;
}
}