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 #include "components/payments/content/payment_request.h" | 5 #include "components/payments/content/payment_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/payments/content/payment_details_validation.h" | 10 #include "components/payments/content/payment_details_validation.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 std::vector<payments::mojom::PaymentMethodDataPtr> method_data, | 39 std::vector<payments::mojom::PaymentMethodDataPtr> method_data, |
40 payments::mojom::PaymentDetailsPtr details, | 40 payments::mojom::PaymentDetailsPtr details, |
41 payments::mojom::PaymentOptionsPtr options) { | 41 payments::mojom::PaymentOptionsPtr options) { |
42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
43 std::string error; | 43 std::string error; |
44 if (!payments::validatePaymentDetails(details, &error)) { | 44 if (!payments::validatePaymentDetails(details, &error)) { |
45 LOG(ERROR) << error; | 45 LOG(ERROR) << error; |
46 OnConnectionTerminated(); | 46 OnConnectionTerminated(); |
47 return; | 47 return; |
48 } | 48 } |
| 49 if (!details->total) { |
| 50 LOG(ERROR) << "Missing total"; |
| 51 OnConnectionTerminated(); |
| 52 return; |
| 53 } |
49 client_ = std::move(client); | 54 client_ = std::move(client); |
50 spec_ = base::MakeUnique<PaymentRequestSpec>( | 55 spec_ = base::MakeUnique<PaymentRequestSpec>( |
51 std::move(options), std::move(details), std::move(method_data), this, | 56 std::move(options), std::move(details), std::move(method_data), this, |
52 delegate_->GetApplicationLocale()); | 57 delegate_->GetApplicationLocale()); |
53 state_ = base::MakeUnique<PaymentRequestState>( | 58 state_ = base::MakeUnique<PaymentRequestState>( |
54 spec_.get(), this, delegate_->GetApplicationLocale(), | 59 spec_.get(), this, delegate_->GetApplicationLocale(), |
55 delegate_->GetPersonalDataManager()); | 60 delegate_->GetPersonalDataManager()); |
56 } | 61 } |
57 | 62 |
58 void PaymentRequest::Show() { | 63 void PaymentRequest::Show() { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 binding_.Close(); | 131 binding_.Close(); |
127 delegate_->CloseDialog(); | 132 delegate_->CloseDialog(); |
128 manager_->DestroyRequest(this); | 133 manager_->DestroyRequest(this); |
129 } | 134 } |
130 | 135 |
131 void PaymentRequest::Pay() { | 136 void PaymentRequest::Pay() { |
132 state_->GeneratePaymentResponse(); | 137 state_->GeneratePaymentResponse(); |
133 } | 138 } |
134 | 139 |
135 } // namespace payments | 140 } // namespace payments |
OLD | NEW |