| 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/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/V8ObjectBuilder.h" | 8 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 9 #include "modules/payments/PaymentAddress.h" | 9 #include "modules/payments/PaymentAddress.h" |
| 10 #include "modules/payments/PaymentCompleter.h" | 10 #include "modules/payments/PaymentCompleter.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 result.addStringOrNull("shippingOption", shippingOption()) | 45 result.addStringOrNull("shippingOption", shippingOption()) |
| 46 .addStringOrNull("payerName", payerName()) | 46 .addStringOrNull("payerName", payerName()) |
| 47 .addStringOrNull("payerEmail", payerEmail()) | 47 .addStringOrNull("payerEmail", payerEmail()) |
| 48 .addStringOrNull("payerPhone", payerPhone()); | 48 .addStringOrNull("payerPhone", payerPhone()); |
| 49 | 49 |
| 50 return result.scriptValue(); | 50 return result.scriptValue(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 ScriptValue PaymentResponse::details(ScriptState* scriptState, | 53 ScriptValue PaymentResponse::details(ScriptState* scriptState, |
| 54 ExceptionState& exceptionState) const { | 54 ExceptionState& exceptionState) const { |
| 55 return ScriptValue( | 55 return ScriptValue(scriptState, |
| 56 scriptState, fromJSONString(scriptState->isolate(), m_stringifiedDetails, | 56 fromJSONString(scriptState->isolate(), |
| 57 exceptionState)); | 57 m_stringifiedDetails, exceptionState)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, | 60 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, |
| 61 const String& result) { | 61 const String& result) { |
| 62 PaymentCompleter::PaymentComplete convertedResult = PaymentCompleter::Unknown; | 62 PaymentCompleter::PaymentComplete convertedResult = PaymentCompleter::Unknown; |
| 63 if (result == "success") | 63 if (result == "success") |
| 64 convertedResult = PaymentCompleter::Success; | 64 convertedResult = PaymentCompleter::Success; |
| 65 else if (result == "fail") | 65 else if (result == "fail") |
| 66 convertedResult = PaymentCompleter::Fail; | 66 convertedResult = PaymentCompleter::Fail; |
| 67 return m_paymentCompleter->complete(scriptState, convertedResult); | 67 return m_paymentCompleter->complete(scriptState, convertedResult); |
| 68 } | 68 } |
| 69 | 69 |
| 70 DEFINE_TRACE(PaymentResponse) { | 70 DEFINE_TRACE(PaymentResponse) { |
| 71 visitor->trace(m_shippingAddress); | 71 visitor->trace(m_shippingAddress); |
| 72 visitor->trace(m_paymentCompleter); | 72 visitor->trace(m_paymentCompleter); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |