1var StripeBNPLBaseModel = function (stripe, redirectURL) { 2 this.stripe = stripe; 3 this.redirectURL = redirectURL; 4 5 this.supportedCountries = []; 6 this.supportedMerchantCountries = []; 7 8 this.isSupported = function (amount, currency, country, merchantCountry) { 9 return this.isSupportedMerchantCountry(merchantCountry) && this.isSupportedAmount(amount, currency, country); 10 }; 11 12 this.isSupportedAmount = function (amount, currency, country) { 13 if (typeof country === 'undefined') { 14 country = null; 15 } 16 17 return this.supportedCountries.some(function (item) { 18 var isSupportedAmount = item.currency === currency && amount >= item.minAmount && amount <= item.maxAmount; 19 20 if (!country) { 21 return isSupportedAmount; 22 } 23 24 return item.country === country && isSupportedAmount; 25 }); 26 }; 27 28 this.isSupportedCountry = function (country) { 29 return this.supportedCountries.some(function (item) { 30 return item.country === country; 31 }); 32 }; 33 34 this.isSupportedCurrency = function (currency, country) { 35 return this.supportedCountries.some(function (item) { 36 return item.country === country && item.currency === currency; 37 }); 38 }; 39 40 this.isSupportedMerchantCountry = function (country) { 41 return this.supportedMerchantCountries.some(function (c) { 42 return c === country; 43 }); 44 }; 45 46 this.getSupportedAmounts = function (country, currency) { 47 var index = this.supportedCountries.findIndex(function (item) { 48 return item.country === country && item.currency === currency; 49 }); 50 51 if (index === -1) { 52 return null; 53 } 54 55 return { 56 minAmount: this.supportedCountries[index].minAmount, 57 maxAmount: this.supportedCountries[index].maxAmount, 58 }; 59 }; 60};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.