mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
rouslan | 908248c | 2017-02-27 21:30:24 | [diff] [blame] | 5 | #include "components/payments/content/payment_request.h" |
| 6 | |
anthonyvd | d23ed70 | 2017-04-05 15:29:00 | [diff] [blame] | 7 | #include <string> |
rouslan | 908248c | 2017-02-27 21:30:24 | [diff] [blame] | 8 | #include <utility> |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 9 | |
Sebastien Marchand | 53801a3 | 2019-01-25 16:26:11 | [diff] [blame] | 10 | #include "base/bind.h" |
Rouslan Solomakhin | 1804ee4 | 2017-10-03 14:27:43 | [diff] [blame] | 11 | #include "base/feature_list.h" |
Mathieu Perreault | 627b97c | 2017-08-12 00:44:22 | [diff] [blame] | 12 | #include "base/stl_util.h" |
rouslan | 69099768 | 2017-05-09 18:07:39 | [diff] [blame] | 13 | #include "components/payments/content/can_make_payment_query_factory.h" |
Rouslan Solomakhin | 4eea9bc2 | 2017-10-10 15:18:51 | [diff] [blame] | 14 | #include "components/payments/content/content_payment_request_delegate.h" |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 15 | #include "components/payments/content/origin_security_checker.h" |
Mohamad Ahmadi | f5544bb | 2017-09-01 21:48:22 | [diff] [blame] | 16 | #include "components/payments/content/payment_request_converter.h" |
rouslan | 908248c | 2017-02-27 21:30:24 | [diff] [blame] | 17 | #include "components/payments/content/payment_request_web_contents_manager.h" |
rouslan | 69099768 | 2017-05-09 18:07:39 | [diff] [blame] | 18 | #include "components/payments/core/can_make_payment_query.h" |
Anthony Vallee-Dubois | 968ae4d | 2018-03-15 16:56:36 | [diff] [blame] | 19 | #include "components/payments/core/features.h" |
Mohamad Ahmadi | f5544bb | 2017-09-01 21:48:22 | [diff] [blame] | 20 | #include "components/payments/core/payment_details.h" |
| 21 | #include "components/payments/core/payment_details_validation.h" |
Mathieu Perreault | 23d25bfb8 | 2018-05-11 14:45:37 | [diff] [blame] | 22 | #include "components/payments/core/payment_instrument.h" |
anthonyvd | 6a43b93 | 2017-05-11 18:39:27 | [diff] [blame] | 23 | #include "components/payments/core/payment_prefs.h" |
Jinho Bang | be463a2 | 2018-08-02 10:26:50 | [diff] [blame] | 24 | #include "components/payments/core/payments_validators.h" |
anthonyvd | 6a43b93 | 2017-05-11 18:39:27 | [diff] [blame] | 25 | #include "components/prefs/pref_service.h" |
Steven Holte | 2083e8bc | 2018-07-16 23:50:36 | [diff] [blame] | 26 | #include "components/ukm/content/source_url_recorder.h" |
Rouslan Solomakhin | 6e979ab | 2017-08-30 17:30:39 | [diff] [blame] | 27 | #include "components/url_formatter/elide_url.h" |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 28 | #include "content/public/browser/browser_thread.h" |
rouslan | 69099768 | 2017-05-09 18:07:39 | [diff] [blame] | 29 | #include "content/public/browser/render_frame_host.h" |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 30 | #include "content/public/browser/web_contents.h" |
Rouslan Solomakhin | 1804ee4 | 2017-10-03 14:27:43 | [diff] [blame] | 31 | #include "content/public/common/content_features.h" |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 32 | |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 33 | namespace { |
| 34 | |
| 35 | using ::payments::mojom::HasEnrolledInstrumentQueryResult; |
| 36 | |
| 37 | } // namespace |
| 38 | |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 39 | namespace payments { |
| 40 | |
| 41 | PaymentRequest::PaymentRequest( |
rouslan | 69099768 | 2017-05-09 18:07:39 | [diff] [blame] | 42 | content::RenderFrameHost* render_frame_host, |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 43 | content::WebContents* web_contents, |
Rouslan Solomakhin | 4eea9bc2 | 2017-10-10 15:18:51 | [diff] [blame] | 44 | std::unique_ptr<ContentPaymentRequestDelegate> delegate, |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 45 | PaymentRequestWebContentsManager* manager, |
Anthony Vallee-Dubois | c7ae733 | 2017-12-19 20:44:07 | [diff] [blame] | 46 | PaymentRequestDisplayManager* display_manager, |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 47 | mojo::InterfaceRequest<mojom::PaymentRequest> request, |
mathp | 300fa54 | 2017-03-27 19:29:37 | [diff] [blame] | 48 | ObserverForTest* observer_for_testing) |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 49 | : web_contents_(web_contents), |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 50 | log_(web_contents_), |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 51 | delegate_(std::move(delegate)), |
| 52 | manager_(manager), |
Anthony Vallee-Dubois | c7ae733 | 2017-12-19 20:44:07 | [diff] [blame] | 53 | display_manager_(display_manager), |
| 54 | display_handle_(nullptr), |
mathp | 300fa54 | 2017-03-27 19:29:37 | [diff] [blame] | 55 | binding_(this, std::move(request)), |
Rouslan Solomakhin | 6e979ab | 2017-08-30 17:30:39 | [diff] [blame] | 56 | top_level_origin_(url_formatter::FormatUrlForSecurityDisplay( |
| 57 | web_contents_->GetLastCommittedURL())), |
| 58 | frame_origin_(url_formatter::FormatUrlForSecurityDisplay( |
| 59 | render_frame_host->GetLastCommittedURL())), |
sebsg | 20b49d7b | 2017-05-04 20:23:17 | [diff] [blame] | 60 | observer_for_testing_(observer_for_testing), |
| 61 | journey_logger_(delegate_->IsIncognito(), |
Steven Holte | 2083e8bc | 2018-07-16 23:50:36 | [diff] [blame] | 62 | ukm::GetSourceIdForWebContentsDocument(web_contents)), |
Anthony Vallee-Dubois | dc1dbf1a | 2017-07-17 15:01:13 | [diff] [blame] | 63 | weak_ptr_factory_(this) { |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 64 | // OnConnectionTerminated will be called when the Mojo pipe is closed. This |
| 65 | // will happen as a result of many renderer-side events (both successful and |
| 66 | // erroneous in nature). |
| 67 | // TODO(crbug.com/683636): Investigate using |
| 68 | // set_connection_error_with_reason_handler with Binding::CloseWithReason. |
tzik | 2bcf8e4 | 2018-07-31 11:22:15 | [diff] [blame] | 69 | binding_.set_connection_error_handler(base::BindOnce( |
Anthony Vallee-Dubois | dc1dbf1a | 2017-07-17 15:01:13 | [diff] [blame] | 70 | &PaymentRequest::OnConnectionTerminated, weak_ptr_factory_.GetWeakPtr())); |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | PaymentRequest::~PaymentRequest() {} |
| 74 | |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 75 | void PaymentRequest::Init(mojom::PaymentRequestClientPtr client, |
| 76 | std::vector<mojom::PaymentMethodDataPtr> method_data, |
| 77 | mojom::PaymentDetailsPtr details, |
| 78 | mojom::PaymentOptionsPtr options) { |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 79 | DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 80 | |
| 81 | if (is_initialized_) { |
| 82 | log_.Error("Attempted initialization twice"); |
| 83 | OnConnectionTerminated(); |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | is_initialized_ = true; |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 88 | client_ = std::move(client); |
| 89 | |
rouslan | b28f453 | 2017-05-08 15:41:47 | [diff] [blame] | 90 | const GURL last_committed_url = delegate_->GetLastCommittedURL(); |
| 91 | if (!OriginSecurityChecker::IsOriginSecure(last_committed_url)) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 92 | log_.Error("Not in a secure origin"); |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 93 | OnConnectionTerminated(); |
| 94 | return; |
| 95 | } |
| 96 | |
rouslan | b28f453 | 2017-05-08 15:41:47 | [diff] [blame] | 97 | bool allowed_origin = |
| 98 | OriginSecurityChecker::IsSchemeCryptographic(last_committed_url) || |
| 99 | OriginSecurityChecker::IsOriginLocalhostOrFile(last_committed_url); |
| 100 | if (!allowed_origin) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 101 | log_.Error( |
| 102 | "Only localhost, file://, and cryptographic scheme origins allowed"); |
rouslan | b28f453 | 2017-05-08 15:41:47 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | bool invalid_ssl = |
| 106 | OriginSecurityChecker::IsSchemeCryptographic(last_committed_url) && |
| 107 | !delegate_->IsSslCertificateValid(); |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 108 | if (invalid_ssl) { |
| 109 | log_.Error("SSL certificate is not valid."); |
| 110 | } |
rouslan | b28f453 | 2017-05-08 15:41:47 | [diff] [blame] | 111 | |
| 112 | if (!allowed_origin || invalid_ssl) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 113 | // Intentionally don't set |spec_| and |state_|, so the UI is never shown. |
| 114 | log_.Error( |
| 115 | "No UI will be shown. CanMakePayment will always return false. " |
| 116 | "Show will be rejected with NotSupportedError."); |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 117 | return; |
| 118 | } |
| 119 | |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 120 | std::string error; |
Mohamad Ahmadi | f5544bb | 2017-09-01 21:48:22 | [diff] [blame] | 121 | if (!ValidatePaymentDetails(ConvertPaymentDetails(details), &error)) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 122 | log_.Error(error); |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 123 | OnConnectionTerminated(); |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 124 | return; |
| 125 | } |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 126 | |
jinho.bang | fcb5ec9 | 2017-03-29 08:08:02 | [diff] [blame] | 127 | if (!details->total) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 128 | log_.Error("Missing total"); |
jinho.bang | fcb5ec9 | 2017-03-29 08:08:02 | [diff] [blame] | 129 | OnConnectionTerminated(); |
| 130 | return; |
| 131 | } |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 132 | |
sebsg | a70a6da | 2017-12-21 22:27:02 | [diff] [blame] | 133 | spec_ = std::make_unique<PaymentRequestSpec>( |
mathp | c0d616a | 2017-03-15 14:09:33 | [diff] [blame] | 134 | std::move(options), std::move(details), std::move(method_data), this, |
| 135 | delegate_->GetApplicationLocale()); |
sebsg | a70a6da | 2017-12-21 22:27:02 | [diff] [blame] | 136 | state_ = std::make_unique<PaymentRequestState>( |
Rouslan Solomakhin | dbf593d9 | 2017-11-21 19:20:57 | [diff] [blame] | 137 | web_contents_, top_level_origin_, frame_origin_, spec_.get(), this, |
| 138 | delegate_->GetApplicationLocale(), delegate_->GetPersonalDataManager(), |
| 139 | delegate_.get(), &journey_logger_); |
Mathieu Perreault | 627b97c | 2017-08-12 00:44:22 | [diff] [blame] | 140 | |
| 141 | journey_logger_.SetRequestedInformation( |
| 142 | spec_->request_shipping(), spec_->request_payer_email(), |
| 143 | spec_->request_payer_phone(), spec_->request_payer_name()); |
| 144 | |
| 145 | // Log metrics around which payment methods are requested by the merchant. |
| 146 | GURL google_pay_url(kGooglePayMethodName); |
| 147 | GURL android_pay_url(kAndroidPayMethodName); |
| 148 | // Looking for payment methods that are NOT google-related payment methods. |
| 149 | auto non_google_it = |
| 150 | std::find_if(spec_->url_payment_method_identifiers().begin(), |
| 151 | spec_->url_payment_method_identifiers().end(), |
| 152 | [google_pay_url, android_pay_url](const GURL& url) { |
| 153 | return url != google_pay_url && url != android_pay_url; |
| 154 | }); |
| 155 | journey_logger_.SetRequestedPaymentMethodTypes( |
| 156 | /*requested_basic_card=*/!spec_->supported_card_networks().empty(), |
| 157 | /*requested_method_google=*/ |
| 158 | base::ContainsValue(spec_->url_payment_method_identifiers(), |
| 159 | google_pay_url) || |
| 160 | base::ContainsValue(spec_->url_payment_method_identifiers(), |
| 161 | android_pay_url), |
| 162 | /*requested_method_other=*/non_google_it != |
| 163 | spec_->url_payment_method_identifiers().end()); |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 164 | } |
| 165 | |
Rouslan Solomakhin | 833f851 | 2018-04-03 23:19:25 | [diff] [blame] | 166 | void PaymentRequest::Show(bool is_user_gesture) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 167 | if (!IsInitialized()) { |
| 168 | log_.Error("Attempted show without initialization"); |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 169 | OnConnectionTerminated(); |
tmartino | 8ce92285 | 2017-01-09 22:23:10 | [diff] [blame] | 170 | return; |
| 171 | } |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 172 | |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 173 | if (is_show_called_) { |
| 174 | log_.Error("Attempted show twice"); |
| 175 | OnConnectionTerminated(); |
| 176 | return; |
| 177 | } |
| 178 | |
| 179 | is_show_called_ = true; |
| 180 | |
rouslan | 7d433cc2 | 2017-05-08 15:18:07 | [diff] [blame] | 181 | // A tab can display only one PaymentRequest UI at a time. |
Anthony Vallee-Dubois | 8f5e7e1 | 2018-01-12 16:14:06 | [diff] [blame] | 182 | display_handle_ = display_manager_->TryShow(delegate_.get()); |
Anthony Vallee-Dubois | c7ae733 | 2017-12-19 20:44:07 | [diff] [blame] | 183 | if (!display_handle_) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 184 | log_.Error("A PaymentRequest UI is already showing"); |
sebsg | 828269bc | 2017-06-09 19:11:12 | [diff] [blame] | 185 | journey_logger_.SetNotShown( |
| 186 | JourneyLogger::NOT_SHOWN_REASON_CONCURRENT_REQUESTS); |
Rouslan Solomakhin | b2d233c4 | 2018-08-30 16:18:40 | [diff] [blame] | 187 | client_->OnError(mojom::PaymentErrorReason::ALREADY_SHOWING); |
rouslan | 7d433cc2 | 2017-05-08 15:18:07 | [diff] [blame] | 188 | OnConnectionTerminated(); |
| 189 | return; |
| 190 | } |
| 191 | |
Rouslan Solomakhin | 5b51043 | 2017-09-26 16:59:32 | [diff] [blame] | 192 | if (!delegate_->IsBrowserWindowActive()) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 193 | log_.Error("Cannot show PaymentRequest UI in a background tab"); |
Rouslan Solomakhin | 5b51043 | 2017-09-26 16:59:32 | [diff] [blame] | 194 | journey_logger_.SetNotShown(JourneyLogger::NOT_SHOWN_REASON_OTHER); |
| 195 | client_->OnError(mojom::PaymentErrorReason::USER_CANCEL); |
| 196 | OnConnectionTerminated(); |
| 197 | return; |
| 198 | } |
| 199 | |
Rouslan Solomakhin | d2cae95a | 2018-08-09 00:16:10 | [diff] [blame] | 200 | if (!state_) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 201 | // SSL is not valid. Reject show with NotSupportedError, disconnect the |
| 202 | // mojo pipe, and destroy this object. |
Rouslan Solomakhin | d2cae95a | 2018-08-09 00:16:10 | [diff] [blame] | 203 | AreRequestedMethodsSupportedCallback(false); |
| 204 | return; |
| 205 | } |
| 206 | |
Rouslan Solomakhin | 833f851 | 2018-04-03 23:19:25 | [diff] [blame] | 207 | is_show_user_gesture_ = is_user_gesture; |
| 208 | |
Rouslan Solomakhin | d2cae95a | 2018-08-09 00:16:10 | [diff] [blame] | 209 | display_handle_->Show(this); |
| 210 | |
gogerald | 0a7ee6c | 2017-11-13 18:23:19 | [diff] [blame] | 211 | state_->AreRequestedMethodsSupported( |
| 212 | base::BindOnce(&PaymentRequest::AreRequestedMethodsSupportedCallback, |
| 213 | weak_ptr_factory_.GetWeakPtr())); |
| 214 | } |
| 215 | |
Jinho Bang | be463a2 | 2018-08-02 10:26:50 | [diff] [blame] | 216 | void PaymentRequest::Retry(mojom::PaymentValidationErrorsPtr errors) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 217 | if (!IsInitialized()) { |
| 218 | log_.Error("Attempted retry without initialization"); |
Jinho Bang | cac8d9a0 | 2018-08-23 19:47:22 | [diff] [blame] | 219 | OnConnectionTerminated(); |
| 220 | return; |
| 221 | } |
| 222 | |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 223 | if (!IsThisPaymentRequestShowing()) { |
| 224 | log_.Error("Attempted retry without show"); |
Jinho Bang | cac8d9a0 | 2018-08-23 19:47:22 | [diff] [blame] | 225 | OnConnectionTerminated(); |
| 226 | return; |
| 227 | } |
| 228 | |
Jinho Bang | be463a2 | 2018-08-02 10:26:50 | [diff] [blame] | 229 | std::string error; |
| 230 | if (!PaymentsValidators::IsValidPaymentValidationErrorsFormat(errors, |
| 231 | &error)) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 232 | log_.Error(error); |
Jinho Bang | be463a2 | 2018-08-02 10:26:50 | [diff] [blame] | 233 | client_->OnError(mojom::PaymentErrorReason::USER_CANCEL); |
| 234 | OnConnectionTerminated(); |
| 235 | return; |
| 236 | } |
| 237 | |
Jinho Bang | 092e716 | 2018-09-06 23:41:19 | [diff] [blame] | 238 | spec()->Retry(std::move(errors)); |
Jinho Bang | cac8d9a0 | 2018-08-23 19:47:22 | [diff] [blame] | 239 | display_handle_->Retry(); |
Jinho Bang | be463a2 | 2018-08-02 10:26:50 | [diff] [blame] | 240 | } |
| 241 | |
mathp | 151bd31 | 2017-04-03 21:07:24 | [diff] [blame] | 242 | void PaymentRequest::UpdateWith(mojom::PaymentDetailsPtr details) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 243 | if (!IsInitialized()) { |
| 244 | log_.Error("Attempted updateWith without initialization"); |
| 245 | OnConnectionTerminated(); |
| 246 | return; |
| 247 | } |
| 248 | |
| 249 | if (!IsThisPaymentRequestShowing()) { |
| 250 | log_.Error("Attempted updateWith without show"); |
| 251 | OnConnectionTerminated(); |
| 252 | return; |
| 253 | } |
| 254 | |
mathp | 151bd31 | 2017-04-03 21:07:24 | [diff] [blame] | 255 | std::string error; |
Mohamad Ahmadi | f5544bb | 2017-09-01 21:48:22 | [diff] [blame] | 256 | if (!ValidatePaymentDetails(ConvertPaymentDetails(details), &error)) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 257 | log_.Error(error); |
mathp | 151bd31 | 2017-04-03 21:07:24 | [diff] [blame] | 258 | OnConnectionTerminated(); |
| 259 | return; |
| 260 | } |
Rouslan Solomakhin | 4cbda82 | 2017-08-23 18:50:39 | [diff] [blame] | 261 | |
Jinho Bang | 092e716 | 2018-09-06 23:41:19 | [diff] [blame] | 262 | if (details->shipping_address_errors && |
| 263 | !PaymentsValidators::IsValidAddressErrorsFormat( |
| 264 | details->shipping_address_errors, &error)) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 265 | log_.Error(error); |
Jinho Bang | 092e716 | 2018-09-06 23:41:19 | [diff] [blame] | 266 | OnConnectionTerminated(); |
| 267 | return; |
| 268 | } |
| 269 | |
Rouslan Solomakhin | 4cbda82 | 2017-08-23 18:50:39 | [diff] [blame] | 270 | if (!details->total) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 271 | log_.Error("Missing total"); |
Rouslan Solomakhin | 4cbda82 | 2017-08-23 18:50:39 | [diff] [blame] | 272 | OnConnectionTerminated(); |
| 273 | return; |
| 274 | } |
| 275 | |
mathp | 151bd31 | 2017-04-03 21:07:24 | [diff] [blame] | 276 | spec_->UpdateWith(std::move(details)); |
| 277 | } |
| 278 | |
Rouslan Solomakhin | a9ff928 | 2017-10-31 21:58:05 | [diff] [blame] | 279 | void PaymentRequest::NoUpdatedPaymentDetails() { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 280 | // This Mojo call is triggered by the user of the API doing nothing in |
| 281 | // response to a shipping address update event, so the error messages cannot |
| 282 | // be more verbose. |
| 283 | if (!IsInitialized()) { |
| 284 | log_.Error("Not initialized"); |
| 285 | OnConnectionTerminated(); |
| 286 | return; |
| 287 | } |
| 288 | |
| 289 | if (!IsThisPaymentRequestShowing()) { |
| 290 | log_.Error("Not shown"); |
| 291 | OnConnectionTerminated(); |
| 292 | return; |
| 293 | } |
| 294 | |
Rouslan Solomakhin | a9ff928 | 2017-10-31 21:58:05 | [diff] [blame] | 295 | spec_->RecomputeSpecForDetails(); |
| 296 | } |
| 297 | |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 298 | void PaymentRequest::Abort() { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 299 | if (!IsInitialized()) { |
| 300 | log_.Error("Attempted abort without initialization"); |
| 301 | OnConnectionTerminated(); |
| 302 | return; |
| 303 | } |
| 304 | |
| 305 | if (!IsThisPaymentRequestShowing()) { |
| 306 | log_.Error("Attempted abort without show"); |
| 307 | OnConnectionTerminated(); |
| 308 | return; |
| 309 | } |
| 310 | |
Anthony Vallee-Dubois | 6813c144 | 2017-05-17 19:32:56 | [diff] [blame] | 311 | // The API user has decided to abort. If a successful abort message is |
| 312 | // returned to the renderer, the Mojo message pipe is closed, which triggers |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 313 | // PaymentRequest::OnConnectionTerminated, which destroys this object. |
Anthony Vallee-Dubois | 6813c144 | 2017-05-17 19:32:56 | [diff] [blame] | 314 | // Otherwise, the abort promise is rejected and the pipe is not closed. |
| 315 | // The abort is only successful if the payment app wasn't yet invoked. |
| 316 | // TODO(crbug.com/716546): Add a merchant abort metric |
| 317 | |
| 318 | bool accepting_abort = !state_->IsPaymentAppInvoked(); |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 319 | if (accepting_abort) |
| 320 | RecordFirstAbortReason(JourneyLogger::ABORT_REASON_ABORTED_BY_MERCHANT); |
Anthony Vallee-Dubois | 6813c144 | 2017-05-17 19:32:56 | [diff] [blame] | 321 | |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 322 | if (client_.is_bound()) |
Anthony Vallee-Dubois | 6813c144 | 2017-05-17 19:32:56 | [diff] [blame] | 323 | client_->OnAbort(accepting_abort); |
| 324 | |
| 325 | if (observer_for_testing_) |
| 326 | observer_for_testing_->OnAbortCalled(); |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 327 | } |
| 328 | |
mathp | 21879589 | 2017-03-29 15:15:34 | [diff] [blame] | 329 | void PaymentRequest::Complete(mojom::PaymentComplete result) { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 330 | if (!IsInitialized()) { |
| 331 | log_.Error("Attempted complete without initialization"); |
| 332 | OnConnectionTerminated(); |
mathp | 4b85b58 | 2017-03-08 21:07:16 | [diff] [blame] | 333 | return; |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | if (!IsThisPaymentRequestShowing()) { |
| 337 | log_.Error("Attempted complete without show"); |
| 338 | OnConnectionTerminated(); |
| 339 | return; |
| 340 | } |
mathp | 4b85b58 | 2017-03-08 21:07:16 | [diff] [blame] | 341 | |
Rouslan Solomakhin | e347319 | 2017-06-16 14:54:57 | [diff] [blame] | 342 | // Failed transactions show an error. Successful and unknown-state |
| 343 | // transactions don't show an error. |
| 344 | if (result == mojom::PaymentComplete::FAIL) { |
mathp | 21879589 | 2017-03-29 15:15:34 | [diff] [blame] | 345 | delegate_->ShowErrorMessage(); |
| 346 | } else { |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 347 | DCHECK(!has_recorded_completion_); |
sebsg | f8272a2 | 2017-05-26 14:32:58 | [diff] [blame] | 348 | journey_logger_.SetCompleted(); |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 349 | has_recorded_completion_ = true; |
| 350 | |
anthonyvd | 6a43b93 | 2017-05-11 18:39:27 | [diff] [blame] | 351 | delegate_->GetPrefService()->SetBoolean(kPaymentsFirstTransactionCompleted, |
| 352 | true); |
mathp | 21879589 | 2017-03-29 15:15:34 | [diff] [blame] | 353 | // When the renderer closes the connection, |
| 354 | // PaymentRequest::OnConnectionTerminated will be called. |
| 355 | client_->OnComplete(); |
sebsg | 8a93b27 | 2017-05-11 19:30:22 | [diff] [blame] | 356 | state_->RecordUseStats(); |
mathp | 21879589 | 2017-03-29 15:15:34 | [diff] [blame] | 357 | } |
mathp | 4b85b58 | 2017-03-08 21:07:16 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | void PaymentRequest::CanMakePayment() { |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 361 | if (!IsInitialized()) { |
| 362 | log_.Error("Attempted canMakePayment without initialization"); |
| 363 | OnConnectionTerminated(); |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | // It's valid to call canMakePayment() without calling show() first. |
| 368 | |
gogerald | 8189d52 | 2017-09-15 17:52:18 | [diff] [blame] | 369 | if (observer_for_testing_) |
| 370 | observer_for_testing_->OnCanMakePaymentCalled(); |
Mathieu Perreault | cacb85e | 2018-06-06 20:40:13 | [diff] [blame] | 371 | |
Rouslan Solomakhin | d2cae95a | 2018-08-09 00:16:10 | [diff] [blame] | 372 | if (!delegate_->GetPrefService()->GetBoolean(kCanMakePaymentEnabled) || |
| 373 | !state_) { |
Mathieu Perreault | cacb85e | 2018-06-06 20:40:13 | [diff] [blame] | 374 | CanMakePaymentCallback(/*can_make_payment=*/false); |
| 375 | } else { |
Rouslan Solomakhin | d2cae95a | 2018-08-09 00:16:10 | [diff] [blame] | 376 | state_->CanMakePayment( |
Mathieu Perreault | cacb85e | 2018-06-06 20:40:13 | [diff] [blame] | 377 | base::BindOnce(&PaymentRequest::CanMakePaymentCallback, |
| 378 | weak_ptr_factory_.GetWeakPtr())); |
| 379 | } |
gogerald | 8189d52 | 2017-09-15 17:52:18 | [diff] [blame] | 380 | } |
| 381 | |
Rouslan Solomakhin | 5683eb28 | 2019-01-29 18:06:03 | [diff] [blame^] | 382 | void PaymentRequest::HasEnrolledInstrument(bool per_method_quota) { |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 383 | if (!IsInitialized()) { |
| 384 | log_.Error("Attempted hasEnrolledInstrument without initialization"); |
| 385 | OnConnectionTerminated(); |
| 386 | return; |
| 387 | } |
| 388 | |
| 389 | // It's valid to call hasEnrolledInstrument() without calling show() first. |
| 390 | |
| 391 | if (observer_for_testing_) |
| 392 | observer_for_testing_->OnHasEnrolledInstrumentCalled(); |
| 393 | |
| 394 | if (!delegate_->GetPrefService()->GetBoolean(kCanMakePaymentEnabled) || |
| 395 | !state_) { |
Rouslan Solomakhin | 5683eb28 | 2019-01-29 18:06:03 | [diff] [blame^] | 396 | HasEnrolledInstrumentCallback(per_method_quota, |
| 397 | /*has_enrolled_instrument=*/false); |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 398 | } else { |
| 399 | state_->HasEnrolledInstrument( |
| 400 | base::BindOnce(&PaymentRequest::HasEnrolledInstrumentCallback, |
Rouslan Solomakhin | 5683eb28 | 2019-01-29 18:06:03 | [diff] [blame^] | 401 | weak_ptr_factory_.GetWeakPtr(), per_method_quota)); |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 402 | } |
| 403 | } |
| 404 | |
Rouslan Solomakhin | 2706470 | 2018-12-14 21:15:33 | [diff] [blame] | 405 | void PaymentRequest::AreRequestedMethodsSupportedCallback( |
| 406 | bool methods_supported) { |
| 407 | if (methods_supported) { |
| 408 | if (SatisfiesSkipUIConstraints()) { |
| 409 | skipped_payment_request_ui_ = true; |
| 410 | Pay(); |
| 411 | } |
| 412 | } else { |
| 413 | journey_logger_.SetNotShown( |
| 414 | JourneyLogger::NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD); |
| 415 | client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED); |
| 416 | if (observer_for_testing_) |
| 417 | observer_for_testing_->OnNotSupportedError(); |
| 418 | OnConnectionTerminated(); |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | bool PaymentRequest::IsInitialized() const { |
| 423 | return is_initialized_ && client_ && client_.is_bound() && |
| 424 | binding_.is_bound(); |
| 425 | } |
| 426 | |
| 427 | bool PaymentRequest::IsThisPaymentRequestShowing() const { |
| 428 | return is_show_called_ && display_handle_ && spec_ && state_; |
| 429 | } |
| 430 | |
| 431 | bool PaymentRequest::SatisfiesSkipUIConstraints() const { |
| 432 | return base::FeatureList::IsEnabled(features::kWebPaymentsSingleAppUiSkip) && |
| 433 | base::FeatureList::IsEnabled(::features::kServiceWorkerPaymentApps) && |
| 434 | is_show_user_gesture_ && state()->is_get_all_instruments_finished() && |
| 435 | state()->available_instruments().size() == 1 && |
| 436 | spec()->stringified_method_data().size() == 1 && |
| 437 | !spec()->request_shipping() && !spec()->request_payer_name() && |
| 438 | !spec()->request_payer_phone() && |
| 439 | !spec()->request_payer_email() |
| 440 | // Only allowing URL base payment apps to skip the payment sheet. |
| 441 | && spec()->url_payment_method_identifiers().size() == 1; |
| 442 | } |
| 443 | |
mathp | f1a7a375 | 2017-03-15 11:23:37 | [diff] [blame] | 444 | void PaymentRequest::OnPaymentResponseAvailable( |
| 445 | mojom::PaymentResponsePtr response) { |
mathp | 57c8c86 | 2017-06-16 20:15:45 | [diff] [blame] | 446 | journey_logger_.SetEventOccurred( |
| 447 | JourneyLogger::EVENT_RECEIVED_INSTRUMENT_DETAILS); |
gogerald | 7a2b761e | 2017-11-09 18:30:19 | [diff] [blame] | 448 | |
| 449 | // Do not send invalid response to client. |
| 450 | if (response->method_name.empty() || response->stringified_details.empty()) { |
| 451 | RecordFirstAbortReason( |
| 452 | JourneyLogger::ABORT_REASON_INSTRUMENT_DETAILS_ERROR); |
| 453 | delegate_->ShowErrorMessage(); |
| 454 | return; |
| 455 | } |
| 456 | |
mathp | f1a7a375 | 2017-03-15 11:23:37 | [diff] [blame] | 457 | client_->OnPaymentResponse(std::move(response)); |
mathp | 4b85b58 | 2017-03-08 21:07:16 | [diff] [blame] | 458 | } |
| 459 | |
mathp | 151bd31 | 2017-04-03 21:07:24 | [diff] [blame] | 460 | void PaymentRequest::OnShippingOptionIdSelected( |
| 461 | std::string shipping_option_id) { |
| 462 | client_->OnShippingOptionChange(shipping_option_id); |
| 463 | } |
| 464 | |
| 465 | void PaymentRequest::OnShippingAddressSelected( |
| 466 | mojom::PaymentAddressPtr address) { |
| 467 | client_->OnShippingAddressChange(std::move(address)); |
| 468 | } |
| 469 | |
Jinho Bang | bb17815 | 2018-09-13 09:44:43 | [diff] [blame] | 470 | void PaymentRequest::OnPayerInfoSelected(mojom::PayerDetailPtr payer_info) { |
| 471 | client_->OnPayerDetailChange(std::move(payer_info)); |
| 472 | } |
| 473 | |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 474 | void PaymentRequest::UserCancelled() { |
| 475 | // If |client_| is not bound, then the object is already being destroyed as |
| 476 | // a result of a renderer event. |
| 477 | if (!client_.is_bound()) |
| 478 | return; |
| 479 | |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 480 | RecordFirstAbortReason(JourneyLogger::ABORT_REASON_ABORTED_BY_USER); |
sebsg | 20b49d7b | 2017-05-04 20:23:17 | [diff] [blame] | 481 | |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 482 | // This sends an error to the renderer, which informs the API user. |
rouslan | 6e3cf7c6 | 2017-04-17 21:23:28 | [diff] [blame] | 483 | client_->OnError(mojom::PaymentErrorReason::USER_CANCEL); |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 484 | |
| 485 | // We close all bindings and ask to be destroyed. |
| 486 | client_.reset(); |
| 487 | binding_.Close(); |
rouslan | b28f453 | 2017-05-08 15:41:47 | [diff] [blame] | 488 | if (observer_for_testing_) |
| 489 | observer_for_testing_->OnConnectionTerminated(); |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 490 | manager_->DestroyRequest(this); |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 491 | } |
| 492 | |
sebsg | d56b3e42 | 2017-10-20 18:08:08 | [diff] [blame] | 493 | void PaymentRequest::DidStartMainFrameNavigationToDifferentDocument( |
| 494 | bool is_user_initiated) { |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 495 | RecordFirstAbortReason(is_user_initiated |
| 496 | ? JourneyLogger::ABORT_REASON_USER_NAVIGATION |
| 497 | : JourneyLogger::ABORT_REASON_MERCHANT_NAVIGATION); |
sebsg | 2c8558a | 2017-05-17 18:54:10 | [diff] [blame] | 498 | } |
| 499 | |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 500 | void PaymentRequest::OnConnectionTerminated() { |
| 501 | // We are here because of a browser-side error, or likely as a result of the |
| 502 | // connection_error_handler on |binding_|, which can mean that the renderer |
| 503 | // has decided to close the pipe for various reasons (see all uses of |
| 504 | // PaymentRequest::clearResolversAndCloseMojoConnection() in Blink). We close |
| 505 | // the binding and the dialog, and ask to be deleted. |
| 506 | client_.reset(); |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 507 | binding_.Close(); |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 508 | delegate_->CloseDialog(); |
rouslan | b28f453 | 2017-05-08 15:41:47 | [diff] [blame] | 509 | if (observer_for_testing_) |
| 510 | observer_for_testing_->OnConnectionTerminated(); |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 511 | |
| 512 | RecordFirstAbortReason(JourneyLogger::ABORT_REASON_MOJO_CONNECTION_ERROR); |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 513 | manager_->DestroyRequest(this); |
| 514 | } |
| 515 | |
mathp | d4be8de8 | 2017-03-01 00:51:48 | [diff] [blame] | 516 | void PaymentRequest::Pay() { |
mathp | 57c8c86 | 2017-06-16 20:15:45 | [diff] [blame] | 517 | journey_logger_.SetEventOccurred(JourneyLogger::EVENT_PAY_CLICKED); |
Mathieu Perreault | 23d25bfb8 | 2018-05-11 14:45:37 | [diff] [blame] | 518 | |
| 519 | // Log the correct "selected instrument" metric according to type. |
| 520 | DCHECK(state_->selected_instrument()); |
| 521 | JourneyLogger::Event selected_event = |
| 522 | JourneyLogger::Event::EVENT_SELECTED_OTHER; |
| 523 | switch (state_->selected_instrument()->type()) { |
| 524 | case PaymentInstrument::Type::AUTOFILL: |
| 525 | selected_event = JourneyLogger::Event::EVENT_SELECTED_CREDIT_CARD; |
| 526 | break; |
| 527 | case PaymentInstrument::Type::SERVICE_WORKER_APP: |
| 528 | selected_event = JourneyLogger::Event::EVENT_SELECTED_OTHER; |
| 529 | break; |
| 530 | case PaymentInstrument::Type::NATIVE_MOBILE_APP: |
| 531 | NOTREACHED(); |
| 532 | break; |
| 533 | } |
| 534 | journey_logger_.SetEventOccurred(selected_event); |
| 535 | |
mathp | f1a7a375 | 2017-03-15 11:23:37 | [diff] [blame] | 536 | state_->GeneratePaymentResponse(); |
mathp | d4be8de8 | 2017-03-01 00:51:48 | [diff] [blame] | 537 | } |
| 538 | |
Anthony Vallee-Dubois | c7ae733 | 2017-12-19 20:44:07 | [diff] [blame] | 539 | void PaymentRequest::HideIfNecessary() { |
| 540 | display_handle_.reset(); |
| 541 | } |
| 542 | |
Rouslan Solomakhin | d2cae95a | 2018-08-09 00:16:10 | [diff] [blame] | 543 | void PaymentRequest::RecordDialogShownEventInJourneyLogger() { |
| 544 | journey_logger_.SetEventOccurred(JourneyLogger::EVENT_SHOWN); |
| 545 | } |
| 546 | |
Anthony Vallee-Dubois | 10d131a | 2018-02-22 15:41:04 | [diff] [blame] | 547 | bool PaymentRequest::IsIncognito() const { |
| 548 | return delegate_->IsIncognito(); |
| 549 | } |
| 550 | |
sebsg | fcdd13c | 2017-06-08 15:49:33 | [diff] [blame] | 551 | void PaymentRequest::RecordFirstAbortReason( |
| 552 | JourneyLogger::AbortReason abort_reason) { |
| 553 | if (!has_recorded_completion_) { |
| 554 | has_recorded_completion_ = true; |
| 555 | journey_logger_.SetAborted(abort_reason); |
sebsg | 2c8558a | 2017-05-17 18:54:10 | [diff] [blame] | 556 | } |
| 557 | } |
| 558 | |
Rouslan Solomakhin | 1804ee4 | 2017-10-03 14:27:43 | [diff] [blame] | 559 | void PaymentRequest::CanMakePaymentCallback(bool can_make_payment) { |
Danyao Wang | 4bc0606a | 2018-12-27 16:54:53 | [diff] [blame] | 560 | client_->OnCanMakePayment( |
| 561 | can_make_payment ? mojom::CanMakePaymentQueryResult::CAN_MAKE_PAYMENT |
| 562 | : mojom::CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT); |
| 563 | |
| 564 | // TODO(https://crbug.com/915907): emit JourneyLogger event once the event |
| 565 | // names are updated. |
Rouslan Solomakhin | 1804ee4 | 2017-10-03 14:27:43 | [diff] [blame] | 566 | |
| 567 | if (observer_for_testing_) |
| 568 | observer_for_testing_->OnCanMakePaymentReturned(); |
| 569 | } |
| 570 | |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 571 | void PaymentRequest::HasEnrolledInstrumentCallback( |
Rouslan Solomakhin | 5683eb28 | 2019-01-29 18:06:03 | [diff] [blame^] | 572 | bool per_method_quota, |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 573 | bool has_enrolled_instrument) { |
Rouslan Solomakhin | 5683eb28 | 2019-01-29 18:06:03 | [diff] [blame^] | 574 | if (!spec_ || |
| 575 | CanMakePaymentQueryFactory::GetInstance() |
| 576 | ->GetForContext(web_contents_->GetBrowserContext()) |
| 577 | ->CanQuery(top_level_origin_, frame_origin_, |
| 578 | spec_->stringified_method_data(), per_method_quota)) { |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 579 | RespondToHasEnrolledInstrumentQuery(has_enrolled_instrument, |
| 580 | /*warn_localhost_or_file=*/false); |
| 581 | } else if (OriginSecurityChecker::IsOriginLocalhostOrFile(frame_origin_)) { |
| 582 | RespondToHasEnrolledInstrumentQuery(has_enrolled_instrument, |
| 583 | /*warn_localhost_or_file=*/true); |
| 584 | } else { |
| 585 | client_->OnHasEnrolledInstrument( |
| 586 | HasEnrolledInstrumentQueryResult::QUERY_QUOTA_EXCEEDED); |
| 587 | } |
| 588 | |
| 589 | if (observer_for_testing_) |
| 590 | observer_for_testing_->OnHasEnrolledInstrumentReturned(); |
| 591 | } |
| 592 | |
Danyao Wang | ce175bf | 2018-12-21 22:35:58 | [diff] [blame] | 593 | void PaymentRequest::RespondToHasEnrolledInstrumentQuery( |
| 594 | bool has_enrolled_instrument, |
| 595 | bool warn_localhost_or_file) { |
| 596 | HasEnrolledInstrumentQueryResult positive = |
| 597 | warn_localhost_or_file |
| 598 | ? HasEnrolledInstrumentQueryResult::WARNING_HAS_ENROLLED_INSTRUMENT |
| 599 | : HasEnrolledInstrumentQueryResult::HAS_ENROLLED_INSTRUMENT; |
| 600 | HasEnrolledInstrumentQueryResult negative = |
| 601 | warn_localhost_or_file |
| 602 | ? HasEnrolledInstrumentQueryResult::WARNING_HAS_NO_ENROLLED_INSTRUMENT |
| 603 | : HasEnrolledInstrumentQueryResult::HAS_NO_ENROLLED_INSTRUMENT; |
| 604 | |
| 605 | client_->OnHasEnrolledInstrument(has_enrolled_instrument ? positive |
| 606 | : negative); |
| 607 | journey_logger_.SetCanMakePaymentValue(has_enrolled_instrument); |
| 608 | } |
| 609 | |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 610 | } // namespace payments |