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

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

Issue 2797633002: [Payments] Move PaymentMethodData to components/payments/core (Closed)
Patch Set: clean Created 3 years, 8 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 <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "components/payments/core/basic_card_response.h" 12 #include "components/payments/core/basic_card_response.h"
13 #include "components/payments/core/payment_address.h" 13 #include "components/payments/core/payment_address.h"
14 #include "components/payments/core/payment_method_data.h"
14 15
15 // C++ bindings for the PaymentRequest API. Conforms to the following specs: 16 // C++ bindings for the PaymentRequest API. Conforms to the following specs:
16 // https://w3c.github.io/browser-payment-api/ (18 July 2016 editor's draft) 17 // https://w3c.github.io/browser-payment-api/ (18 July 2016 editor's draft)
17 // https://w3c.github.io/webpayments-methods-card/ (31 May 2016 editor's draft) 18 // https://w3c.github.io/webpayments-methods-card/ (31 May 2016 editor's draft)
18 19
19 namespace base { 20 namespace base {
20 class DictionaryValue; 21 class DictionaryValue;
21 } 22 }
22 23
23 namespace web { 24 namespace web {
24 25
25 // A set of supported payment methods and any associated payment method specific
26 // data for those methods.
27 class PaymentMethodData {
28 public:
29 PaymentMethodData();
30 PaymentMethodData(const PaymentMethodData& other);
31 ~PaymentMethodData();
32
33 bool operator==(const PaymentMethodData& other) const;
34 bool operator!=(const PaymentMethodData& other) const;
35
36 // Populates the properties of this PaymentMethodData from |value|. Returns
37 // true if the required values are present.
38 bool FromDictionaryValue(const base::DictionaryValue& value);
39
40 // Payment method identifiers for payment methods that the merchant web site
41 // accepts.
42 std::vector<base::string16> supported_methods;
43
44 // A JSON-serialized object that provides optional information that might be
45 // needed by the supported payment methods.
46 base::string16 data;
47 };
48
49 // Supplies monetary amounts. 26 // Supplies monetary amounts.
50 class PaymentCurrencyAmount { 27 class PaymentCurrencyAmount {
51 public: 28 public:
52 PaymentCurrencyAmount(); 29 PaymentCurrencyAmount();
53 ~PaymentCurrencyAmount(); 30 ~PaymentCurrencyAmount();
54 31
55 bool operator==(const PaymentCurrencyAmount& other) const; 32 bool operator==(const PaymentCurrencyAmount& other) const;
56 bool operator!=(const PaymentCurrencyAmount& other) const; 33 bool operator!=(const PaymentCurrencyAmount& other) const;
57 34
58 // Populates the properties of this PaymentCurrencyAmount from |value|. 35 // Populates the properties of this PaymentCurrencyAmount from |value|.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // The unique ID for this PaymentRequest. If it is not provided during 236 // The unique ID for this PaymentRequest. If it is not provided during
260 // construction, one is generated. 237 // construction, one is generated.
261 base::string16 payment_request_id; 238 base::string16 payment_request_id;
262 239
263 // Properties set in order to communicate user choices back to the page. 240 // Properties set in order to communicate user choices back to the page.
264 payments::PaymentAddress shipping_address; 241 payments::PaymentAddress shipping_address;
265 base::string16 shipping_option; 242 base::string16 shipping_option;
266 243
267 // Properties set via the constructor for communicating from the page to the 244 // Properties set via the constructor for communicating from the page to the
268 // browser UI. 245 // browser UI.
269 std::vector<PaymentMethodData> method_data; 246 std::vector<payments::PaymentMethodData> method_data;
270 PaymentDetails details; 247 PaymentDetails details;
271 PaymentOptions options; 248 PaymentOptions options;
272 }; 249 };
273 250
274 // Information provided in the Promise returned by a call to 251 // Information provided in the Promise returned by a call to
275 // PaymentRequest.show(). 252 // PaymentRequest.show().
276 class PaymentResponse { 253 class PaymentResponse {
277 public: 254 public:
278 PaymentResponse(); 255 PaymentResponse();
279 PaymentResponse(const PaymentResponse& other); 256 PaymentResponse(const PaymentResponse& other);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 295
319 // If the request_payer_phone flag was set to true in the PaymentOptions 296 // If the request_payer_phone flag was set to true in the PaymentOptions
320 // passed to the PaymentRequest constructor, this will be the phone number 297 // passed to the PaymentRequest constructor, this will be the phone number
321 // chosen by the user. 298 // chosen by the user.
322 base::string16 payer_phone; 299 base::string16 payer_phone;
323 }; 300 };
324 301
325 } // namespace web 302 } // namespace web
326 303
327 #endif // IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_ 304 #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