@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
23 lines (22 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkPaymentMethodsResponse = void 0;
const checkPaymentMethodsResponse = paymentMethodsResponse => {
if (paymentMethodsResponse === undefined) {
throw new Error('paymentMethodsResponse is undefined. Make sure to make POST `paymentMethods` or call `conext.startSession()`' + 'Try JSON.parse("{...}") your paymentMethodsResponse.');
}
if (typeof paymentMethodsResponse === 'string') {
throw new TypeError('paymentMethodsResponse was provided but of an incorrect type (should be an object but a string was provided).' + 'Try JSON.parse("{...}") your paymentMethodsResponse.');
}
if (Array.isArray(paymentMethodsResponse)) {
throw new TypeError('paymentMethodsResponse was provided but of an incorrect type (should be an object but an array was provided).' + 'Please check you are passing the whole response.');
}
if (!paymentMethodsResponse?.paymentMethods?.length && !paymentMethodsResponse?.storedPaymentMethods?.length) {
console.warn('paymentMethodsResponse was provided but no payment methods were found.');
}
return paymentMethodsResponse;
};
exports.checkPaymentMethodsResponse = checkPaymentMethodsResponse;
//# sourceMappingURL=checkPaymentMethodsResponse.js.map