Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Side by Side Diff: ios/web/public/payments/payment_request.h

Issue 2285523002: Add support for method selection in the Payment Request UI on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add curly braces. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/payments/payment_request_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 9 #include <vector>
9 10
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 12
12 // C++ bindings for the PaymentRequest API. Conforms to the 18 July 2016 13 // C++ bindings for the PaymentRequest API. Conforms to the following specs:
13 // editor's draft at https://w3c.github.io/browser-payment-api/. 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)
14 16
15 namespace base { 17 namespace base {
16 class DictionaryValue; 18 class DictionaryValue;
17 } 19 }
18 20
19 namespace web { 21 namespace web {
20 22
21 // A shipping or billing address. 23 // A shipping or billing address.
22 class PaymentAddress { 24 class PaymentAddress {
23 public: 25 public:
24 PaymentAddress(); 26 PaymentAddress();
25 PaymentAddress(const PaymentAddress& other); 27 PaymentAddress(const PaymentAddress& other);
26 ~PaymentAddress(); 28 ~PaymentAddress();
27 29
28 bool operator==(const PaymentAddress& other) const; 30 bool operator==(const PaymentAddress& other) const;
29 bool operator!=(const PaymentAddress& other) const; 31 bool operator!=(const PaymentAddress& other) const;
30 32
33 // Populates |value| with the properties of this PaymentAddress.
34 std::unique_ptr<base::DictionaryValue> ToDictionaryValue() const;
35
31 // The CLDR (Common Locale Data Repository) region code. For example, US, GB, 36 // The CLDR (Common Locale Data Repository) region code. For example, US, GB,
32 // CN, or JP. 37 // CN, or JP.
33 base::string16 country; 38 base::string16 country;
34 39
35 // The most specific part of the address. It can include, for example, a 40 // 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, 41 // street name, a house number, apartment number, a rural delivery route,
37 // descriptive instructions, or a post office box number. 42 // descriptive instructions, or a post office box number.
38 std::vector<base::string16> address_line; 43 std::vector<base::string16> address_line;
39 44
40 // The top level administrative subdivision of the country. For example, this 45 // The top level administrative subdivision of the country. For example, this
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 PaymentAddress payment_address; 259 PaymentAddress payment_address;
255 base::string16 shipping_option; 260 base::string16 shipping_option;
256 261
257 // Properties set via the constructor for communicating from the page to the 262 // Properties set via the constructor for communicating from the page to the
258 // browser UI. 263 // browser UI.
259 std::vector<PaymentMethodData> method_data; 264 std::vector<PaymentMethodData> method_data;
260 PaymentDetails details; 265 PaymentDetails details;
261 PaymentOptions options; 266 PaymentOptions options;
262 }; 267 };
263 268
269 // Contains the response from the PaymentRequest API when a user accepts
270 // payment with a Basic Payment Card payment method (which is currently the only
271 // method supported on iOS).
272 class BasicCardResponse {
273 public:
274 BasicCardResponse();
275 BasicCardResponse(const BasicCardResponse& other);
276 ~BasicCardResponse();
277
278 bool operator==(const BasicCardResponse& other) const;
279 bool operator!=(const BasicCardResponse& other) const;
280
281 // Populates |value| with the properties of this BasicCardResponse.
282 std::unique_ptr<base::DictionaryValue> ToDictionaryValue() const;
283
284 // The cardholder's name as it appears on the card.
285 base::string16 cardholder_name;
286
287 // The primary account number (PAN) for the payment card.
288 base::string16 card_number;
289
290 // A two-digit string for the expiry month of the card in the range 01 to 12.
291 base::string16 expiry_month;
292
293 // A two-digit string for the expiry year of the card in the range 00 to 99.
294 base::string16 expiry_year;
295
296 // A three or four digit string for the security code of the card (sometimes
297 // known as the CVV, CVC, CVN, CVE or CID).
298 base::string16 card_security_code;
299
300 // The billing address information associated with the payment card.
301 PaymentAddress billing_address;
302 };
303
264 // Information provided in the Promise returned by a call to 304 // Information provided in the Promise returned by a call to
265 // PaymentRequest.show(). 305 // PaymentRequest.show().
266 class PaymentResponse { 306 class PaymentResponse {
267 public: 307 public:
268 PaymentResponse(); 308 PaymentResponse();
309 PaymentResponse(const PaymentResponse& other);
269 ~PaymentResponse(); 310 ~PaymentResponse();
270 311
271 bool operator==(const PaymentResponse& other) const; 312 bool operator==(const PaymentResponse& other) const;
272 bool operator!=(const PaymentResponse& other) const; 313 bool operator!=(const PaymentResponse& other) const;
273 314
274 // Populates |value| with the properties of this PaymentResponse. 315 // Populates |value| with the properties of this PaymentResponse.
316 std::unique_ptr<base::DictionaryValue> ToDictionaryValue() const;
317
318 // TODO(jdonnelly): Remove this after removing downstream use.
275 void ToDictionaryValue(base::DictionaryValue* value) const; 319 void ToDictionaryValue(base::DictionaryValue* value) const;
276 320
277 // The payment method identifier for the payment method that the user selected 321 // The payment method identifier for the payment method that the user selected
278 // to fulfil the transaction. 322 // to fulfil the transaction.
279 base::string16 method_name; 323 base::string16 method_name;
280 324
281 // A JSON-serialized object that provides a payment method specific message 325 // A credit card response object used by the merchant to process the
282 // used by the merchant to process the transaction and determine successful 326 // transaction and determine successful fund transfer.
283 // fund transfer. This data is returned by the payment app that satisfies the 327 BasicCardResponse details;
284 // payment request.
285 base::string16 details;
286 }; 328 };
287 329
288 } // namespace web 330 } // namespace web
289 331
290 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ 332 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_
OLDNEW
« no previous file with comments | « ios/web/payments/payment_request_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698