MCPcopy Index your code
hub / github.com/ampproject/amphtml / start

Method start

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

* @param {!PaymentDataRequest} paymentRequest * @param {!PayOptionsDef=} options

(paymentRequest, options = {})

Source from the content-addressed store, hash-verified

18025 * @param {!PayOptionsDef=} options
18026 */
18027 start(paymentRequest, options = {}) {
18028 this.request_ = paymentRequest;
18029
18030 if (!this.client_) {
18031 this.preconnect(this.preconnect_);
18032 this.initializePaymentsClient_();
18033 }
18034 if (options.forceRedirect) {
18035 paymentRequest = Object.assign(paymentRequest, {
18036 'forceRedirect': options.forceRedirect || false,
18037 });
18038 }
18039 setInternalParam(
18040 paymentRequest,
18041 'disableNative',
18042 // The page cannot be iframed at this time. May be relaxed later
18043 // for AMP and similar contexts.
18044 options.forceDisableNative || this.win_ != this.top_()
18045 );
18046 let resolver = null;
18047 const promise = new Promise((resolve) => (resolver = resolve));
18048 // Notice that the callback for verifier may execute asynchronously.
18049 this.redirectVerifierHelper_.useVerifier((verifier) => {
18050 if (verifier) {
18051 setInternalParam(paymentRequest, 'redirectVerifier', verifier);
18052 }
18053 if (options.forceRedirect) {
18054 const client = this.client_;
18055 this.eventManager_.getReadyPromise().then(() => {
18056 this.analytics_.getLoggingPromise().then(() => {
18057 client.loadPaymentData(paymentRequest);
18058 resolver(true);
18059 });
18060 });
18061 } else {
18062 this.client_.loadPaymentData(paymentRequest);
18063 resolver(true);
18064 }
18065 });
18066 return promise;
18067 }
18068
18069 /**
18070 * @param {function(!Promise<!PaymentData>)} callback

Callers 15

test-animation.jsFile · 0.45
ZeFunction · 0.45
tFunction · 0.45
d3.jsFile · 0.45
start_Method · 0.45
startPayFlow_Method · 0.45
maybeOpenOffersFlow_Method · 0.45
startMethod · 0.45
attachSmartButtonMethod · 0.45
startPayFlow_Method · 0.45

Calls 10

preconnectMethod · 0.95
top_Method · 0.95
setInternalParamFunction · 0.85
assignMethod · 0.80
useVerifierMethod · 0.80
getLoggingPromiseMethod · 0.80
thenMethod · 0.45
getReadyPromiseMethod · 0.45
loadPaymentDataMethod · 0.45

Tested by

no test coverage detected