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 "modules/payments/PaymentResponse.h" | 5 #include "modules/payments/PaymentResponse.h" |
6 | 6 |
7 #include "bindings/core/v8/JSONValuesForV8.h" | 7 #include "bindings/core/v8/JSONValuesForV8.h" |
8 #include "modules/payments/PaymentAddress.h" | 8 #include "modules/payments/PaymentAddress.h" |
9 #include "modules/payments/PaymentCompleter.h" | 9 #include "modules/payments/PaymentCompleter.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 PaymentResponse::~PaymentResponse() | 23 PaymentResponse::~PaymentResponse() |
24 { | 24 { |
25 } | 25 } |
26 | 26 |
27 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e
xceptionState) const | 27 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e
xceptionState) const |
28 { | 28 { |
29 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet
ails, exceptionState)); | 29 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet
ails, exceptionState)); |
30 } | 30 } |
31 | 31 |
32 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) | 32 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, const String&
result) |
33 { | 33 { |
34 return m_paymentCompleter->complete(scriptState, success); | 34 PaymentComplete convertedResult = Unknown; |
| 35 if (result == "success") |
| 36 convertedResult = Success; |
| 37 if (result == "fail") |
| 38 convertedResult = Fail; |
| 39 return m_paymentCompleter->complete(scriptState, convertedResult); |
35 } | 40 } |
36 | 41 |
37 DEFINE_TRACE(PaymentResponse) | 42 DEFINE_TRACE(PaymentResponse) |
38 { | 43 { |
39 visitor->trace(m_shippingAddress); | 44 visitor->trace(m_shippingAddress); |
40 visitor->trace(m_paymentCompleter); | 45 visitor->trace(m_paymentCompleter); |
41 } | 46 } |
42 | 47 |
43 } // namespace blink | 48 } // namespace blink |
OLD | NEW |