-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaymentRequestEvent.cljs
228 lines (162 loc) · 7.76 KB
/
PaymentRequestEvent.cljs
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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
(ns web.payments.PaymentRequestEvent
"The PaymentRequestEvent interface of the the Payment Request
is the object passed to a payment handler when a `web.payments.PaymentRequest`
made."
(:refer-clojure :exclude []))
(def constructor
"Constructor.
The PaymentRequestEvent constructor creates a new `web.payments.PaymentRequestEvent` object which is a constructor for a `web.payments.PaymentRequestEvent` which is the object passed to a payment handler when a `web.payments.PaymentRequest` is made..
type
Must always be 'PaymentRequest'.
options Optional
Options are as follows:
instrumentKey: A `PaymentInstrument` object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument.
methodData: An array of `PaymentMethodData` objects containing payment method identifers for the payment methods that the web site accepts and any associated payment method specific data.
modifiers: An array of objects containing changes to payment details.
paymentRequestId: The ID of the `web.payments.PaymentRequest` object.
paymentRequestOrigin: The origin where the `web.payments.PaymentRequest` object was initialized.
topLeveOrigin: The top-level origin where the `web.payments.PaymentRequest` object was initialized.
total: The total amount being requested for payment.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/PaymentRequestEvent`"
js/PaymentRequestEvent)
(defn open-window
"Method.
The openWindow property of the `web.payments.PaymentRequestEvent`
opens the specified URL in a new window, if and only if the given
is on the same origin as the calling page. It returns a `js.Promise`
resolves with a reference to a `web.service-workers.WindowClient`.
`var aPromise = paymentRequestEvent.openWindow(url)`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/openWindow`"
[this url]
(-> this (.openWindow url)))
(defn respond-with
"Method.
The respondWith property of the `web.payments.PaymentRequestEvent`
prevents the default event handling and allows you to provide
`js.Promise` for a `web.payments.PaymentResponse` object yourself.
`paymentRequestEvent.respondWith(
// Promise that resolves with a PaymentResponse.
)`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/respondWith`"
[this & args]
(-> this .-respondWith (.apply this (clj->js args))))
(defn instrument-key
"Property.
The instrumentKey read-only property of the `web.payments.PaymentRequestEvent`
returns a `PaymentInstrument` object reflecting the payment instrument
by the user or an empty string if the user has not registered
chosen a payment instrument.
`var instrumentKey = paymentRequestEvent.instrumentKey`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/instrumentKey`"
[this]
(-> this (.-instrumentKey)))
(defn set-instrument-key!
"Property.
The instrumentKey read-only property of the `web.payments.PaymentRequestEvent`
returns a `PaymentInstrument` object reflecting the payment instrument
by the user or an empty string if the user has not registered
chosen a payment instrument.
`var instrumentKey = paymentRequestEvent.instrumentKey`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/instrumentKey`"
[this val]
(aset this "instrumentKey" val))
(defn method-data
"Property.
The methodData read-only property of the `web.payments.PaymentRequestEvent`
returns an array of `PaymentMethodData` objects containing payment
identifers for the payment methods that the web site accepts
any associated payment method specific data.
`var methodData[] = paymentRequestEvent.methodData`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/methodData`"
[this]
(-> this (.-methodData)))
(defn set-method-data!
"Property.
The methodData read-only property of the `web.payments.PaymentRequestEvent`
returns an array of `PaymentMethodData` objects containing payment
identifers for the payment methods that the web site accepts
any associated payment method specific data.
`var methodData[] = paymentRequestEvent.methodData`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/methodData`"
[this val]
(aset this "methodData" val))
(defn modifiers
"Property.
The modifiers read-only property of the `web.payments.PaymentRequestEvent`
returns an array of objects containing changes to payment details.
`var modifiers[] = paymentDetailsEvent.modifiers`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/modifiers`"
[this]
(-> this (.-modifiers)))
(defn set-modifiers!
"Property.
The modifiers read-only property of the `web.payments.PaymentRequestEvent`
returns an array of objects containing changes to payment details.
`var modifiers[] = paymentDetailsEvent.modifiers`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/modifiers`"
[this val]
(aset this "modifiers" val))
(defn payment-request-id
"Property.
The paymentRequestId read-only property of the `web.payments.PaymentRequestEvent`
returns the ID of the `web.payments.PaymentRequest` object.
`var id = paymentRequestEvent.paymentRequestId`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/paymentRequestId`"
[this]
(-> this (.-paymentRequestId)))
(defn set-payment-request-id!
"Property.
The paymentRequestId read-only property of the `web.payments.PaymentRequestEvent`
returns the ID of the `web.payments.PaymentRequest` object.
`var id = paymentRequestEvent.paymentRequestId`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/paymentRequestId`"
[this val]
(aset this "paymentRequestId" val))
(defn payment-request-origin
"Property.
The paymentRequestOrigin read-only property of the `web.payments.PaymentRequestEvent`
returns the origin where the `web.payments.PaymentRequest` object
initialized.
`var aUsvString = paymentRequestEvent.paymentRequestOrigin`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/paymentRequestOrigin`"
[this]
(-> this (.-paymentRequestOrigin)))
(defn set-payment-request-origin!
"Property.
The paymentRequestOrigin read-only property of the `web.payments.PaymentRequestEvent`
returns the origin where the `web.payments.PaymentRequest` object
initialized.
`var aUsvString = paymentRequestEvent.paymentRequestOrigin`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/paymentRequestOrigin`"
[this val]
(aset this "paymentRequestOrigin" val))
(defn top-origin
"Property.
Returns the top-level origin where the PaymentRequest object
initialized."
[this]
(-> this (.-topOrigin)))
(defn set-top-origin!
"Property.
Returns the top-level origin where the PaymentRequest object
initialized."
[this val]
(aset this "topOrigin" val))
(defn total
"Property.
The total readonly property of the `web.payments.PaymentRequestEvent`
returns a `web.payments.PaymentCurrencyAmount` object containing
total amount being requested for payment.
`var paymentCurrencyAmount = paymentRequestEvent.total`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/total`"
[this]
(-> this (.-total)))
(defn set-total!
"Property.
The total readonly property of the `web.payments.PaymentRequestEvent`
returns a `web.payments.PaymentCurrencyAmount` object containing
total amount being requested for payment.
`var paymentCurrencyAmount = paymentRequestEvent.total`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequestEvent/total`"
[this val]
(aset this "total" val))