blob: 12f380ffb6b13466d5aa8ebb0e686b0be1f9b802 [file] [log] [blame]
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
var gPaymentResponse = null;
/**
* Launches the PaymentRequest UI
*/
function buy() { // eslint-disable-line no-unused-vars
var options = {
requestPayerEmail: true,
requestPayerName: true,
requestPayerPhone: true,
};
getPaymentResponse(options)
.then(function(response) {
gPaymentResponse = response;
print(JSON.stringify(gPaymentResponse, undefined, 2));
});
}
/**
* Retry PaymentRequest UI with indicating validation error messages.
*
* @param {PaymentValidationErrors} validationErrors Represent validation errors
*/
function retry(validationErrors) { // eslint-disable-line no-unused-vars
if (gPaymentResponse == null) {
return;
}
gPaymentResponse.addEventListener('payerdetailchange', function(e) {
print(JSON.stringify(gPaymentResponse, undefined, 2));
});
gPaymentResponse.retry(validationErrors);
}