OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ | 5 #ifndef IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ |
6 #define IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ | 6 #define IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 | 11 |
12 // C++ bindings for the PaymentRequest API. Conforms to the 18 July 2016 | 12 // C++ bindings for the PaymentRequest API. Conforms to the following specs: |
13 // editor's draft at https://w3c.github.io/browser-payment-api/. | 13 // https://w3c.github.io/browser-payment-api/ (18 July 2016 editor's draft) |
| 14 // https://w3c.github.io/webpayments-methods-card/ (31 May 2016 editor's draft) |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class DictionaryValue; | 17 class DictionaryValue; |
17 } | 18 } |
18 | 19 |
19 namespace web { | 20 namespace web { |
20 | 21 |
21 // A shipping or billing address. | 22 // A shipping or billing address. |
22 class PaymentAddress { | 23 class PaymentAddress { |
23 public: | 24 public: |
24 PaymentAddress(); | 25 PaymentAddress(); |
25 PaymentAddress(const PaymentAddress& other); | 26 PaymentAddress(const PaymentAddress& other); |
26 ~PaymentAddress(); | 27 ~PaymentAddress(); |
27 | 28 |
28 bool operator==(const PaymentAddress& other) const; | 29 bool operator==(const PaymentAddress& other) const; |
29 bool operator!=(const PaymentAddress& other) const; | 30 bool operator!=(const PaymentAddress& other) const; |
30 | 31 |
| 32 // Populates |value| with the properties of this PaymentAddress. |
| 33 void ToDictionaryValue(base::DictionaryValue* value) const; |
| 34 |
31 // The CLDR (Common Locale Data Repository) region code. For example, US, GB, | 35 // The CLDR (Common Locale Data Repository) region code. For example, US, GB, |
32 // CN, or JP. | 36 // CN, or JP. |
33 base::string16 country; | 37 base::string16 country; |
34 | 38 |
35 // The most specific part of the address. It can include, for example, a | 39 // The most specific part of the address. It can include, for example, a |
36 // street name, a house number, apartment number, a rural delivery route, | 40 // street name, a house number, apartment number, a rural delivery route, |
37 // descriptive instructions, or a post office box number. | 41 // descriptive instructions, or a post office box number. |
38 std::vector<base::string16> address_line; | 42 std::vector<base::string16> address_line; |
39 | 43 |
40 // The top level administrative subdivision of the country. For example, this | 44 // The top level administrative subdivision of the country. For example, this |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 PaymentAddress payment_address; | 258 PaymentAddress payment_address; |
255 base::string16 shipping_option; | 259 base::string16 shipping_option; |
256 | 260 |
257 // Properties set via the constructor for communicating from the page to the | 261 // Properties set via the constructor for communicating from the page to the |
258 // browser UI. | 262 // browser UI. |
259 std::vector<PaymentMethodData> method_data; | 263 std::vector<PaymentMethodData> method_data; |
260 PaymentDetails details; | 264 PaymentDetails details; |
261 PaymentOptions options; | 265 PaymentOptions options; |
262 }; | 266 }; |
263 | 267 |
| 268 // Contains the response from the PaymentRequest API when a user accepts |
| 269 // payment with a Basic Payment Card payment method (which is currently the only |
| 270 // method supported on iOS). |
| 271 class BasicCardResponse { |
| 272 public: |
| 273 BasicCardResponse(); |
| 274 BasicCardResponse(const BasicCardResponse& other); |
| 275 ~BasicCardResponse(); |
| 276 |
| 277 bool operator==(const BasicCardResponse& other) const; |
| 278 bool operator!=(const BasicCardResponse& other) const; |
| 279 |
| 280 // Populates |value| with the properties of this BasicCardResponse. |
| 281 void ToDictionaryValue(base::DictionaryValue* value) const; |
| 282 |
| 283 // The cardholder's name as it appears on the card. |
| 284 base::string16 cardholder_name; |
| 285 |
| 286 // The primary account number (PAN) for the payment card. |
| 287 base::string16 card_number; |
| 288 |
| 289 // A two-digit string for the expiry month of the card in the range 01 to 12. |
| 290 base::string16 expiry_month; |
| 291 |
| 292 // A two-digit string for the expiry year of the card in the range 00 to 99. |
| 293 base::string16 expiry_year; |
| 294 |
| 295 // A three or four digit string for the security code of the card (sometimes |
| 296 // known as the CVV, CVC, CVN, CVE or CID). |
| 297 base::string16 card_security_code; |
| 298 |
| 299 // The billing address information associated with the payment card. |
| 300 PaymentAddress billing_address; |
| 301 }; |
| 302 |
264 // Information provided in the Promise returned by a call to | 303 // Information provided in the Promise returned by a call to |
265 // PaymentRequest.show(). | 304 // PaymentRequest.show(). |
266 class PaymentResponse { | 305 class PaymentResponse { |
267 public: | 306 public: |
268 PaymentResponse(); | 307 PaymentResponse(); |
| 308 PaymentResponse(const PaymentResponse& other); |
269 ~PaymentResponse(); | 309 ~PaymentResponse(); |
270 | 310 |
271 bool operator==(const PaymentResponse& other) const; | 311 bool operator==(const PaymentResponse& other) const; |
272 bool operator!=(const PaymentResponse& other) const; | 312 bool operator!=(const PaymentResponse& other) const; |
273 | 313 |
274 // Populates |value| with the properties of this PaymentResponse. | 314 // Populates |value| with the properties of this PaymentResponse. |
275 void ToDictionaryValue(base::DictionaryValue* value) const; | 315 void ToDictionaryValue(base::DictionaryValue* value) const; |
276 | 316 |
277 // The payment method identifier for the payment method that the user selected | 317 // The payment method identifier for the payment method that the user selected |
278 // to fulfil the transaction. | 318 // to fulfil the transaction. |
279 base::string16 method_name; | 319 base::string16 method_name; |
280 | 320 |
281 // A JSON-serialized object that provides a payment method specific message | 321 // A credit card response object used by the merchant to process the |
282 // used by the merchant to process the transaction and determine successful | 322 // transaction and determine successful fund transfer. |
283 // fund transfer. This data is returned by the payment app that satisfies the | 323 BasicCardResponse details; |
284 // payment request. | |
285 base::string16 details; | |
286 }; | 324 }; |
287 | 325 |
288 } // namespace web | 326 } // namespace web |
289 | 327 |
290 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ | 328 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ |
OLD | NEW |