| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 | 12 |
| 13 // C++ bindings for the PaymentRequest API. Conforms to the following specs: | 13 // C++ bindings for the PaymentRequest API. Conforms to the following specs: |
| 14 // https://w3c.github.io/browser-payment-api/ (18 July 2016 editor's draft) | 14 // https://w3c.github.io/browser-payment-api/ (18 July 2016 editor's draft) |
| 15 // https://w3c.github.io/webpayments-methods-card/ (31 May 2016 editor's draft) | 15 // https://w3c.github.io/webpayments-methods-card/ (31 May 2016 editor's draft) |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class DictionaryValue; | 18 class DictionaryValue; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace web { | 21 namespace web { |
| 22 | 22 |
| 23 // A shipping or billing address. | |
| 24 class PaymentAddress { | |
| 25 public: | |
| 26 PaymentAddress(); | |
| 27 PaymentAddress(const PaymentAddress& other); | |
| 28 ~PaymentAddress(); | |
| 29 | |
| 30 bool operator==(const PaymentAddress& other) const; | |
| 31 bool operator!=(const PaymentAddress& other) const; | |
| 32 | |
| 33 // Populates |value| with the properties of this PaymentAddress. | |
| 34 std::unique_ptr<base::DictionaryValue> ToDictionaryValue() const; | |
| 35 | |
| 36 // The CLDR (Common Locale Data Repository) region code. For example, US, GB, | |
| 37 // CN, or JP. | |
| 38 base::string16 country; | |
| 39 | |
| 40 // The most specific part of the address. It can include, for example, a | |
| 41 // street name, a house number, apartment number, a rural delivery route, | |
| 42 // descriptive instructions, or a post office box number. | |
| 43 std::vector<base::string16> address_line; | |
| 44 | |
| 45 // The top level administrative subdivision of the country. For example, this | |
| 46 // can be a state, a province, an oblast, or a prefecture. | |
| 47 base::string16 region; | |
| 48 | |
| 49 // The city/town portion of the address. | |
| 50 base::string16 city; | |
| 51 | |
| 52 // The dependent locality or sublocality within a city. For example, used for | |
| 53 // neighborhoods, boroughs, districts, or UK dependent localities. | |
| 54 base::string16 dependent_locality; | |
| 55 | |
| 56 // The postal code or ZIP code, also known as PIN code in India. | |
| 57 base::string16 postal_code; | |
| 58 | |
| 59 // The sorting code as used in, for example, France. | |
| 60 base::string16 sorting_code; | |
| 61 | |
| 62 // The BCP-47 language code for the address. It's used to determine the field | |
| 63 // separators and the order of fields when formatting the address for display. | |
| 64 base::string16 language_code; | |
| 65 | |
| 66 // The organization, firm, company, or institution at this address. | |
| 67 base::string16 organization; | |
| 68 | |
| 69 // The name of the recipient or contact person. | |
| 70 base::string16 recipient; | |
| 71 | |
| 72 // The name of an intermediary party or entity responsible for transferring | |
| 73 // packages between the postal service and the recipient. | |
| 74 base::string16 care_of; | |
| 75 | |
| 76 // The phone number of the recipient or contact person. | |
| 77 base::string16 phone; | |
| 78 }; | |
| 79 | |
| 80 // A set of supported payment methods and any associated payment method specific | 23 // A set of supported payment methods and any associated payment method specific |
| 81 // data for those methods. | 24 // data for those methods. |
| 82 class PaymentMethodData { | 25 class PaymentMethodData { |
| 83 public: | 26 public: |
| 84 PaymentMethodData(); | 27 PaymentMethodData(); |
| 85 PaymentMethodData(const PaymentMethodData& other); | 28 PaymentMethodData(const PaymentMethodData& other); |
| 86 ~PaymentMethodData(); | 29 ~PaymentMethodData(); |
| 87 | 30 |
| 88 bool operator==(const PaymentMethodData& other) const; | 31 bool operator==(const PaymentMethodData& other) const; |
| 89 bool operator!=(const PaymentMethodData& other) const; | 32 bool operator!=(const PaymentMethodData& other) const; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 PaymentAddress shipping_address; | 262 PaymentAddress shipping_address; |
| 320 base::string16 shipping_option; | 263 base::string16 shipping_option; |
| 321 | 264 |
| 322 // Properties set via the constructor for communicating from the page to the | 265 // Properties set via the constructor for communicating from the page to the |
| 323 // browser UI. | 266 // browser UI. |
| 324 std::vector<PaymentMethodData> method_data; | 267 std::vector<PaymentMethodData> method_data; |
| 325 PaymentDetails details; | 268 PaymentDetails details; |
| 326 PaymentOptions options; | 269 PaymentOptions options; |
| 327 }; | 270 }; |
| 328 | 271 |
| 329 // Contains the response from the PaymentRequest API when a user accepts | |
| 330 // payment with a Basic Payment Card payment method (which is currently the only | |
| 331 // method supported on iOS). | |
| 332 class BasicCardResponse { | |
| 333 public: | |
| 334 BasicCardResponse(); | |
| 335 BasicCardResponse(const BasicCardResponse& other); | |
| 336 ~BasicCardResponse(); | |
| 337 | |
| 338 bool operator==(const BasicCardResponse& other) const; | |
| 339 bool operator!=(const BasicCardResponse& other) const; | |
| 340 | |
| 341 // Populates |value| with the properties of this BasicCardResponse. | |
| 342 std::unique_ptr<base::DictionaryValue> ToDictionaryValue() const; | |
| 343 | |
| 344 // The cardholder's name as it appears on the card. | |
| 345 base::string16 cardholder_name; | |
| 346 | |
| 347 // The primary account number (PAN) for the payment card. | |
| 348 base::string16 card_number; | |
| 349 | |
| 350 // A two-digit string for the expiry month of the card in the range 01 to 12. | |
| 351 base::string16 expiry_month; | |
| 352 | |
| 353 // A two-digit string for the expiry year of the card in the range 00 to 99. | |
| 354 base::string16 expiry_year; | |
| 355 | |
| 356 // A three or four digit string for the security code of the card (sometimes | |
| 357 // known as the CVV, CVC, CVN, CVE or CID). | |
| 358 base::string16 card_security_code; | |
| 359 | |
| 360 // The billing address information associated with the payment card. | |
| 361 PaymentAddress billing_address; | |
| 362 }; | |
| 363 | |
| 364 // Information provided in the Promise returned by a call to | 272 // Information provided in the Promise returned by a call to |
| 365 // PaymentRequest.show(). | 273 // PaymentRequest.show(). |
| 366 class PaymentResponse { | 274 class PaymentResponse { |
| 367 public: | 275 public: |
| 368 PaymentResponse(); | 276 PaymentResponse(); |
| 369 PaymentResponse(const PaymentResponse& other); | 277 PaymentResponse(const PaymentResponse& other); |
| 370 ~PaymentResponse(); | 278 ~PaymentResponse(); |
| 371 | 279 |
| 372 bool operator==(const PaymentResponse& other) const; | 280 bool operator==(const PaymentResponse& other) const; |
| 373 bool operator!=(const PaymentResponse& other) const; | 281 bool operator!=(const PaymentResponse& other) const; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 316 |
| 409 // If the request_payer_phone flag was set to true in the PaymentOptions | 317 // If the request_payer_phone flag was set to true in the PaymentOptions |
| 410 // passed to the PaymentRequest constructor, this will be the phone number | 318 // passed to the PaymentRequest constructor, this will be the phone number |
| 411 // chosen by the user. | 319 // chosen by the user. |
| 412 base::string16 payer_phone; | 320 base::string16 payer_phone; |
| 413 }; | 321 }; |
| 414 | 322 |
| 415 } // namespace web | 323 } // namespace web |
| 416 | 324 |
| 417 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ | 325 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ |
| OLD | NEW |