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