How to use the zalgo-promise/src.ZalgoPromise.reject function in zalgo-promise

To help you get started, we’ve selected a few zalgo-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paypal / paypal-card-components / src / component.js View on Github external
}).catch((err) => {
        if (!(err.details && err.details.find && err.details.find(detail => detail.issue === 'CONTINGENCY'))) {
          return ZalgoPromise.reject(err);
        }

        const url = `${ err.links.find(link => link.rel === '3ds-contingency-resolution').href  }`;
        return contingencyFlow.start(url);
      }).then((payload) => {
        // does contingency flow give a payload?
github paypal / paypal-card-components / src / component.js View on Github external
configuration.correlationId = correlationId;
    // $FlowFixMe
    configuration.paypalApi = getPayPalAPIDomain();

    const orderIdFunction = () => {
      return ZalgoPromise.resolve().then(() => {
        return options.createOrder();
      });
    };

    let button;

    if (buttonSelector && options.onApprove) {
      button = document.querySelector(buttonSelector);
      if (!button) {
        return ZalgoPromise.reject(new Error(`Could not find selector \`${ buttonSelector }\` on the page`));
      }
    }

    const hostedFieldsCreateOptions = JSON.parse(JSON.stringify(options));

    return btClient.create({
      authorization: clientToken,
      paymentsSdk:   true,
      configuration
    }).then((btClientInstance) => {
      hostedFieldsCreateOptions.paymentsSdk = true;
      hostedFieldsCreateOptions.client = btClientInstance;
      return hostedFields.create(hostedFieldsCreateOptions);
    }).then((hostedFieldsInstance) => {
      hostedFieldsInstance.submit = createSubmitHandler(hostedFieldsInstance, orderIdFunction);
github paypal / paypal-smart-payment-buttons / test / client / prerender.js View on Github external
            window.xprops.onApprove = avoid('onApprove', () => ZalgoPromise.reject(new Error(`Avoid onApprove`)));
github paypal / paypal-smart-payment-buttons / test / client / validation.js View on Github external
            window.xprops.createOrder = avoid('createOrder', () => ZalgoPromise.reject(new Error(`Avoid createOrder`)));
            window.xprops.onApprove = avoid('onApprove', () => ZalgoPromise.reject(new Error(`Avoid onApprove`)));
github krakenjs / post-robot / src / bridge / child.js View on Github external
} catch (err) {
                        return;
                    }

                    if (!window || window.closed) {
                        return;
                    }

                    try {
                        receiveMessage({
                            data:   message,
                            origin: this.origin,
                            source: this.source
                        }, { on, send });
                    } catch (err) {
                        ZalgoPromise.reject(err);
                    }
                }
github krakenjs / post-robot / src / bridge / parent.js View on Github external
}

                    const winDetails = popupWindowsByName.get(data.name);

                    if (!winDetails) {
                        return;
                    }

                    try {
                        receiveMessage({
                            data:   message,
                            origin: winDetails.domain,
                            source: winDetails.win
                        }, { on, send });
                    } catch (err) {
                        ZalgoPromise.reject(err);
                    }
                }
            };
github paypal / paypal-smart-payment-buttons / src / button / pay.js View on Github external
.catch(err => {
                    return ZalgoPromise.all([
                        close(),
                        ZalgoPromise.reject(err)
                    ]);
                }).then(noop);
        });