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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 PaymentResponse::~PaymentResponse() | 39 PaymentResponse::~PaymentResponse() |
40 { | 40 { |
41 } | 41 } |
42 | 42 |
43 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e
xceptionState) const | 43 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e
xceptionState) const |
44 { | 44 { |
45 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet
ails, exceptionState)); | 45 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet
ails, exceptionState)); |
46 } | 46 } |
47 | 47 |
48 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) | 48 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, const String&
result) |
49 { | 49 { |
50 return m_paymentCompleter->complete(scriptState, success); | 50 PaymentComplete convertedResult = Unknown; |
| 51 if (result == "success") |
| 52 convertedResult = Success; |
| 53 if (result == "fail") |
| 54 convertedResult = Fail; |
| 55 return m_paymentCompleter->complete(scriptState, convertedResult); |
51 } | 56 } |
52 | 57 |
53 DEFINE_TRACE(PaymentResponse) | 58 DEFINE_TRACE(PaymentResponse) |
54 { | 59 { |
55 visitor->trace(m_shippingAddress); | 60 visitor->trace(m_shippingAddress); |
56 visitor->trace(m_paymentCompleter); | 61 visitor->trace(m_paymentCompleter); |
57 } | 62 } |
58 | 63 |
59 } // namespace blink | 64 } // namespace blink |
OLD | NEW |