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

Unified Diff: components/payments/core/payment_instrument.h

Issue 2733953003: [Payments] Return a basic card response (Closed)
Patch Set: addressed comments from anthony Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/payments/core/payment_instrument.h
diff --git a/components/payments/core/payment_instrument.h b/components/payments/core/payment_instrument.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9348d52225d405a6cb348772d98364325070a73
--- /dev/null
+++ b/components/payments/core/payment_instrument.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_
+#define COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_
+
+#include <set>
+#include <string>
+
+#include "base/macros.h"
+
+namespace payments {
+
+// Base class which represents a form of payment in Payment Request.
+class PaymentInstrument {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ // Should be called with method name (e.g., "visa") and json-serialized
+ // stringified details.
+ virtual void OnInstrumentDetailsReady(
+ const std::string& method_name,
+ const std::string& stringified_details) = 0;
+
+ virtual void OnInstrumentDetailsError() = 0;
+ };
+
+ virtual ~PaymentInstrument() {}
+
+ // Will call into the |delegate| (can't be null) on success or error.
+ virtual void InvokePaymentApp(Delegate* delegate) = 0;
+
+ const std::string& method_name() { return method_name_; }
+
+ protected:
+ explicit PaymentInstrument(const std::string& method_name)
+ : method_name_(method_name) {}
+
+ private:
+ const std::string method_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaymentInstrument);
+};
+
+} // namespace payments
+
+#endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_
« no previous file with comments | « components/payments/core/payment_address_unittest.cc ('k') | components/payments/core/payment_request_data_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698