MCPcopy Create free account
hub / github.com/ampproject/amphtml / convertResponse_

Method convertResponse_

third_party/subscriptions-project/swg.js:18103–18130  ·  view source on GitHub ↗

* @param {!Promise<!PaymentData>} response * @param {?PaymentDataRequest} request * @return {!Promise<!PaymentData>} * @private

(response, request)

Source from the content-addressed store, hash-verified

18101 * @private
18102 */
18103 convertResponse_(response, request) {
18104 return response
18105 .then(
18106 // Temporary client side solution to remember the
18107 // input params. TODO: Remove this once server-side
18108 // input preservation is done and is part of the response.
18109 (res) => {
18110 if (request) {
18111 res['paymentRequest'] = request;
18112 }
18113 return res;
18114 }
18115 )
18116 .catch((reason) => {
18117 if (typeof reason == 'object' && reason['statusCode'] == 'CANCELED') {
18118 const error = createCancelError(this.win_);
18119 if (request) {
18120 error['productType'] = /** @type {!PaymentDataRequest} */ (request)[
18121 'i'
18122 ]['productType'];
18123 } else {
18124 error['productType'] = null;
18125 }
18126 return Promise.reject(error);
18127 }
18128 return Promise.reject(reason);
18129 });
18130 }
18131
18132 /**
18133 * @return {!Window}

Callers 2

onResponseMethod · 0.95
handleResponse_Method · 0.95

Calls 3

createCancelErrorFunction · 0.85
catchMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected