@paystack/checkout-js 1.19.0-dev.4 → 1.19.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/checkout.js CHANGED
@@ -27,4 +27,4 @@ var Paystack=function(t){"use strict";function e(t,e){var r=Object.keys(t);if(Ob
27
27
  * @since jsrsasign 2.1
28
28
  * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
29
29
  */
30
- var pt={};void 0!==pt.asn1&&pt.asn1||(pt.asn1={}),pt.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";e=new B(n,16).xor(t).add(B.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=pt.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,a=e.DERNull,s=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,l=e.DERPrintableString,f=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,g=e.DERGeneralizedTime,m=e.DERSequence,v=e.DERSet,y=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var S=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+S+":"))throw"undefined key: "+S;if("bool"==S)return new r(t[S]);if("int"==S)return new n(t[S]);if("bitstr"==S)return new i(t[S]);if("octstr"==S)return new o(t[S]);if("null"==S)return new a(t[S]);if("oid"==S)return new s(t[S]);if("enum"==S)return new u(t[S]);if("utf8str"==S)return new c(t[S]);if("numstr"==S)return new h(t[S]);if("prnstr"==S)return new l(t[S]);if("telstr"==S)return new f(t[S]);if("ia5str"==S)return new p(t[S]);if("utctime"==S)return new d(t[S]);if("gentime"==S)return new g(t[S]);if("seq"==S){for(var T=t[S],E=[],A=0;A<T.length;A++){var x=b(T[A]);E.push(x)}return new m({array:E})}if("set"==S){for(T=t[S],E=[],A=0;A<T.length;A++)x=b(T[A]),E.push(x);return new v({array:E})}if("tag"==S){var k=t[S];if("[object Array]"===Object.prototype.toString.call(k)&&3==k.length){var O=b(k[2]);return new y({tag:k[0],explicit:k[1],obj:O})}var C={};if(void 0!==k.explicit&&(C.explicit=k.explicit),void 0!==k.tag&&(C.tag=k.tag),void 0===k.obj)throw"obj shall be specified for 'tag'.";return C.obj=b(k.obj),new y(C)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},pt.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);n+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new B(n,2).toString(10),n="")}return e},pt.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new B(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=e(parseInt(s,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},pt.asn1.ASN1Object=function(){var t="";this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+t.length+",v="+this.hV;var e=this.hV.length/2,r=e.toString(16);if(r.length%2==1&&(r="0"+r),e<128)return r;var n=r.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+r},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},pt.asn1.DERAbstractString=function(t){pt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},ft.lang.extend(pt.asn1.DERAbstractString,pt.asn1.ASN1Object),pt.asn1.DERAbstractTime=function(t){pt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var a=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var s=i.getMilliseconds();if(0!=s){var u=n(String(s),3);a=a+"."+(u=u.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,r,n,i,o){var a=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},ft.lang.extend(pt.asn1.DERAbstractTime,pt.asn1.ASN1Object),pt.asn1.DERAbstractStructured=function(t){pt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},ft.lang.extend(pt.asn1.DERAbstractStructured,pt.asn1.ASN1Object),pt.asn1.DERBoolean=function(){pt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},ft.lang.extend(pt.asn1.DERBoolean,pt.asn1.ASN1Object),pt.asn1.DERInteger=function(t){pt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=pt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new B(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},ft.lang.extend(pt.asn1.DERInteger,pt.asn1.ASN1Object),pt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=pt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}pt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var r=0;r<=e;r++)t+="0";var n="";for(r=0;r<t.length-1;r+=8){var i=t.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+n},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},ft.lang.extend(pt.asn1.DERBitString,pt.asn1.ASN1Object),pt.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=pt.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}pt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},ft.lang.extend(pt.asn1.DEROctetString,pt.asn1.DERAbstractString),pt.asn1.DERNull=function(){pt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},ft.lang.extend(pt.asn1.DERNull,pt.asn1.ASN1Object),pt.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new B(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=e(parseInt(s,2))}return r};pt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(t){var e=pt.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},ft.lang.extend(pt.asn1.DERObjectIdentifier,pt.asn1.ASN1Object),pt.asn1.DEREnumerated=function(t){pt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=pt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new B(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},ft.lang.extend(pt.asn1.DEREnumerated,pt.asn1.ASN1Object),pt.asn1.DERUTF8String=function(t){pt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},ft.lang.extend(pt.asn1.DERUTF8String,pt.asn1.DERAbstractString),pt.asn1.DERNumericString=function(t){pt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},ft.lang.extend(pt.asn1.DERNumericString,pt.asn1.DERAbstractString),pt.asn1.DERPrintableString=function(t){pt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},ft.lang.extend(pt.asn1.DERPrintableString,pt.asn1.DERAbstractString),pt.asn1.DERTeletexString=function(t){pt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},ft.lang.extend(pt.asn1.DERTeletexString,pt.asn1.DERAbstractString),pt.asn1.DERIA5String=function(t){pt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},ft.lang.extend(pt.asn1.DERIA5String,pt.asn1.DERAbstractString),pt.asn1.DERUTCTime=function(t){pt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},ft.lang.extend(pt.asn1.DERUTCTime,pt.asn1.DERAbstractTime),pt.asn1.DERGeneralizedTime=function(t){pt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},ft.lang.extend(pt.asn1.DERGeneralizedTime,pt.asn1.DERAbstractTime),pt.asn1.DERSequence=function(t){pt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},ft.lang.extend(pt.asn1.DERSequence,pt.asn1.DERAbstractStructured),pt.asn1.DERSet=function(t){pt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},ft.lang.extend(pt.asn1.DERSet,pt.asn1.DERAbstractStructured),pt.asn1.DERTaggedObject=function(t){pt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,r){this.hT=e,this.isExplicit=t,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},ft.lang.extend(pt.asn1.DERTaggedObject,pt.asn1.ASN1Object);var dt=function(t){function e(r){var n=t.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(e.hasPrivateKeyProperty(r)||e.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}return g(e,t),e.prototype.parseKey=function(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?v.decode(t):y.unarmor(t),i=O.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=M(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=M(o,16);var a=i.sub[4].getHexStringValue();this.p=M(a,16);var s=i.sub[5].getHexStringValue();this.q=M(s,16);var u=i.sub[6].getHexStringValue();this.dmp1=M(u,16);var c=i.sub[7].getHexStringValue();this.dmq1=M(c,16);var h=i.sub[8].getHexStringValue();this.coeff=M(h,16)}else{if(2!==i.sub.length)return!1;var l=i.sub[1].sub[0];e=l.sub[0].getHexStringValue(),this.n=M(e,16),r=l.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new pt.asn1.DERInteger({int:0}),new pt.asn1.DERInteger({bigint:this.n}),new pt.asn1.DERInteger({int:this.e}),new pt.asn1.DERInteger({bigint:this.d}),new pt.asn1.DERInteger({bigint:this.p}),new pt.asn1.DERInteger({bigint:this.q}),new pt.asn1.DERInteger({bigint:this.dmp1}),new pt.asn1.DERInteger({bigint:this.dmq1}),new pt.asn1.DERInteger({bigint:this.coeff})]};return new pt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new pt.asn1.DERSequence({array:[new pt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new pt.asn1.DERNull]}),e=new pt.asn1.DERSequence({array:[new pt.asn1.DERInteger({bigint:this.n}),new pt.asn1.DERInteger({int:this.e})]}),r=new pt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new pt.asn1.DERSequence({array:[t,r]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return l(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var r="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(r,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+="-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n",t+="-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(st),gt=function(){function t(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new dt(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(f(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return l(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,r){try{return l(this.getKey().sign(t,e,r))}catch(t){return!1}},t.prototype.verify=function(t,e,r){try{return this.getKey().verify(t,f(e),r)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new dt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version="3.0.0-rc.1",t}();window.JSEncrypt=gt,t.JSEncrypt=gt,t.default=gt,Object.defineProperty(t,"__esModule",{value:!0})}(e)}(0,YT.exports);var $T=O,QT=z,tE=Ms,eE=ot,rE=QT(D.f),nE=QT([].push),iE=function(t){return function(e){for(var r,n=eE(e),i=tE(n),o=i.length,a=0,s=[];o>a;)r=i[a++],$T&&!rE(n,r)||nE(s,t?[r,n[r]]:n[r]);return s}},oE={entries:iE(!0),values:iE(!1)}.values;fi({target:"Object",stat:!0},{values:function(t){return oE(t)}});var aE=fi,sE=Es.find,uE=_d,cE="find",hE=!0;cE in[]&&Array(1).find((function(){hE=!1})),aE({target:"Array",proto:!0,forced:hE},{find:function(t){return sE(this,t,arguments.length>1?arguments[1]:void 0)}}),uE(cE);var lE=function(t){for(var e,r=0,n=!1,i=t.length-1;i>=0;)e=parseInt(t.charAt(i),10),n&&(e*=2)>9&&(e=e%10+1),n=!n,r+=e,i--;return r%10==0};var fE=function(t){return t?JSON.parse(JSON.stringify(t)):null};var pE=function(t){return"string"==typeof t||t instanceof String};var dE=function(t,e){return Array.isArray(e)?function(t,e,r){var n=String(e).length,i=t.substr(0,n),o=parseInt(i,10);return e=parseInt(String(e).substr(0,i.length),10),r=parseInt(String(r).substr(0,i.length),10),o>=e&&o<=r}(t,e[0],e[1]):function(t,e){return(e=String(e)).substring(0,t.length)===t.substring(0,e.length)}(t,e)},gE=fE,mE=dE;var vE,yE=function(t,e,r){var n,i,o,a;for(n=0;n<e.patterns.length;n++)if(i=e.patterns[n],mE(t,i)){a=gE(e),o=Array.isArray(i)?String(i[0]).length:String(i).length,t.length>=o&&(a.matchStrength=o),r.push(a);break}},bE={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}},wE=fE,SE=function(t){if(function(t){var e=t.filter((function(t){return t.matchStrength})).length;return e>0&&e===t.length}(t))return t.reduce((function(t,e){return t?t.matchStrength<e.matchStrength?e:t:e}))},TE=pE,EE=yE,AE={},xE={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},kE=[xE.VISA,xE.MASTERCARD,xE.AMERICAN_EXPRESS,xE.DINERS_CLUB,xE.DISCOVER,xE.JCB,xE.UNIONPAY,xE.MAESTRO,xE.ELO,xE.MIR,xE.HIPER,xE.HIPERCARD];function OE(t){return AE[t]||bE[t]}function CE(t,e){var r=vE.indexOf(t);if(!e&&-1===r)throw new Error('"'+t+'" is not a supported card type.');return r}function PE(t){var e,r=[];return TE(t)?0===t.length?vE.map((function(t){return wE(OE(t))})):(vE.forEach((function(e){var n=OE(e);EE(t,n,r)})),(e=SE(r))?[e]:r):[]}vE=wE(kE),PE.getTypeInfo=function(t){return wE(OE(t))},PE.removeCard=function(t){var e=CE(t);vE.splice(e,1)},PE.addCard=function(t){var e=CE(t.type,!0);AE[t.type]=t,-1===e&&vE.push(t.type)},PE.updateCard=function(t,e){var r,n=AE[t]||bE[t];if(!n)throw new Error('"'+t+'" is not a recognized type. Use `addCard` instead.');if(e.type&&n.type!==e.type)throw new Error("Cannot overwrite type parameter.");r=wE(n),Object.keys(r).forEach((function(t){e[t]&&(r[t]=e[t])})),AE[r.type]=r},PE.changeOrder=function(t,e){var r=CE(t);vE.splice(r,1),vE.splice(e,0,t)},PE.resetModifications=function(){vE=wE(kE),AE={}},PE.types=xE;var RE=PE,BE=lE,DE=RE;function IE(t,e,r){return{card:t,isPotentiallyValid:e,isValid:r}}var LE=function(t,e){var r,n,i,o,a;if(e=e||{},"number"==typeof t&&(t=String(t)),"string"!=typeof t)return IE(null,!1,!1);if(t=t.replace(/\-|\s/g,""),!/^\d*$/.test(t))return IE(null,!1,!1);if(0===(r=DE(t)).length)return IE(null,!1,!1);if(1!==r.length)return IE(null,!0,!1);if(n=r[0],e.maxLength&&t.length>e.maxLength)return IE(n,!1,!1);for(i=n.type===DE.types.UNIONPAY&&!0!==e.luhnValidateUnionPay||BE(t),a=Math.max.apply(null,n.lengths),e.maxLength&&(a=Math.min(e.maxLength,a)),o=0;o<n.lengths.length;o++)if(n.lengths[o]===t.length)return IE(n,t.length<a||i,i);return IE(n,t.length<a,!1)};function jE(t,e,r){return{isValid:t,isPotentiallyValid:e,isCurrentYear:r||!1}}var NE=function(t,e){var r,n,i,o,a;return e=e||19,"string"!=typeof t?jE(!1,!1):""===t.replace(/\s/g,"")?jE(!1,!0):/^\d*$/.test(t)?(n=t.length)<2?jE(!1,!0):(r=(new Date).getFullYear(),3===n?jE(!1,t.slice(0,2)===String(r).slice(0,2)):n>4?jE(!1,!1):(t=parseInt(t,10),i=Number(String(r).substr(2,2)),2===n?(a=i===t,o=t>=i&&t<=i+e):4===n&&(a=r===t,o=t>=r&&t<=r+e),jE(o,o,a))):jE(!1,!1)},ME=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},_E=NE,UE=ME;function VE(t,e,r){return{isValid:t,isPotentiallyValid:e,isValidForThisYear:r||!1}}var FE=function(t){var e,r,n=(new Date).getMonth()+1;return"string"!=typeof t?VE(!1,!1):""===t.replace(/\s/g,"")||"0"===t?VE(!1,!0):/^\d*$/.test(t)?(e=parseInt(t,10),isNaN(t)?VE(!1,!1):VE(r=e>0&&e<13,r,r&&e>=n)):VE(!1,!1)},qE=function(t){var e,r,n,i,o;return/^\d{4}-\d{1,2}$/.test(t)?t=t.split("-").reverse():/\//.test(t)?t=t.split(/\s*\/\s*/g):/\s/.test(t)&&(t=t.split(/ +/g)),UE(t)?{month:t[0]||"",year:t.slice(1).join()}:(n=t,r=0===(o=Number(n[0]))?2:o>1||1===o&&Number(n[1])>2?1:1===o?(i=n.substr(1),_E(i).isPotentiallyValid?1:2):5===n.length?1:n.length>5?2:1,{month:e=t.substr(0,r),year:t.substr(e.length)})},HE=FE,zE=NE;function GE(t,e,r,n){return{isValid:t,isPotentiallyValid:e,month:r,year:n}}function KE(t,e){return{isValid:t,isPotentiallyValid:e}}function WE(t,e){return{isValid:t,isPotentiallyValid:e}}var XE={number:LE,expirationDate:function(t,e){var r,n,i,o;if("string"==typeof t)t=t.replace(/^(\d\d) (\d\d(\d\d)?)$/,"$1/$2"),r=qE(t);else{if(null===t||"object"!=typeof t)return GE(!1,!1,null,null);r={month:String(t.month),year:String(t.year)}}if(n=HE(r.month),i=zE(r.year,e),n.isValid){if(i.isCurrentYear)return GE(o=n.isValidForThisYear,o,r.month,r.year);if(i.isValid)return GE(!0,!0,r.month,r.year)}return n.isPotentiallyValid&&i.isPotentiallyValid?GE(!1,!0,null,null):GE(!1,!1,null,null)},expirationMonth:FE,expirationYear:NE,cvv:function(t,e){return e=(e=e||3)instanceof Array?e:[e],"string"!=typeof t?KE(!1,!1):/^\d*$/.test(t)?function(t,e){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1}(e,t.length)?KE(!0,!0):t.length<Math.min.apply(null,e)?KE(!1,!0):t.length>function(t){for(var e=3,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return e}(e)?KE(!1,!1):KE(!0,!0):KE(!1,!1)},postalCode:function(t,e){var r;return r=(e=e||{}).minLength||3,"string"!=typeof t?WE(!1,!1):t.length<r?WE(!1,!0):WE(!0,!0)},creditCardType:RE},ZE=[{type:"bank_auth",name:"Bank authorization",number:"4084080000000409",cvv:"000",month:"01",year:"30"},{type:"success",name:"Success",number:"4084084084084081",cvv:"408",month:"12",year:"30"},{type:"declined",name:"Declined",number:"4084080000005408",cvv:"001",month:"12",year:"30"},{type:"pin",name:"Pin only validation",number:"507850785078507812",cvv:"884",month:"01",year:"30"},{type:"pin+otp",name:"Pin and OTP validation",number:"5060666666666666666",cvv:"123",month:"01",year:"30"},{type:"pin+phone+otp",name:"Pin, phone and OTP validation",number:"507850785078507812",cvv:"884",month:"01",year:"30"},{type:"default",name:"No validation",number:"4084084084084081",cvv:"408",month:"01",year:"30"}];XE.creditCardType.addCard({niceType:"Verve",type:"verve",patterns:[[506e3,507999],[65e4,650009]],gaps:[4,8,12,16],lengths:[16,18,19],code:{name:"CVV",size:3}}),XE.creditCardType.changeOrder("verve",0);var YE=function(){function t(e){var r=e.number,n=e.cvv,i=e.month,o=e.year,s=e.pin;a(this,t),this.number=r,this.cvv=n,this.month=i,this.year=o,this.pin=s}return u(t,[{key:"getEncryptedPin",value:function(){return this.pin?JT(this.pin):void 0}},{key:"getLast4",value:function(){return this.number.substring(this.number.length-4)}},{key:"tokenize",value:function(){return JT("".concat(this.number,"*").concat(this.cvv,"*").concat(this.month,"*").concat(this.year))}}],[{key:"getType",value:function(t){var e=XE.number(t);return e&&e.card?{type:e.card.type,maxLength:Math.max.apply(Math,b(e.card.lengths)),minLength:Math.min.apply(Math,b(e.card.lengths))}:{type:null,maxLength:0}}},{key:"validate",value:function(e){var r=e.number,n=e.cvv,i=e.month,o=e.year,a=t.getType(r).type,s={number:t.isNumberValid(r),expiry:t.isExpiryValid({month:i,year:o}),cvv:t.isCvvValid(n,a)};return{isValid:Object.values(s).every((function(t){return!0===t})),result:s}}},{key:"validateNumber",value:function(t){return XE.number(t)}},{key:"isNumberValid",value:function(e){return t.validateNumber(e).isValid}},{key:"validateCVV",value:function(t,e){var r="american-express"===e?4:3;return XE.cvv(t,r)}},{key:"isCvvValid",value:function(e,r){return t.validateCVV(e,r).isValid}},{key:"validateExpiry",value:function(t){if("object"===n(t)){var e=t.month,r=t.year;return XE.expirationMonth(e)&&XE.expirationYear(r)}return XE.expirationDate(t)}},{key:"isExpiryValid",value:function(e){return t.validateExpiry(e).isValid}},{key:"generateTestCard",value:function(e){var r=e||"default";return new t(ZE.find((function(t){return t.type===r})))}}]),t}(),JE=function(t){var e=t.clientdata,n=t.last4,i=t.pin,o=t.trans,a=t.device,s=t.rememberCard,u=t.transactionType,c=t.subscription,h=t.customFields,l="".concat(Dd.paymentBaseUrl,"charge/"),f=kT(),p=r({"Content-Type":"application/x-www-form-urlencoded"},f&&{"Accept-Language":f}),d=r(r(r({clientdata:e,last4:n,trans:o,device:a,offset:(new Date).getTimezoneOffset(),remember_card:s},u&&{transaction_type:u}),c&&{subscription:c}),h&&h);i&&(d.handle=i);var g=NT(d);return xT.post(l,g,{headers:p}).then((function(t){return Gd.parse(t.data)}))},$E=function(t){var e=t.device,n=t.accessCode,i=t.pin,o="".concat(Dd.paymentBaseUrl,"charge/resume/").concat(n),a=kT(),s=r({"Content-Type":"application/x-www-form-urlencoded"},a&&{"Accept-Language":a}),u=r({device:e},i&&{handle:i}),c=NT(u);return xT.post(o,c,{headers:s}).then((function(t){return Gd.parse(t.data)}))},QE=function(t){var e=t.last4,n=t.trans,i=t.device,o=t.authorizationCode,a=t.cvv,s=t.pin,u=t.transactionType,c=t.subscription,h="".concat(Dd.paymentBaseUrl,"charge/"),l=kT(),f=r({"Content-Type":"application/x-www-form-urlencoded"},l&&{"Accept-Language":l}),p=r(r({last4:e,trans:n,device:i,cvv:a,handle:s,authorization_code:o},u&&{transaction_type:u}),c&&{subscription:c}),d=NT(p);return xT.post(h,d,{headers:f}).then((function(t){return Gd.parse(t.data)}))},tA=function(t,e){var n="".concat(Dd.paymentBaseUrl,"charge/validate"),i={trans:t,token:e},o=kT(),a=r({},o&&{"Accept-Language":o}),s=NT(i);return xT.post(n,s,{headers:a}).then((function(t){return Gd.parse(t.data)}))},eA=function(t){var e=t.address,n=t.city,i=t.state,o=t.zipCode,a=t.transactionId,s="".concat(Dd.paymentBaseUrl,"charge/avs"),u=kT(),c=r({"Content-Type":"application/x-www-form-urlencoded"},u&&{"Accept-Language":u}),h=NT({city:n,state:i,address:e,zip_code:o,trans:a});return xT.post(s,h,{headers:c}).then((function(t){return Gd.parse(t.data)}))},rA=function(t){var e=t.authorizationId,n=t.publicKey,i=kT(),o=r({Authorization:"Bearer ".concat(n)},i&&{"Accept-Language":i}),a={authorization_id:e},s="".concat(Dd.paystackApiUrl,"rememberme/forget_card");return xT.post(s,a,{headers:o}).then((function(t){return Gd.parse(t.data)}))},nA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new URL("/authorize/".concat(t),Dd.savedCardsApiUrl).toString(),i=kT(),o=r({},i&&{"Accept-Language":i}),e.next=5,xT.post(n,{headers:o});case 5:return a=e.sent,s=a.data,e.abrupt("return",s);case 8:case"end":return e.stop()}}),e)})))()},iA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s,u,c,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.code,i=t.phone,o=t.transaction,a=new URL("/authorize/verify",Dd.savedCardsApiUrl).toString(),s=kT(),u=r({},s&&{"Accept-Language":s}),c={code:n,phone:i,transaction:o},e.next=7,xT.post(a,c,{headers:u});case 7:return h=e.sent,e.abrupt("return",h.data);case 9:case"end":return e.stop()}}),e)})))()},oA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.token,i=new URL("/cards",Dd.savedCardsApiUrl).toString(),o=kT(),a=r({Authorization:"Bearer ".concat(n),"jwt-auth":!0},o&&{"Accept-Language":o}),e.next=6,xT.get(i,{headers:a});case 6:return s=e.sent,e.abrupt("return",s.data);case 8:case"end":return e.stop()}}),e)})))()},aA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.cardCode,i=t.token,o=new URL("/cards/".concat(n),Dd.savedCardsApiUrl).toString(),a=kT(),s=r({Authorization:"Bearer ".concat(i),"jwt-auth":!0},a&&{"Accept-Language":a}),e.next=6,xT.delete(o,{headers:s});case 6:return u=e.sent,e.abrupt("return",u.data);case 8:case"end":return e.stop()}}),e)})))()},sA="card";function uA(t,e){return new Promise((function(r,n){var i=YE.validate(t);if(!i.isValid){var o=e||t.number,a=Object.keys(i.result).filter((function(t){return!1===i.result[t]})),s="Invalid card details: ".concat(a.join(", "));n(Error(o?s:"Please set a valid card with Transaction.setCard()"))}r()}))}var cA={setCard:function(t){var e=this;return uA(t,!0).then((function(){e.card=new YE(t)}))},rememberCard:function(){this.remember_card=!0},chargeCard:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!this.card.number&&this.card.pin?this.chargeCardWithPin(e):uA(this.card).then((function(){t.logAttempt(sA);var r={clientdata:t.card.tokenize(),last4:t.card.getLast4(),pin:t.card.getEncryptedPin(),trans:t.id,device:t.deviceFingerprint,rememberCard:t.remember_card,transactionType:t.transactionType,subscription:t.subscription,customFields:e};return JE(r).then((function(e){return t.logAPIResponse(e,sA),e}))}))},chargeCardWithPin:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logAttempt(sA);var r={pin:JT(this.card.pin),trans:this.id,device:this.deviceFingerprint,rememberCard:this.remember_card,transactionType:this.transactionType,subscription:this.subscription,customFields:e};return JE(r).then((function(e){return t.logAPIResponse(e,sA),e}))},chargeRememberedCard:function(t){var e=this,r=t.cvv,n=t.authorizationCode,i=t.cardLast4,o=t.pin;this.logAttempt(sA);var a=JT(o),s={authorizationCode:n,cvv:r,last4:i,trans:this.id,device:this.deviceFingerprint,pin:a,transactionType:this.transactionType,subscription:this.subscription};return QE(s).then((function(t){return e.logAPIResponse(t,sA),t}))},resumeCardCharge:function(t){var e=this,n=t.accessCode,i=t.pin,o=r(r({},i&&{pin:JT(i)}),{},{accessCode:n,device:this.deviceFingerprint});return $E(o).then((function(t){return e.logAPIResponse(t,sA),t}))},forgetRememberedCard:function(t){var e=this,r={authorizationId:t,publicKey:this.merchant.key};return rA(r).then((function(t){return e.logAPIResponse(t,sA),t}))},authenticateCard:function(t){var e=this;return tA(this.id,t).then((function(t){return e.logAPIResponse(t,sA),t}))},verifyAddress:function(t){var e=this,r=t.address,n={city:t.city,state:t.state,address:r,zipCode:t.zipCode,transactionId:this.id};return eA(n).then((function(t){return e.logAPIResponse(t,sA),t}))},listenFor3DSCharge:function(t){var e={channel:"3DS_".concat(this.id),paymentMethod:sA};return this.listenForCharge(e,t)},requestOtpForSavedCards:function(t){return nA(t)},verifySavedCardsOtp:function(t){var e=this;return o(regeneratorRuntime.mark((function r(){var n,i,o,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=t.code,i=t.phone,o={code:n,phone:i,transaction:e.id},r.next=4,iA(o);case 4:return a=r.sent,e.savedCardsToken=a.data.token,r.abrupt("return",a);case 7:case"end":return r.stop()}}),r)})))()},getSavedCards:function(){return oA({token:this.savedCardsToken})},deleteSavedCard:function(t){return aA({cardCode:t,token:this.savedCardsToken})}},hA=function(){function t(e){var r=e.bankId,n=e.accountType,i=e.accountNumber;a(this,t),this.bankId=r,this.accountType=n,this.accountNumber=i}return u(t,null,[{key:"validate",value:function(e){var r=e.bankId,n=e.accountType,i=e.accountNumber,o=[];return r&&"number"==typeof r||o.push("Invalid bankId. Please check for supported banks with BankAccount.supportedBanks()"),t.types.indexOf(n)>-1?"nuban"!==n||t.isValidNubanAccount(i)||o.push("Invalid account number. Nuban accounts must be 10 digit numbers"):o.push("Invalid bank type. Please check BankAccount.types for the list of valid bank types"),{isValid:0===o.length,errors:o}}},{key:"isValidNubanAccount",value:function(t){return!!t&&(("number"==typeof t||/^\d+$/.test(t))&&10===t.length)}},{key:"supportedBanks",value:function(){var t="".concat(Dd.paymentBaseUrl,"bank?pay_with_bank=true"),e=kT(),n=r({},e&&{"Accept-Language":e});return xT.post(t,{headers:n}).then((function(t){return t.data}))}}]),t}();hA.types=["nuban"];var lA=function(t){var e=t.bankId,n=t.transactionId,i=t.accountNumber,o=t.device,a="".concat(Dd.paymentBaseUrl,"bank/charge_account/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({account_number:i,device:o});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},fA=function(t){var e=t.bankId,n=t.transactionId,i=t.accountNumber,o=t.birthday,a="".concat(Dd.paymentBaseUrl,"bank/charge_account/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({account_number:i,birthday:o});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},pA=function(t){var e=t.bankId,n=t.transactionId,i=t.token,o=t.device,a="".concat(Dd.paymentBaseUrl,"bank/validate_token/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({device:o,token:i});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},dA="bank account";function gA(t,e){return new Promise((function(r,n){var i=hA.validate(t);if(!i.isValid){var o=e||t.accountNumber?i.errors[0]:"Please set a valid bank account with Transaction.setBank()";n(Error(o))}r()}))}var mA={getIbankUrl:function(t){var e=this,r=t.bankId;return new Promise((function(t,n){r||n(Error("Please send bankId"));var i="".concat(Dd.paymentBaseUrl,"bank/ibank/").concat(r,"/").concat(e.id);t(Gd.success({url:i}))}))},listenForIbankCharge:function(t){var e={channel:"IBANK_".concat(this.id),paymentMethod:"ibank"};return this.listenForCharge(e,t)}},vA=function(t){var e=t.bankId,n=t.transactionId,i=t.phoneNumber,o=t.payId,a="".concat(Dd.paymentBaseUrl,"bank/digitalbankmandate/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({phone_number:i,token:o});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},yA="bank",bA={chargeDigitalBankMandate:function(t){var e=this,r=t.phoneNumber,n=t.payId,i=t.bankId,o={transactionId:this.id,phoneNumber:r,payId:n,bankId:i};return vA(o).then((function(t){return e.logAPIResponse(t,yA),t}))},listenForDigitalBankMandateCharge:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r={paymentMethod:yA,channel:e};return this.listenForCharge(r,t)}},wA=r(r(r({},{setBankAccount:function(t){var e=this;return gA(t,!0).then((function(){e.bankAccount=new hA(t)}))},chargeBankAccount:function(){var t=this;return gA(this.bankAccount).then((function(){t.logAttempt(dA);var e={bankId:t.bankAccount.bankId,transactionId:t.id,accountNumber:t.bankAccount.accountNumber,device:t.deviceFingerprint};return lA(e).then((function(e){return t.logAPIResponse(e,dA),e}))}))},registerBankAccount:function(t){var e=this;return gA(this.bankAccount).then((function(){var r={bankId:e.bankAccount.bankId,transactionId:e.id,accountNumber:e.bankAccount.accountNumber,birthday:t};return fA(r).then((function(t){return e.logAPIResponse(t,dA),t}))}))},authenticateBankAccount:function(t){var e=this;return gA(this.bankAccount).then((function(){var r={bankId:e.bankAccount.bankId,transactionId:e.id,token:t,device:e.deviceFingerprint};return pA(r).then((function(t){return e.logAPIResponse(t,dA),t}))}))}}),mA),bA),SA=function(t,e){var n=kT(),i=r({Authorization:"Bearer ".concat(e)},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"checkout/ussd/reference"),t,{headers:i}).then((function(t){return Gd.parse(t.data)}))},TA=function(t,e){var n=kT(),i=r({Authorization:"Bearer ".concat(e)},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"checkout/pay_with_transfer_ussd"),t,{headers:i}).then((function(t){return Gd.parse(t.data)}))},EA={getUSSDShortcode:function(t){var e=this,r=t.channel,n={transaction:this.id,channel:r};return SA(n,this.merchant.key).then((function(t){return"success"===t.status&&(e.ussd[r]=t),t}))},getPWTUSSDShortcode:function(t){var e=this,r=t.bankSlug,n=t.fulfilLateNotification,i=void 0!==n&&n,o={transaction_id:this.id,fulfil_late_notification:i,bank_slug:r};return TA(o,this.merchant.key).then((function(t){return"success"===t.status&&(e.ussd[r]=t),t}))},listenForPWTUSSDCharge:function(t,e){var r=t.bankSlug;if(!this.ussd[r])return Promise.reject(Error("Please generate a ussd shortcode with Transaction.getPWTUSSDShortcode()"));var n={channel:this.ussd[r].data.pusher_channel,paymentMethod:"ussd"};return this.listenForCharge(n,e)},listenForUSSDCharge:function(t,e){var r=t.channel;if(!this.ussd[r])return Promise.reject(Error("Please generate a ussd shortcode with Transaction.getUSSDShortcode()"));var n={channel:this.ussd[r].data.channel,paymentMethod:r};return this.listenForCharge(n,e)}},AA=function(t,e){var n={source:"checkout",reference:t.transaction,channel:t.channel},i=kT(),o=r({Authorization:"Bearer ".concat(e)},i&&{"Accept-Language":i});return xT.post("".concat(Dd.paystackApiUrl,"offline/qr/generate"),n,{headers:o}).then((function(t){return Gd.parse(t.data)}))};function xA(t){return new Promise((function(e,r){var n=["visa","MPASS_OLTI"];if(n.indexOf(t)<=-1){var i="Invalid channel. Available channels: ".concat(n.join(", "));r(Error(i))}else e()}))}var kA={getQRCode:function(t){var e=this,r=t.channel;return xA(r).then((function(){if(e.qr[r])return e.qr[r];var t={transaction:e.id,channel:r};return AA(t,e.merchant.key).then((function(t){return"success"===t.status&&(e.qr[r]=t),t}))}))},listenForQRCharge:function(t,e){var r=this,n=t.channel;return xA(n).then((function(){if(!r.qr[n])return Promise.reject(Error("Please generate qr code with Transaction.getQRCode()"));var t={channel:r.qr[n].data.channel,paymentMethod:n};return r.listenForCharge(t,e)}))}},OA=function(){function t(){a(this,t)}return u(t,null,[{key:"hasCountryCode",value:function(t){return t&&"+"===t[0]}},{key:"hasOnlyDigits",value:function(t){var e;return t&&(e=t.substring(1),/^\d+$/.test(e))}},{key:"isE164Number",value:function(t){return t&&t.length<17}},{key:"validate",value:function(e){var r=[];return t.hasCountryCode(e)||r.push("Number should include country code prefix"),t.hasOnlyDigits(e)||r.push("Number should contain only digits"),t.isE164Number(e)||r.push("Number should not be longer than 16 digits"),{isValid:0===r.length,errors:r}}}]),t}(),CA=function(t){var e={transaction:t.transaction,phone:t.phone,device:t.device,channel_name:t.channel_name,provider:t.provider,voucher:t.voucher,registration_token:t.registrationToken},n=kT(),i=r({},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"charge/mobile_money"),e,{headers:i}).then((function(t){return Gd.parse(t.data)})).catch((function(t){var e=t.response;return Gd.parse(e.data)}))},PA=function(t){var e=t.transaction,n=t.code,i=kT(),o=r({},i&&{"Accept-Language":i}),a=NT({transaction:e,otp:n}),s=new URL("charge/momo_payin_finalize",Dd.paymentBaseUrl).toString();return xT.post(s,a,{headers:o}).then((function(t){return Gd.parse(t.data)}))};function RA(t){return new Promise((function(e,r){var n=OA.validate(t);if(!n.isValid){var i=t?n.errors[0]:"Please start a mobile money transaction with Transaction.chargeMobileMoney()";r(Error(i))}e(n)}))}var BA={chargeMobileMoney:function(t){var e=this,r=t.phoneNumber,n=t.provider,i=t.voucher,o=t.registrationToken;return RA(r).then((function(){e.logAttempt("mobile money");var t={provider:n,voucher:i,registrationToken:o,transaction:e.id,phone:r,device:e.deviceFingerprint,channel_name:"MOBILE_MONEY_".concat(e.id)};return CA(t).then((function(t){return"success"===t.status&&(e.mobileMoney=t,t.data&&t.data.display&&1===t.data.display.otpSentCount&&e.logTokenRequest("mobile money")),t}))}))},authenticateMobileMoney:function(t){var e=this,r=t.phoneNumber,n=t.provider,i=t.registrationToken;return RA(r).then((function(){e.logMobileMoneyActions(t);var o={provider:n,registrationToken:i,transaction:e.id,phone:r,device:e.deviceFingerprint,channel_name:"MOBILE_MONEY_".concat(e.id)};return CA(o).then((function(t){return"success"===t.status?(e.mobileMoney=t,t.data&&t.data.display&&1===t.data.display.otpSentCount&&e.logTokenRequest("mobile money")):t.errors&&t.errors.data&&"awaiting_registration_token"===t.errors.data.status?e.logTokenAuthenticationFailure(t.message):e.logError(t.message),t}))}))},submitMobileMoneyCode:function(t){var e=this;return PA({code:t.code,transaction:this.id}).then((function(t){return e.logAPIResponse(t,"mobile_money"),t}))},listenForMobileMoneyCharge:function(t){if("success"!==this.mobileMoney.status)return Promise.reject(Error("Please start a mobile money charge with Transaction.chargeMobileMoney()"));var e=this.mobileMoney.data,r=e.channel,n=e.channel_name,i={channel:r||n,paymentMethod:"mobile_money"};return this.listenForCharge(i,t)}},DA=function(t,e){var n="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/verify"),i=kT(),o=r({Authorization:"Bearer ".concat(e)},i&&{"Accept-Language":i});return xT.post(n,{phone:t},{headers:o}).then((function(t){return t.data}))},IA=function(t,e,n){var i="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/remove_card"),o=kT(),a=r({Authorization:"Bearer ".concat(e)},o&&{"Accept-Language":o});return xT.post(i,{phone:t,id:n},{headers:a}).then((function(t){return t.data}))},LA=function(t,e,n,i){var o="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/validate_otp"),a=kT(),s=r({Authorization:"Bearer ".concat(e)},a&&{"Accept-Language":a});return xT.post(o,{phone:t,otp:n,transaction:i},{headers:s}).then((function(t){return t.data}))},jA=function(t,e,n,i){var o="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/validate_pin"),a=kT(),s=r({Authorization:"Bearer ".concat(e)},a&&{"Accept-Language":a});return xT.post(o,{phone:t,pin:n,transaction:i},{headers:s}).then((function(t){return t.data}))},NA=function(t,e,n,i,o){var a=kT(),s="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/set_pin"),u=r({Authorization:"Bearer ".concat(e)},a&&{"Accept-Language":a});return xT.post(s,{phone:t,token:n,transaction:i,pin:o},{headers:u}).then((function(t){return t.data}))},MA=function(t,e,n,i,o,a){var s="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/charge"),u=kT(),c=r({Authorization:"Bearer ".concat(e)},u&&{"Accept-Language":u});return xT.post(s,{id:t,token:n,cvv:o,transaction:i,phone:a},{headers:c}).then((function(t){return t.data}))},_A=function(t,e,n){var i="".concat(Dd.paystackApiUrl,"checkout/pay_with_phone/enroll"),o=kT(),a=r({Authorization:"Bearer ".concat(e)},o&&{"Accept-Language":o});return xT.post(i,{phone:t,transaction:n},{headers:a}).then((function(t){return t.data}))};function UA(t){return new Promise((function(e,r){var n=OA.validate(t);if(!n.isValid){var i=t?n.errors[0]:"Please set a valid customer with Transaction.setCustomer()";r(Error(i))}e(n)}))}var VA={setCustomer:function(t){var e=this,r=t.phoneNumber;return UA(r).then((function(){e.customer=r}))},verifyCustomer:function(){var t=this;return UA(this.customer).then((function(){return DA(t.customer,t.merchant.key)}))},deleteSavedCard:function(t){var e=this;return UA(this.customer).then((function(){return IA(e.customer,e.merchant.key,t)}))},authenticateCustomerOtp:function(t){var e=this;return UA(this.customer).then((function(){return LA(e.customer,e.merchant.key,t,e.id)}))},authenticateCustomerPin:function(t){var e=this;return UA(this.customer).then((function(){return jA(e.customer,e.merchant.key,t,e.id)}))},setCustomerPin:function(t){var e=this,r=t.pin,n=t.token;return UA(this.customer).then((function(){return NA(e.customer,e.merchant.key,n,e.id,r)}))},chargeSavedCard:function(t){var e=this,r=t.cardId,n=t.token,i=t.cvv;return UA(this.customer).then((function(){return MA(r,e.merchant.key,n,e.id,i,e.customer)}))},enrollPhoneNumber:function(t){var e=this;return UA(this.customer).then((function(){return _A(t,e.merchant.key,e.id)}))}},FA=function(t){var e={email:t.email,password:t.password},n=kT(),i=r({},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"login"),e,{headers:i}).then((function(t){return Gd.parse(t.data)}))},qA=function(t){var e=t.account_code,n=t.transaction,i=t.token,o=kT(),a=r({Authorization:"Bearer ".concat(i),"jwt-auth":!0},o&&{"Accept-Language":o}),s={account_code:e,transaction:n};return xT.post("".concat(Dd.paystackApiUrl,"directdebit/initiate"),s,{headers:a}).then((function(t){return Gd.parse(t.data)}))},HA=function(t){var e=t.otp,n=t.transaction,i=t.token,o=kT(),a=r({Authorization:"Bearer ".concat(i),"jwt-auth":!0},o&&{"Accept-Language":o}),s={otp:e,transaction:n};return xT.post("".concat(Dd.paystackApiUrl,"directdebit/validate"),s,{headers:a}).then((function(t){return Gd.parse(t.data)}))},zA=function(t){var e=kT(),n=r({Authorization:"Bearer ".concat(t),"jwt-auth":!0},e&&{"Accept-Language":e});return xT.get("".concat(Dd.paystackApiUrl,"directdebit/account"),{headers:n}).then((function(t){return t.data}))},GA="direct debit",KA={loginToDirectDebitAccount:function(t){var e=this,r=t.email,n={email:r,password:t.password};return Mc(r)?FA(n).then((function(t){if("success"===t.status){var r=t.data,n=r.token,i=r.user.permissions;if(!i||i.length<1)throw Error("You do not have the privileges to perform this action");if(i.find((function(t){return"directdebit-*"===t})))return e.directDebit.token=n,t;throw Error("You do not have the privileges to perform this action")}return t})):Promise.reject(Error("Invalid email"))},chargeDirectDebit:function(t){var e=this;if(!this.directDebit.token)return Promise.reject(Error("Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge"));this.logAttempt(GA);var r={account_code:t,transaction:this.id,token:this.directDebit.token};return qA(r).then((function(t){return e.logAPIResponse(t,GA),t.status&&(e.directDebit.chargeResponse=t),t}))},getProvisionedAccounts:function(){var t=this;return zA(this.directDebit.token).then((function(e){t.logAPIResponse(e,GA);var r=e.status,n=e.data;if(r){if(n&&n.length<1)return Promise.reject(Error("You have not provisioned any bank account for Direct Debit yet"));t.directDebit.accounts=e.data}return e}))},authenticateAccount:function(t){var e=this,r={otp:t,transaction:this.id,token:this.directDebit.token};return HA(r).then((function(t){return e.logAPIResponse(t,GA),t}))}},WA=function(t){return{card:cA,bank:wA,ussd:EA,qr:kA,mobile_money:BA,phone:VA,direct_debit:KA,bank_transfer:LT,eft:VT,payattitude:UT,apple_pay:zT,paypal:ZT}[t]},XA=function(t){t||"undefined"==typeof navigator||(t=navigator.userAgent);t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]);return"string"==typeof t&&(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))};var ZA=fi,YA=ft,JA=fa,$A=z,QA=k,tx=A.Array,ex=YA("JSON","stringify"),rx=$A(/./.exec),nx=$A("".charAt),ix=$A("".charCodeAt),ox=$A("".replace),ax=$A(1..toString),sx=/[\uD800-\uDFFF]/g,ux=/^[\uD800-\uDBFF]$/,cx=/^[\uDC00-\uDFFF]$/,hx=function(t,e,r){var n=nx(r,e-1),i=nx(r,e+1);return rx(ux,t)&&!rx(cx,i)||rx(cx,t)&&!rx(ux,n)?"\\u"+ax(ix(t,0),16):t},lx=QA((function(){return'"\\udf06\\ud834"'!==ex("\udf06\ud834")||'"\\udead"'!==ex("\udead")}));ex&&ZA({target:"JSON",stat:!0,forced:lx},{stringify:function(t,e,r){for(var n=0,i=arguments.length,o=tx(i);n<i;n++)o[n]=arguments[n];var a=JA(ex,null,o);return"string"==typeof a?ox(a,sx,hx):a}});var fx=function(t,e,n){var i="".concat(Dd.paystackApiUrl,"transaction/update_log/").concat(t),o=kT(),a=r({Authorization:"Bearer ".concat(e)},o&&{"Accept-Language":o});return xT.post(i,{payload:JSON.stringify(n)},{headers:a}).then((function(t){return t.data}))},px=function(t,e){var n="".concat(Dd.paystackApiUrl,"transaction/set_ip/").concat(t),i=kT(),o=r({Authorization:"Bearer ".concat(e)},i&&{"Accept-Language":i});return xT.post(n,null,{headers:o}).then((function(t){return t.data}))},dx=function(t,e,n){var i="".concat(Dd.paystackApiUrl,"transaction/set_referrer/").concat(t),o=kT(),a=r({Authorization:"Bearer ".concat(e)},o&&{"Accept-Language":o});return xT.post(i,{referrer:n},{headers:a}).then((function(t){return t.data}))},gx={initializeLog:function(t){var e=t||{},r=e.attempts,n=e.authentication,i=e.errors,o=e.history;this.log={start_time:Math.round(Date.now()/1e3),time_spent:0,attempts:r||0,authentication:n,errors:i||0,success:!1,mobile:XA(),input:[],history:o||[]}},getTimeSpent:function(){var t=Math.round(Date.now()/1e3);return this.log.time_spent=t-this.log.start_time,this.log.time_spent},logPageOpen:function(){return this.log.history.push({type:"open",message:"Opened checkout",time:this.getTimeSpent()}),this.saveLog()},logChannelSwitch:function(t){return this.log.history.push({type:"action",message:"Set payment method to: ".concat(t),time:this.getTimeSpent()}),this.saveLog()},logValidationErrors:function(t){var e=this;return t.forEach((function(t){e.log.history.push({type:"error",message:"Invalid ".concat(t),time:e.getTimeSpent()})})),this.saveLog()},logInput:function(t){var e=this.log.history.find((function(e){return e.message==="Filled this field: ".concat(t)}));return this.log.history.push({type:"input",message:"".concat(e?"Changed":"Filled"," this field: ").concat(t),time:this.getTimeSpent()}),this.saveLog()},logBankSelect:function(t){return this.log.history.push({type:"action",message:"Selected bank: ".concat(t),time:this.getTimeSpent()}),this.saveLog()},logAuthWindowOpen:function(){return this.log.history.push({type:"action",message:"Third-party authentication window opened",time:this.getTimeSpent()}),this.saveLog()},logAuthWindowClose:function(){return this.log.history.push({type:"action",message:"Third-party authentication window closed",time:this.getTimeSpent()}),this.saveLog()},logAPIResponse:function(t,e){switch(t.status){case"success":return this.logSuccess(e);case"pending":return this.logPending(e);case"failed":return this.logError(t.message);case"auth":return this.logAuth(t.data.auth);default:return!1}},logMobileMoneyActions:function(t){var e=t.numberOfTokenRequests,r=t.registrationToken;e?this.logTokenRequest("mobile money",e):r?this.logTokenSubmitted("mobile money"):this.logAttempt("mobile money")},logAPIResponseMessage:function(t){return this.log.history.push({type:"action",message:t,time:this.getTimeSpent()}),this.saveLog()},logAttempt:function(t){var e="Attempted to pay";return t&&(e+=" with ".concat(t)),this.log.attempts+=1,this.log.history.push({type:"action",message:e,time:this.getTimeSpent()}),this.saveLog()},logTokenRequest:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0===e?"Waiting for customer to submit OTP":"Customer requested to resend OTP";return this.log.history.push({type:"action",message:r,channel:t,time:this.getTimeSpent()}),this.saveLog()},logTokenSubmitted:function(t){return this.log.history.push({type:"action",message:"Customer submitted OTP",channel:t,time:this.getTimeSpent()}),this.saveLog()},logTokenAuthenticationFailure:function(t){var e=t?"Error: ".concat(t):"Error";return this.log.errors+=1,this.log.history.push({type:"error",message:e,authentication:"failed",time:this.getTimeSpent()}),this.saveLog()},logError:function(t){var e="Error";return t&&(e+=": ".concat(t)),this.log.errors+=1,this.log.history.push({type:"error",message:e,time:this.getTimeSpent()}),this.saveLog()},logAuth:function(t){return this.log.authentication=t,this.log.history.push({type:"auth",message:"Authentication Required: ".concat(t),time:this.getTimeSpent()}),this.saveLog()},logSuccess:function(t){var e="Successfully paid";return t&&(e+=" with ".concat(t)),this.log.success=!0,this.log.history.push({type:"success",message:e,time:this.getTimeSpent()}),this.saveLog()},logPending:function(t){var e="Payment in progress";return t&&(e+=" with ".concat(t)),this.log.history.push({type:"pending",message:e,time:this.getTimeSpent()}),this.saveLog()},logPageClose:function(){return this.log.history.push({type:"close",message:"Closed checkout",time:this.getTimeSpent()}),this.saveLog()},saveLog:function(){return fx(this.id,this.merchant.key,this.log)},saveIpAddress:function(){return px(this.id,this.merchant.key)},saveReferrer:function(t){return dx(this.id,this.merchant.key,t)}},mx=function(){function t(e){var r=this;a(this,t),this.email=e.email,this.merchant={id:e.merchant_id,logo:e.merchant_logo,name:e.merchant_name,key:e.merchant_key,channelSettings:e.merchant_channel_settings||{}},this.status=e.transaction_status||e.status,this.accessCode=e.access_code,this.amount=e.amount,this.domain=e.domain,this.isTest="test"===e.domain,this.currency=e.currency,this.id=e.id,this.channels=e.channels,this.label=e.label,this.metadata=e.metadata||{},this.cancel_action=e.cancel_action||null,this.channel_options=e.channel_options||null,this.hash=e.hash||null,this.authorizations=e.authorizations,this.remember_card=!1,this.rememberMeEnabled=e.is_remember_me_enabled,this.card={},this.bankAccount={},this.mobileMoney={},this.ussd={},this.bankTransfer={},this.qr={},this.directDebit={},this.deviceFingerprint=e.deviceFingerprint||null,this.customer=e.customer,this.custom_filters=e.custom_filters||null,this.isCharging=!1,this.isListening=!1,this.transactionType=e.transaction_type||null,this.subscription=e.subscription||null,this.planDetails=e.plan_details||null,this.exchangeRate=e.exchange_rate||null,this.savedCardsToken=null,this.isSavedCardsEnabled=e.saved_cards&&e.saved_cards.enabled||null,window?new Promise((function(t,e){var r=new XMLHttpRequest;r.open("GET",Dd.pusherUrl),r.onload=function(){if(r.status>=200&&r.status<300){var n=document.createElement("script");n.appendChild(document.createTextNode(r.responseText)),document.head.appendChild(n),t()}else e(r.statusText)},r.onerror=function(){return e(r.statusText)},r.send(null)})):Promise.reject(new Error("Window object not available")),this.log=null,Object.assign(this,gx),this.initializeLog(e.log),this.saveIpAddress(),this.channels.forEach((function(t){var e=WA(t);Object.assign(r,e)})),"GHS"===e.currency&&e.elevy_percentage&&(this.elevyPercentage=e.elevy_percentage)}return u(t,[{key:"setMetadata",value:function(t,e){this.metadata[t]=e}},{key:"setDevice",value:function(t){this.deviceFingerprint?ld("Device ID has already been set by Checkout JS so there's no need to set this again"):this.deviceFingerprint=t}},{key:"listenForCharge",value:function(t,e){var r,n=this,i=t.channel,o=t.paymentMethod;window&&window.Pusher&&(r=new window.Pusher(Dd.pusherKey,{cluster:"eu",disableStats:!0}));var a={status:"error",message:"We could not listen for charge response. Use transaction.requery() to check the status."},s=function(){r.unsubscribe(i)};if(!r)return e({status:"error",message:"We could not listen for charge response."},Id);var u=r.subscribe(i);u.bind("pusher:subscription_succeeded",(function(){n.isListening=!0})),u.bind("pusher:subscription_error",(function(){n.isListening=!1,e(a,Id)})),u.bind("response",(function(t){var r=Gd.parse(t);n.logAPIResponse(r,o),e(r,s)}))}},{key:"requery",value:function(){return BT(this.id)}},{key:"markAsAbandoned",value:function(){return DT({publicKey:this.merchant.key,transactionId:this.id})}}]),t}(),vx={validate:function(t){var e=function(t){var e=[];return t&&"object"===n(t)?(Object.keys(Vc).forEach((function(r){var n=Vc[r],i=t[r];!n.required||i||t[n.fallback]?i&&!n.isValid(i)&&e.push({field:r,message:"Invalid field: ".concat(r)}):e.push({field:r,message:"Required field: ".concat(r)})})),e):(e.push({message:"Please supply a valid object"}),e)}(t);if(e.length){var r=y(e,1)[0].message;throw new rs(e,r)}},request:function(t){return o(regeneratorRuntime.mark((function e(){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pd();case 2:return n=e.sent,e.next=5,OT(r(r({},t),{device:n}));case 5:return i=e.sent,e.abrupt("return",i&&Object.seal(new mx(r(r({},i.data),{deviceFingerprint:n}))));case 7:case"end":return e.stop()}}),e)})))()},requestWithAccessCode:function(t){return o(regeneratorRuntime.mark((function e(){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pd();case 2:return n=e.sent,e.next=5,CT(t);case 5:return i=e.sent,e.abrupt("return",i&&Object.seal(new mx(r(r({},i.data),{deviceFingerprint:n}))));case 7:case"end":return e.stop()}}),e)})))()},getByAccessCode:function(t,e){return o(regeneratorRuntime.mark((function n(){var i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,pd();case 2:return i=n.sent,n.next=5,PT(t,e);case 5:return o=n.sent,n.abrupt("return",o&&Object.seal(new mx(r(r({},o.data),{deviceFingerprint:i}))));case 7:case"end":return n.stop()}}),n)})))()},initialize:function(t){return Object.seal(new mx(t))},verify:function(t){return o(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,RT(t);case 2:return r=e.sent,e.abrupt("return",r&&r.data);case 4:case"end":return e.stop()}}),e)})))()}},yx={},bx=function(t){var e=new URL("/bank",Dd.paystackApiUrl).toString(),n=kT(),i={params:t,headers:r({},n&&{"Accept-Language":n})};return xT.get(e,i).then((function(t){return t.data}))},wx=function(){var t=new URL("/checkout/resolutions",Dd.paystackApiUrl).toString(),e=kT(),n=r({},e&&{"Accept-Language":e});return xT.get(t,{headers:n}).then((function(t){return t.data}))},Sx=function(){var t=new URL("/checkout/celebrations",Dd.paystackApiUrl).toString(),e=kT(),n=r({},e&&{"Accept-Language":e});return xT.get(t,{headers:n}).then((function(t){return t.data}))},Tx=function(t){var e=new URL("/address_verification/states",Dd.paystackApiUrl).toString(),n=kT(),i={params:t,headers:r({},n&&{"Accept-Language":n})};return xT.get(e,i).then((function(t){return t.data}))},Ex=function(t){var e=new URL("/decision/bin/".concat(t),Dd.paystackApiUrl).toString(),n=kT(),i=r({},n&&{"Accept-Language":n});return yx[t]?Promise.resolve(yx[t]):xT.get(e,{headers:i}).then((function(e){var r=e.data;return yx[t]=r,r}))},Ax=function(){function t(){a(this,t)}return u(t,null,[{key:"contents",value:function(){return[{key:"banks",usage:"Returns a list of banks that can be used to complete checkout"},{key:"resolutions",usage:"Returns a list of known errors, mapped to their suggested resolutions"},{key:"celebrations",usage:"Returns a list of upcoming celebrations"},{key:"states",usage:"Returns a list of states for a particular country"}]}},{key:"fetch",value:function(t,e){var r;if(this.contents().map((function(t){return t.key})).indexOf(t)<=-1)throw new Error("Please provide a valid config key. Use Toolkit.contents() to see available options.");switch(t){case"banks":r=bx(e||{pay_with_bank:"1"});break;case"resolutions":r=wx();break;case"celebrations":r=Sx();break;case"states":r=Tx(e)}return r}},{key:"resolveCardBin",value:function(t){return Ex(t)}}]),t}();return t.BankAccount=hA,t.Card=YE,t.Toolkit=Ax,t.Transaction=vx,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
30
+ var pt={};void 0!==pt.asn1&&pt.asn1||(pt.asn1={}),pt.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";e=new B(n,16).xor(t).add(B.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=pt.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,a=e.DERNull,s=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,l=e.DERPrintableString,f=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,g=e.DERGeneralizedTime,m=e.DERSequence,v=e.DERSet,y=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var S=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+S+":"))throw"undefined key: "+S;if("bool"==S)return new r(t[S]);if("int"==S)return new n(t[S]);if("bitstr"==S)return new i(t[S]);if("octstr"==S)return new o(t[S]);if("null"==S)return new a(t[S]);if("oid"==S)return new s(t[S]);if("enum"==S)return new u(t[S]);if("utf8str"==S)return new c(t[S]);if("numstr"==S)return new h(t[S]);if("prnstr"==S)return new l(t[S]);if("telstr"==S)return new f(t[S]);if("ia5str"==S)return new p(t[S]);if("utctime"==S)return new d(t[S]);if("gentime"==S)return new g(t[S]);if("seq"==S){for(var T=t[S],E=[],A=0;A<T.length;A++){var x=b(T[A]);E.push(x)}return new m({array:E})}if("set"==S){for(T=t[S],E=[],A=0;A<T.length;A++)x=b(T[A]),E.push(x);return new v({array:E})}if("tag"==S){var k=t[S];if("[object Array]"===Object.prototype.toString.call(k)&&3==k.length){var O=b(k[2]);return new y({tag:k[0],explicit:k[1],obj:O})}var C={};if(void 0!==k.explicit&&(C.explicit=k.explicit),void 0!==k.tag&&(C.tag=k.tag),void 0===k.obj)throw"obj shall be specified for 'tag'.";return C.obj=b(k.obj),new y(C)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},pt.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);n+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new B(n,2).toString(10),n="")}return e},pt.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new B(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=e(parseInt(s,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},pt.asn1.ASN1Object=function(){var t="";this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+t.length+",v="+this.hV;var e=this.hV.length/2,r=e.toString(16);if(r.length%2==1&&(r="0"+r),e<128)return r;var n=r.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+r},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},pt.asn1.DERAbstractString=function(t){pt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},ft.lang.extend(pt.asn1.DERAbstractString,pt.asn1.ASN1Object),pt.asn1.DERAbstractTime=function(t){pt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var a=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var s=i.getMilliseconds();if(0!=s){var u=n(String(s),3);a=a+"."+(u=u.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,r,n,i,o){var a=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},ft.lang.extend(pt.asn1.DERAbstractTime,pt.asn1.ASN1Object),pt.asn1.DERAbstractStructured=function(t){pt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},ft.lang.extend(pt.asn1.DERAbstractStructured,pt.asn1.ASN1Object),pt.asn1.DERBoolean=function(){pt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},ft.lang.extend(pt.asn1.DERBoolean,pt.asn1.ASN1Object),pt.asn1.DERInteger=function(t){pt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=pt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new B(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},ft.lang.extend(pt.asn1.DERInteger,pt.asn1.ASN1Object),pt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=pt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}pt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var r=0;r<=e;r++)t+="0";var n="";for(r=0;r<t.length-1;r+=8){var i=t.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+n},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},ft.lang.extend(pt.asn1.DERBitString,pt.asn1.ASN1Object),pt.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=pt.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}pt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},ft.lang.extend(pt.asn1.DEROctetString,pt.asn1.DERAbstractString),pt.asn1.DERNull=function(){pt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},ft.lang.extend(pt.asn1.DERNull,pt.asn1.ASN1Object),pt.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new B(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=e(parseInt(s,2))}return r};pt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(t){var e=pt.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},ft.lang.extend(pt.asn1.DERObjectIdentifier,pt.asn1.ASN1Object),pt.asn1.DEREnumerated=function(t){pt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=pt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new B(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},ft.lang.extend(pt.asn1.DEREnumerated,pt.asn1.ASN1Object),pt.asn1.DERUTF8String=function(t){pt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},ft.lang.extend(pt.asn1.DERUTF8String,pt.asn1.DERAbstractString),pt.asn1.DERNumericString=function(t){pt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},ft.lang.extend(pt.asn1.DERNumericString,pt.asn1.DERAbstractString),pt.asn1.DERPrintableString=function(t){pt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},ft.lang.extend(pt.asn1.DERPrintableString,pt.asn1.DERAbstractString),pt.asn1.DERTeletexString=function(t){pt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},ft.lang.extend(pt.asn1.DERTeletexString,pt.asn1.DERAbstractString),pt.asn1.DERIA5String=function(t){pt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},ft.lang.extend(pt.asn1.DERIA5String,pt.asn1.DERAbstractString),pt.asn1.DERUTCTime=function(t){pt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},ft.lang.extend(pt.asn1.DERUTCTime,pt.asn1.DERAbstractTime),pt.asn1.DERGeneralizedTime=function(t){pt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},ft.lang.extend(pt.asn1.DERGeneralizedTime,pt.asn1.DERAbstractTime),pt.asn1.DERSequence=function(t){pt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},ft.lang.extend(pt.asn1.DERSequence,pt.asn1.DERAbstractStructured),pt.asn1.DERSet=function(t){pt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},ft.lang.extend(pt.asn1.DERSet,pt.asn1.DERAbstractStructured),pt.asn1.DERTaggedObject=function(t){pt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,r){this.hT=e,this.isExplicit=t,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},ft.lang.extend(pt.asn1.DERTaggedObject,pt.asn1.ASN1Object);var dt=function(t){function e(r){var n=t.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(e.hasPrivateKeyProperty(r)||e.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}return g(e,t),e.prototype.parseKey=function(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?v.decode(t):y.unarmor(t),i=O.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=M(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=M(o,16);var a=i.sub[4].getHexStringValue();this.p=M(a,16);var s=i.sub[5].getHexStringValue();this.q=M(s,16);var u=i.sub[6].getHexStringValue();this.dmp1=M(u,16);var c=i.sub[7].getHexStringValue();this.dmq1=M(c,16);var h=i.sub[8].getHexStringValue();this.coeff=M(h,16)}else{if(2!==i.sub.length)return!1;var l=i.sub[1].sub[0];e=l.sub[0].getHexStringValue(),this.n=M(e,16),r=l.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new pt.asn1.DERInteger({int:0}),new pt.asn1.DERInteger({bigint:this.n}),new pt.asn1.DERInteger({int:this.e}),new pt.asn1.DERInteger({bigint:this.d}),new pt.asn1.DERInteger({bigint:this.p}),new pt.asn1.DERInteger({bigint:this.q}),new pt.asn1.DERInteger({bigint:this.dmp1}),new pt.asn1.DERInteger({bigint:this.dmq1}),new pt.asn1.DERInteger({bigint:this.coeff})]};return new pt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new pt.asn1.DERSequence({array:[new pt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new pt.asn1.DERNull]}),e=new pt.asn1.DERSequence({array:[new pt.asn1.DERInteger({bigint:this.n}),new pt.asn1.DERInteger({int:this.e})]}),r=new pt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new pt.asn1.DERSequence({array:[t,r]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return l(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var r="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(r,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+="-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n",t+="-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(st),gt=function(){function t(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new dt(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(f(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return l(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,r){try{return l(this.getKey().sign(t,e,r))}catch(t){return!1}},t.prototype.verify=function(t,e,r){try{return this.getKey().verify(t,f(e),r)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new dt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version="3.0.0-rc.1",t}();window.JSEncrypt=gt,t.JSEncrypt=gt,t.default=gt,Object.defineProperty(t,"__esModule",{value:!0})}(e)}(0,YT.exports);var $T=O,QT=z,tE=Ms,eE=ot,rE=QT(D.f),nE=QT([].push),iE=function(t){return function(e){for(var r,n=eE(e),i=tE(n),o=i.length,a=0,s=[];o>a;)r=i[a++],$T&&!rE(n,r)||nE(s,t?[r,n[r]]:n[r]);return s}},oE={entries:iE(!0),values:iE(!1)}.values;fi({target:"Object",stat:!0},{values:function(t){return oE(t)}});var aE=fi,sE=Es.find,uE=_d,cE="find",hE=!0;cE in[]&&Array(1).find((function(){hE=!1})),aE({target:"Array",proto:!0,forced:hE},{find:function(t){return sE(this,t,arguments.length>1?arguments[1]:void 0)}}),uE(cE);var lE=function(t){for(var e,r=0,n=!1,i=t.length-1;i>=0;)e=parseInt(t.charAt(i),10),n&&(e*=2)>9&&(e=e%10+1),n=!n,r+=e,i--;return r%10==0};var fE=function(t){return t?JSON.parse(JSON.stringify(t)):null};var pE=function(t){return"string"==typeof t||t instanceof String};var dE=function(t,e){return Array.isArray(e)?function(t,e,r){var n=String(e).length,i=t.substr(0,n),o=parseInt(i,10);return e=parseInt(String(e).substr(0,i.length),10),r=parseInt(String(r).substr(0,i.length),10),o>=e&&o<=r}(t,e[0],e[1]):function(t,e){return(e=String(e)).substring(0,t.length)===t.substring(0,e.length)}(t,e)},gE=fE,mE=dE;var vE,yE=function(t,e,r){var n,i,o,a;for(n=0;n<e.patterns.length;n++)if(i=e.patterns[n],mE(t,i)){a=gE(e),o=Array.isArray(i)?String(i[0]).length:String(i).length,t.length>=o&&(a.matchStrength=o),r.push(a);break}},bE={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}},wE=fE,SE=function(t){if(function(t){var e=t.filter((function(t){return t.matchStrength})).length;return e>0&&e===t.length}(t))return t.reduce((function(t,e){return t?t.matchStrength<e.matchStrength?e:t:e}))},TE=pE,EE=yE,AE={},xE={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},kE=[xE.VISA,xE.MASTERCARD,xE.AMERICAN_EXPRESS,xE.DINERS_CLUB,xE.DISCOVER,xE.JCB,xE.UNIONPAY,xE.MAESTRO,xE.ELO,xE.MIR,xE.HIPER,xE.HIPERCARD];function OE(t){return AE[t]||bE[t]}function CE(t,e){var r=vE.indexOf(t);if(!e&&-1===r)throw new Error('"'+t+'" is not a supported card type.');return r}function PE(t){var e,r=[];return TE(t)?0===t.length?vE.map((function(t){return wE(OE(t))})):(vE.forEach((function(e){var n=OE(e);EE(t,n,r)})),(e=SE(r))?[e]:r):[]}vE=wE(kE),PE.getTypeInfo=function(t){return wE(OE(t))},PE.removeCard=function(t){var e=CE(t);vE.splice(e,1)},PE.addCard=function(t){var e=CE(t.type,!0);AE[t.type]=t,-1===e&&vE.push(t.type)},PE.updateCard=function(t,e){var r,n=AE[t]||bE[t];if(!n)throw new Error('"'+t+'" is not a recognized type. Use `addCard` instead.');if(e.type&&n.type!==e.type)throw new Error("Cannot overwrite type parameter.");r=wE(n),Object.keys(r).forEach((function(t){e[t]&&(r[t]=e[t])})),AE[r.type]=r},PE.changeOrder=function(t,e){var r=CE(t);vE.splice(r,1),vE.splice(e,0,t)},PE.resetModifications=function(){vE=wE(kE),AE={}},PE.types=xE;var RE=PE,BE=lE,DE=RE;function IE(t,e,r){return{card:t,isPotentiallyValid:e,isValid:r}}var LE=function(t,e){var r,n,i,o,a;if(e=e||{},"number"==typeof t&&(t=String(t)),"string"!=typeof t)return IE(null,!1,!1);if(t=t.replace(/\-|\s/g,""),!/^\d*$/.test(t))return IE(null,!1,!1);if(0===(r=DE(t)).length)return IE(null,!1,!1);if(1!==r.length)return IE(null,!0,!1);if(n=r[0],e.maxLength&&t.length>e.maxLength)return IE(n,!1,!1);for(i=n.type===DE.types.UNIONPAY&&!0!==e.luhnValidateUnionPay||BE(t),a=Math.max.apply(null,n.lengths),e.maxLength&&(a=Math.min(e.maxLength,a)),o=0;o<n.lengths.length;o++)if(n.lengths[o]===t.length)return IE(n,t.length<a||i,i);return IE(n,t.length<a,!1)};function jE(t,e,r){return{isValid:t,isPotentiallyValid:e,isCurrentYear:r||!1}}var NE=function(t,e){var r,n,i,o,a;return e=e||19,"string"!=typeof t?jE(!1,!1):""===t.replace(/\s/g,"")?jE(!1,!0):/^\d*$/.test(t)?(n=t.length)<2?jE(!1,!0):(r=(new Date).getFullYear(),3===n?jE(!1,t.slice(0,2)===String(r).slice(0,2)):n>4?jE(!1,!1):(t=parseInt(t,10),i=Number(String(r).substr(2,2)),2===n?(a=i===t,o=t>=i&&t<=i+e):4===n&&(a=r===t,o=t>=r&&t<=r+e),jE(o,o,a))):jE(!1,!1)},ME=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},_E=NE,UE=ME;function VE(t,e,r){return{isValid:t,isPotentiallyValid:e,isValidForThisYear:r||!1}}var FE=function(t){var e,r,n=(new Date).getMonth()+1;return"string"!=typeof t?VE(!1,!1):""===t.replace(/\s/g,"")||"0"===t?VE(!1,!0):/^\d*$/.test(t)?(e=parseInt(t,10),isNaN(t)?VE(!1,!1):VE(r=e>0&&e<13,r,r&&e>=n)):VE(!1,!1)},qE=function(t){var e,r,n,i,o;return/^\d{4}-\d{1,2}$/.test(t)?t=t.split("-").reverse():/\//.test(t)?t=t.split(/\s*\/\s*/g):/\s/.test(t)&&(t=t.split(/ +/g)),UE(t)?{month:t[0]||"",year:t.slice(1).join()}:(n=t,r=0===(o=Number(n[0]))?2:o>1||1===o&&Number(n[1])>2?1:1===o?(i=n.substr(1),_E(i).isPotentiallyValid?1:2):5===n.length?1:n.length>5?2:1,{month:e=t.substr(0,r),year:t.substr(e.length)})},HE=FE,zE=NE;function GE(t,e,r,n){return{isValid:t,isPotentiallyValid:e,month:r,year:n}}function KE(t,e){return{isValid:t,isPotentiallyValid:e}}function WE(t,e){return{isValid:t,isPotentiallyValid:e}}var XE={number:LE,expirationDate:function(t,e){var r,n,i,o;if("string"==typeof t)t=t.replace(/^(\d\d) (\d\d(\d\d)?)$/,"$1/$2"),r=qE(t);else{if(null===t||"object"!=typeof t)return GE(!1,!1,null,null);r={month:String(t.month),year:String(t.year)}}if(n=HE(r.month),i=zE(r.year,e),n.isValid){if(i.isCurrentYear)return GE(o=n.isValidForThisYear,o,r.month,r.year);if(i.isValid)return GE(!0,!0,r.month,r.year)}return n.isPotentiallyValid&&i.isPotentiallyValid?GE(!1,!0,null,null):GE(!1,!1,null,null)},expirationMonth:FE,expirationYear:NE,cvv:function(t,e){return e=(e=e||3)instanceof Array?e:[e],"string"!=typeof t?KE(!1,!1):/^\d*$/.test(t)?function(t,e){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1}(e,t.length)?KE(!0,!0):t.length<Math.min.apply(null,e)?KE(!1,!0):t.length>function(t){for(var e=3,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return e}(e)?KE(!1,!1):KE(!0,!0):KE(!1,!1)},postalCode:function(t,e){var r;return r=(e=e||{}).minLength||3,"string"!=typeof t?WE(!1,!1):t.length<r?WE(!1,!0):WE(!0,!0)},creditCardType:RE},ZE=[{type:"bank_auth",name:"Bank authorization",number:"4084080000000409",cvv:"000",month:"01",year:"30"},{type:"success",name:"Success",number:"4084084084084081",cvv:"408",month:"12",year:"30"},{type:"declined",name:"Declined",number:"4084080000005408",cvv:"001",month:"12",year:"30"},{type:"pin",name:"Pin only validation",number:"507850785078507812",cvv:"884",month:"01",year:"30"},{type:"pin+otp",name:"Pin and OTP validation",number:"5060666666666666666",cvv:"123",month:"01",year:"30"},{type:"pin+phone+otp",name:"Pin, phone and OTP validation",number:"507850785078507812",cvv:"884",month:"01",year:"30"},{type:"default",name:"No validation",number:"4084084084084081",cvv:"408",month:"01",year:"30"}];XE.creditCardType.addCard({niceType:"Verve",type:"verve",patterns:[[506e3,507999],[65e4,650009]],gaps:[4,8,12,16],lengths:[16,18,19],code:{name:"CVV",size:3}}),XE.creditCardType.changeOrder("verve",0);var YE=function(){function t(e){var r=e.number,n=e.cvv,i=e.month,o=e.year,s=e.pin;a(this,t),this.number=r,this.cvv=n,this.month=i,this.year=o,this.pin=s}return u(t,[{key:"getEncryptedPin",value:function(){return this.pin?JT(this.pin):void 0}},{key:"getLast4",value:function(){return this.number.substring(this.number.length-4)}},{key:"tokenize",value:function(){return JT("".concat(this.number,"*").concat(this.cvv,"*").concat(this.month,"*").concat(this.year))}}],[{key:"getType",value:function(t){var e=XE.number(t);return e&&e.card?{type:e.card.type,maxLength:Math.max.apply(Math,b(e.card.lengths)),minLength:Math.min.apply(Math,b(e.card.lengths))}:{type:null,maxLength:0}}},{key:"validate",value:function(e){var r=e.number,n=e.cvv,i=e.month,o=e.year,a=t.getType(r).type,s={number:t.isNumberValid(r),expiry:t.isExpiryValid({month:i,year:o}),cvv:t.isCvvValid(n,a)};return{isValid:Object.values(s).every((function(t){return!0===t})),result:s}}},{key:"validateNumber",value:function(t){return XE.number(t)}},{key:"isNumberValid",value:function(e){return t.validateNumber(e).isValid}},{key:"validateCVV",value:function(t,e){var r="american-express"===e?4:3;return XE.cvv(t,r)}},{key:"isCvvValid",value:function(e,r){return t.validateCVV(e,r).isValid}},{key:"validateExpiry",value:function(t){if("object"===n(t)){var e=t.month,r=t.year;return XE.expirationMonth(e)&&XE.expirationYear(r)}return XE.expirationDate(t)}},{key:"isExpiryValid",value:function(e){return t.validateExpiry(e).isValid}},{key:"generateTestCard",value:function(e){var r=e||"default";return new t(ZE.find((function(t){return t.type===r})))}}]),t}(),JE=function(t){var e=t.clientdata,n=t.last4,i=t.pin,o=t.trans,a=t.device,s=t.rememberCard,u=t.transactionType,c=t.subscription,h=t.customFields,l="".concat(Dd.paymentBaseUrl,"charge/"),f=kT(),p=r({"Content-Type":"application/x-www-form-urlencoded"},f&&{"Accept-Language":f}),d=r(r(r({clientdata:e,last4:n,trans:o,device:a,offset:(new Date).getTimezoneOffset(),remember_card:s},u&&{transaction_type:u}),c&&{subscription:c}),h&&h);i&&(d.handle=i);var g=NT(d);return xT.post(l,g,{headers:p}).then((function(t){return Gd.parse(t.data)}))},$E=function(t){var e=t.device,n=t.accessCode,i=t.pin,o="".concat(Dd.paymentBaseUrl,"charge/resume/").concat(n),a=kT(),s=r({"Content-Type":"application/x-www-form-urlencoded"},a&&{"Accept-Language":a}),u=r({device:e},i&&{handle:i}),c=NT(u);return xT.post(o,c,{headers:s}).then((function(t){return Gd.parse(t.data)}))},QE=function(t){var e=t.last4,n=t.trans,i=t.device,o=t.authorizationCode,a=t.cvv,s=t.pin,u=t.transactionType,c=t.subscription,h="".concat(Dd.paymentBaseUrl,"charge/"),l=kT(),f=r({"Content-Type":"application/x-www-form-urlencoded"},l&&{"Accept-Language":l}),p=r(r({last4:e,trans:n,device:i,cvv:a,handle:s,authorization_code:o},u&&{transaction_type:u}),c&&{subscription:c}),d=NT(p);return xT.post(h,d,{headers:f}).then((function(t){return Gd.parse(t.data)}))},tA=function(t,e){var n="".concat(Dd.paymentBaseUrl,"charge/validate"),i={trans:t,token:e},o=kT(),a=r({},o&&{"Accept-Language":o}),s=NT(i);return xT.post(n,s,{headers:a}).then((function(t){return Gd.parse(t.data)}))},eA=function(t){var e=t.address,n=t.city,i=t.state,o=t.zipCode,a=t.transactionId,s="".concat(Dd.paymentBaseUrl,"charge/avs"),u=kT(),c=r({"Content-Type":"application/x-www-form-urlencoded"},u&&{"Accept-Language":u}),h=NT({city:n,state:i,address:e,zip_code:o,trans:a});return xT.post(s,h,{headers:c}).then((function(t){return Gd.parse(t.data)}))},rA=function(t){var e=t.authorizationId,n=t.publicKey,i=kT(),o=r({Authorization:"Bearer ".concat(n)},i&&{"Accept-Language":i}),a={authorization_id:e},s="".concat(Dd.paystackApiUrl,"rememberme/forget_card");return xT.post(s,a,{headers:o}).then((function(t){return Gd.parse(t.data)}))},nA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new URL("/authorize/".concat(t),Dd.savedCardsApiUrl).toString(),i=kT(),o=r({},i&&{"Accept-Language":i}),e.next=5,xT.post(n,{headers:o});case 5:return a=e.sent,s=a.data,e.abrupt("return",s);case 8:case"end":return e.stop()}}),e)})))()},iA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s,u,c,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.code,i=t.phone,o=t.transaction,a=new URL("/authorize/verify",Dd.savedCardsApiUrl).toString(),s=kT(),u=r({},s&&{"Accept-Language":s}),c={code:n,phone:i,transaction:o},e.next=7,xT.post(a,c,{headers:u});case 7:return h=e.sent,e.abrupt("return",h.data);case 9:case"end":return e.stop()}}),e)})))()},oA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.token,i=new URL("/cards",Dd.savedCardsApiUrl).toString(),o=kT(),a=r({Authorization:"Bearer ".concat(n),"jwt-auth":!0},o&&{"Accept-Language":o}),e.next=6,xT.get(i,{headers:a});case 6:return s=e.sent,e.abrupt("return",s.data);case 8:case"end":return e.stop()}}),e)})))()},aA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.cardCode,i=t.token,o=new URL("/cards/".concat(n),Dd.savedCardsApiUrl).toString(),a=kT(),s=r({Authorization:"Bearer ".concat(i),"jwt-auth":!0},a&&{"Accept-Language":a}),e.next=6,xT.delete(o,{headers:s});case 6:return u=e.sent,e.abrupt("return",u.data);case 8:case"end":return e.stop()}}),e)})))()},sA=function(t){return o(regeneratorRuntime.mark((function e(){var n,i,o,a,s,u,c,h,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.token,i=t.device,o=t.cardCode,a=t.transaction,s=t.selectedCurrency,u=new URL("/cards/".concat(o,"/charge"),Dd.savedCardsApiUrl).toString(),c=kT(),h=r({Authorization:"Bearer ".concat(n),"jwt-auth":!0},c&&{"Accept-Language":c}),l={device:i,transaction:a,selectedCurrency:s},e.abrupt("return",xT.post(u,l,{headers:h}).then((function(t){return Gd.parse(t.data)})));case 6:case"end":return e.stop()}}),e)})))()},uA="card";function cA(t,e){return new Promise((function(r,n){var i=YE.validate(t);if(!i.isValid){var o=e||t.number,a=Object.keys(i.result).filter((function(t){return!1===i.result[t]})),s="Invalid card details: ".concat(a.join(", "));n(Error(o?s:"Please set a valid card with Transaction.setCard()"))}r()}))}var hA={setCard:function(t){var e=this;return cA(t,!0).then((function(){e.card=new YE(t)}))},rememberCard:function(){this.remember_card=!0},chargeCard:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!this.card.number&&this.card.pin?this.chargeCardWithPin(e):cA(this.card).then((function(){t.logAttempt(uA);var r={clientdata:t.card.tokenize(),last4:t.card.getLast4(),pin:t.card.getEncryptedPin(),trans:t.id,device:t.deviceFingerprint,rememberCard:t.remember_card,transactionType:t.transactionType,subscription:t.subscription,customFields:e};return JE(r).then((function(e){return t.logAPIResponse(e,uA),e}))}))},chargeCardWithPin:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logAttempt(uA);var r={pin:JT(this.card.pin),trans:this.id,device:this.deviceFingerprint,rememberCard:this.remember_card,transactionType:this.transactionType,subscription:this.subscription,customFields:e};return JE(r).then((function(e){return t.logAPIResponse(e,uA),e}))},chargeRememberedCard:function(t){var e=this,r=t.cvv,n=t.authorizationCode,i=t.cardLast4,o=t.pin;this.logAttempt(uA);var a=JT(o),s={authorizationCode:n,cvv:r,last4:i,trans:this.id,device:this.deviceFingerprint,pin:a,transactionType:this.transactionType,subscription:this.subscription};return QE(s).then((function(t){return e.logAPIResponse(t,uA),t}))},resumeCardCharge:function(t){var e=this,n=t.accessCode,i=t.pin,o=r(r({},i&&{pin:JT(i)}),{},{accessCode:n,device:this.deviceFingerprint});return $E(o).then((function(t){return e.logAPIResponse(t,uA),t}))},forgetRememberedCard:function(t){var e=this,r={authorizationId:t,publicKey:this.merchant.key};return rA(r).then((function(t){return e.logAPIResponse(t,uA),t}))},authenticateCard:function(t){var e=this;return tA(this.id,t).then((function(t){return e.logAPIResponse(t,uA),t}))},verifyAddress:function(t){var e=this,r=t.address,n={city:t.city,state:t.state,address:r,zipCode:t.zipCode,transactionId:this.id};return eA(n).then((function(t){return e.logAPIResponse(t,uA),t}))},listenFor3DSCharge:function(t){var e={channel:"3DS_".concat(this.id),paymentMethod:uA};return this.listenForCharge(e,t)},requestOtpForSavedCards:function(t){return nA(t)},verifySavedCardsOtp:function(t){var e=this;return o(regeneratorRuntime.mark((function r(){var n,i,o,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=t.code,i=t.phone,o={code:n,phone:i,transaction:e.id},r.next=4,iA(o);case 4:return a=r.sent,e.savedCardsToken=a.data.token,r.abrupt("return",a);case 7:case"end":return r.stop()}}),r)})))()},getSavedCards:function(){return oA({token:this.savedCardsToken})},deleteSavedCard:function(t){return aA({cardCode:t,token:this.savedCardsToken})},chargeSavedCard:function(t){var e=t.cardCode,r=t.transaction,n=t.selectedCurrency;return sA({cardCode:e,transaction:r,selectedCurrency:n,token:this.savedCardsToken,device:this.deviceFingerprint})}},lA=function(){function t(e){var r=e.bankId,n=e.accountType,i=e.accountNumber;a(this,t),this.bankId=r,this.accountType=n,this.accountNumber=i}return u(t,null,[{key:"validate",value:function(e){var r=e.bankId,n=e.accountType,i=e.accountNumber,o=[];return r&&"number"==typeof r||o.push("Invalid bankId. Please check for supported banks with BankAccount.supportedBanks()"),t.types.indexOf(n)>-1?"nuban"!==n||t.isValidNubanAccount(i)||o.push("Invalid account number. Nuban accounts must be 10 digit numbers"):o.push("Invalid bank type. Please check BankAccount.types for the list of valid bank types"),{isValid:0===o.length,errors:o}}},{key:"isValidNubanAccount",value:function(t){return!!t&&(("number"==typeof t||/^\d+$/.test(t))&&10===t.length)}},{key:"supportedBanks",value:function(){var t="".concat(Dd.paymentBaseUrl,"bank?pay_with_bank=true"),e=kT(),n=r({},e&&{"Accept-Language":e});return xT.post(t,{headers:n}).then((function(t){return t.data}))}}]),t}();lA.types=["nuban"];var fA=function(t){var e=t.bankId,n=t.transactionId,i=t.accountNumber,o=t.device,a="".concat(Dd.paymentBaseUrl,"bank/charge_account/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({account_number:i,device:o});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},pA=function(t){var e=t.bankId,n=t.transactionId,i=t.accountNumber,o=t.birthday,a="".concat(Dd.paymentBaseUrl,"bank/charge_account/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({account_number:i,birthday:o});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},dA=function(t){var e=t.bankId,n=t.transactionId,i=t.token,o=t.device,a="".concat(Dd.paymentBaseUrl,"bank/validate_token/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({device:o,token:i});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},gA="bank account";function mA(t,e){return new Promise((function(r,n){var i=lA.validate(t);if(!i.isValid){var o=e||t.accountNumber?i.errors[0]:"Please set a valid bank account with Transaction.setBank()";n(Error(o))}r()}))}var vA={getIbankUrl:function(t){var e=this,r=t.bankId;return new Promise((function(t,n){r||n(Error("Please send bankId"));var i="".concat(Dd.paymentBaseUrl,"bank/ibank/").concat(r,"/").concat(e.id);t(Gd.success({url:i}))}))},listenForIbankCharge:function(t){var e={channel:"IBANK_".concat(this.id),paymentMethod:"ibank"};return this.listenForCharge(e,t)}},yA=function(t){var e=t.bankId,n=t.transactionId,i=t.phoneNumber,o=t.payId,a="".concat(Dd.paymentBaseUrl,"bank/digitalbankmandate/").concat(e,"/").concat(n),s=kT(),u=r({"Content-Type":"application/x-www-form-urlencoded"},s&&{"Accept-Language":s}),c=NT({phone_number:i,token:o});return xT.post(a,c,{headers:u}).then((function(t){return Gd.parse(t.data)}))},bA="bank",wA={chargeDigitalBankMandate:function(t){var e=this,r=t.phoneNumber,n=t.payId,i=t.bankId,o={transactionId:this.id,phoneNumber:r,payId:n,bankId:i};return yA(o).then((function(t){return e.logAPIResponse(t,bA),t}))},listenForDigitalBankMandateCharge:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r={paymentMethod:bA,channel:e};return this.listenForCharge(r,t)}},SA=r(r(r({},{setBankAccount:function(t){var e=this;return mA(t,!0).then((function(){e.bankAccount=new lA(t)}))},chargeBankAccount:function(){var t=this;return mA(this.bankAccount).then((function(){t.logAttempt(gA);var e={bankId:t.bankAccount.bankId,transactionId:t.id,accountNumber:t.bankAccount.accountNumber,device:t.deviceFingerprint};return fA(e).then((function(e){return t.logAPIResponse(e,gA),e}))}))},registerBankAccount:function(t){var e=this;return mA(this.bankAccount).then((function(){var r={bankId:e.bankAccount.bankId,transactionId:e.id,accountNumber:e.bankAccount.accountNumber,birthday:t};return pA(r).then((function(t){return e.logAPIResponse(t,gA),t}))}))},authenticateBankAccount:function(t){var e=this;return mA(this.bankAccount).then((function(){var r={bankId:e.bankAccount.bankId,transactionId:e.id,token:t,device:e.deviceFingerprint};return dA(r).then((function(t){return e.logAPIResponse(t,gA),t}))}))}}),vA),wA),TA=function(t,e){var n=kT(),i=r({Authorization:"Bearer ".concat(e)},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"checkout/ussd/reference"),t,{headers:i}).then((function(t){return Gd.parse(t.data)}))},EA=function(t,e){var n=kT(),i=r({Authorization:"Bearer ".concat(e)},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"checkout/pay_with_transfer_ussd"),t,{headers:i}).then((function(t){return Gd.parse(t.data)}))},AA={getUSSDShortcode:function(t){var e=this,r=t.channel,n={transaction:this.id,channel:r};return TA(n,this.merchant.key).then((function(t){return"success"===t.status&&(e.ussd[r]=t),t}))},getPWTUSSDShortcode:function(t){var e=this,r=t.bankSlug,n=t.fulfilLateNotification,i=void 0!==n&&n,o={transaction_id:this.id,fulfil_late_notification:i,bank_slug:r};return EA(o,this.merchant.key).then((function(t){return"success"===t.status&&(e.ussd[r]=t),t}))},listenForPWTUSSDCharge:function(t,e){var r=t.bankSlug;if(!this.ussd[r])return Promise.reject(Error("Please generate a ussd shortcode with Transaction.getPWTUSSDShortcode()"));var n={channel:this.ussd[r].data.pusher_channel,paymentMethod:"ussd"};return this.listenForCharge(n,e)},listenForUSSDCharge:function(t,e){var r=t.channel;if(!this.ussd[r])return Promise.reject(Error("Please generate a ussd shortcode with Transaction.getUSSDShortcode()"));var n={channel:this.ussd[r].data.channel,paymentMethod:r};return this.listenForCharge(n,e)}},xA=function(t,e){var n={source:"checkout",reference:t.transaction,channel:t.channel},i=kT(),o=r({Authorization:"Bearer ".concat(e)},i&&{"Accept-Language":i});return xT.post("".concat(Dd.paystackApiUrl,"offline/qr/generate"),n,{headers:o}).then((function(t){return Gd.parse(t.data)}))};function kA(t){return new Promise((function(e,r){var n=["visa","MPASS_OLTI"];if(n.indexOf(t)<=-1){var i="Invalid channel. Available channels: ".concat(n.join(", "));r(Error(i))}else e()}))}var OA={getQRCode:function(t){var e=this,r=t.channel;return kA(r).then((function(){if(e.qr[r])return e.qr[r];var t={transaction:e.id,channel:r};return xA(t,e.merchant.key).then((function(t){return"success"===t.status&&(e.qr[r]=t),t}))}))},listenForQRCharge:function(t,e){var r=this,n=t.channel;return kA(n).then((function(){if(!r.qr[n])return Promise.reject(Error("Please generate qr code with Transaction.getQRCode()"));var t={channel:r.qr[n].data.channel,paymentMethod:n};return r.listenForCharge(t,e)}))}},CA=function(){function t(){a(this,t)}return u(t,null,[{key:"hasCountryCode",value:function(t){return t&&"+"===t[0]}},{key:"hasOnlyDigits",value:function(t){var e;return t&&(e=t.substring(1),/^\d+$/.test(e))}},{key:"isE164Number",value:function(t){return t&&t.length<17}},{key:"validate",value:function(e){var r=[];return t.hasCountryCode(e)||r.push("Number should include country code prefix"),t.hasOnlyDigits(e)||r.push("Number should contain only digits"),t.isE164Number(e)||r.push("Number should not be longer than 16 digits"),{isValid:0===r.length,errors:r}}}]),t}(),PA=function(t){var e={transaction:t.transaction,phone:t.phone,device:t.device,channel_name:t.channel_name,provider:t.provider,voucher:t.voucher,registration_token:t.registrationToken},n=kT(),i=r({},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"charge/mobile_money"),e,{headers:i}).then((function(t){return Gd.parse(t.data)})).catch((function(t){var e=t.response;return Gd.parse(e.data)}))},RA=function(t){var e=t.transaction,n=t.code,i=kT(),o=r({},i&&{"Accept-Language":i}),a=NT({transaction:e,otp:n}),s=new URL("charge/momo_payin_finalize",Dd.paymentBaseUrl).toString();return xT.post(s,a,{headers:o}).then((function(t){return Gd.parse(t.data)}))};function BA(t){return new Promise((function(e,r){var n=CA.validate(t);if(!n.isValid){var i=t?n.errors[0]:"Please start a mobile money transaction with Transaction.chargeMobileMoney()";r(Error(i))}e(n)}))}var DA={chargeMobileMoney:function(t){var e=this,r=t.phoneNumber,n=t.provider,i=t.voucher,o=t.registrationToken;return BA(r).then((function(){e.logAttempt("mobile money");var t={provider:n,voucher:i,registrationToken:o,transaction:e.id,phone:r,device:e.deviceFingerprint,channel_name:"MOBILE_MONEY_".concat(e.id)};return PA(t).then((function(t){return"success"===t.status&&(e.mobileMoney=t,t.data&&t.data.display&&1===t.data.display.otpSentCount&&e.logTokenRequest("mobile money")),t}))}))},authenticateMobileMoney:function(t){var e=this,r=t.phoneNumber,n=t.provider,i=t.registrationToken;return BA(r).then((function(){e.logMobileMoneyActions(t);var o={provider:n,registrationToken:i,transaction:e.id,phone:r,device:e.deviceFingerprint,channel_name:"MOBILE_MONEY_".concat(e.id)};return PA(o).then((function(t){return"success"===t.status?(e.mobileMoney=t,t.data&&t.data.display&&1===t.data.display.otpSentCount&&e.logTokenRequest("mobile money")):t.errors&&t.errors.data&&"awaiting_registration_token"===t.errors.data.status?e.logTokenAuthenticationFailure(t.message):e.logError(t.message),t}))}))},submitMobileMoneyCode:function(t){var e=this;return RA({code:t.code,transaction:this.id}).then((function(t){return e.logAPIResponse(t,"mobile_money"),t}))},listenForMobileMoneyCharge:function(t){if("success"!==this.mobileMoney.status)return Promise.reject(Error("Please start a mobile money charge with Transaction.chargeMobileMoney()"));var e=this.mobileMoney.data,r=e.channel,n=e.channel_name,i={channel:r||n,paymentMethod:"mobile_money"};return this.listenForCharge(i,t)}},IA=function(t){var e={email:t.email,password:t.password},n=kT(),i=r({},n&&{"Accept-Language":n});return xT.post("".concat(Dd.paystackApiUrl,"login"),e,{headers:i}).then((function(t){return Gd.parse(t.data)}))},LA=function(t){var e=t.account_code,n=t.transaction,i=t.token,o=kT(),a=r({Authorization:"Bearer ".concat(i),"jwt-auth":!0},o&&{"Accept-Language":o}),s={account_code:e,transaction:n};return xT.post("".concat(Dd.paystackApiUrl,"directdebit/initiate"),s,{headers:a}).then((function(t){return Gd.parse(t.data)}))},jA=function(t){var e=t.otp,n=t.transaction,i=t.token,o=kT(),a=r({Authorization:"Bearer ".concat(i),"jwt-auth":!0},o&&{"Accept-Language":o}),s={otp:e,transaction:n};return xT.post("".concat(Dd.paystackApiUrl,"directdebit/validate"),s,{headers:a}).then((function(t){return Gd.parse(t.data)}))},NA=function(t){var e=kT(),n=r({Authorization:"Bearer ".concat(t),"jwt-auth":!0},e&&{"Accept-Language":e});return xT.get("".concat(Dd.paystackApiUrl,"directdebit/account"),{headers:n}).then((function(t){return t.data}))},MA="direct debit",_A={loginToDirectDebitAccount:function(t){var e=this,r=t.email,n={email:r,password:t.password};return Mc(r)?IA(n).then((function(t){if("success"===t.status){var r=t.data,n=r.token,i=r.user.permissions;if(!i||i.length<1)throw Error("You do not have the privileges to perform this action");if(i.find((function(t){return"directdebit-*"===t})))return e.directDebit.token=n,t;throw Error("You do not have the privileges to perform this action")}return t})):Promise.reject(Error("Invalid email"))},chargeDirectDebit:function(t){var e=this;if(!this.directDebit.token)return Promise.reject(Error("Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge"));this.logAttempt(MA);var r={account_code:t,transaction:this.id,token:this.directDebit.token};return LA(r).then((function(t){return e.logAPIResponse(t,MA),t.status&&(e.directDebit.chargeResponse=t),t}))},getProvisionedAccounts:function(){var t=this;return NA(this.directDebit.token).then((function(e){t.logAPIResponse(e,MA);var r=e.status,n=e.data;if(r){if(n&&n.length<1)return Promise.reject(Error("You have not provisioned any bank account for Direct Debit yet"));t.directDebit.accounts=e.data}return e}))},authenticateAccount:function(t){var e=this,r={otp:t,transaction:this.id,token:this.directDebit.token};return jA(r).then((function(t){return e.logAPIResponse(t,MA),t}))}},UA=function(t){return{card:hA,bank:SA,ussd:AA,qr:OA,mobile_money:DA,direct_debit:_A,bank_transfer:LT,eft:VT,payattitude:UT,apple_pay:zT,paypal:ZT}[t]},VA=function(t){t||"undefined"==typeof navigator||(t=navigator.userAgent);t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]);return"string"==typeof t&&(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))};var FA=fi,qA=ft,HA=fa,zA=z,GA=k,KA=A.Array,WA=qA("JSON","stringify"),XA=zA(/./.exec),ZA=zA("".charAt),YA=zA("".charCodeAt),JA=zA("".replace),$A=zA(1..toString),QA=/[\uD800-\uDFFF]/g,tx=/^[\uD800-\uDBFF]$/,ex=/^[\uDC00-\uDFFF]$/,rx=function(t,e,r){var n=ZA(r,e-1),i=ZA(r,e+1);return XA(tx,t)&&!XA(ex,i)||XA(ex,t)&&!XA(tx,n)?"\\u"+$A(YA(t,0),16):t},nx=GA((function(){return'"\\udf06\\ud834"'!==WA("\udf06\ud834")||'"\\udead"'!==WA("\udead")}));WA&&FA({target:"JSON",stat:!0,forced:nx},{stringify:function(t,e,r){for(var n=0,i=arguments.length,o=KA(i);n<i;n++)o[n]=arguments[n];var a=HA(WA,null,o);return"string"==typeof a?JA(a,QA,rx):a}});var ix=function(t,e,n){var i="".concat(Dd.paystackApiUrl,"transaction/update_log/").concat(t),o=kT(),a=r({Authorization:"Bearer ".concat(e)},o&&{"Accept-Language":o});return xT.post(i,{payload:JSON.stringify(n)},{headers:a}).then((function(t){return t.data}))},ox=function(t,e){var n="".concat(Dd.paystackApiUrl,"transaction/set_ip/").concat(t),i=kT(),o=r({Authorization:"Bearer ".concat(e)},i&&{"Accept-Language":i});return xT.post(n,null,{headers:o}).then((function(t){return t.data}))},ax=function(t,e,n){var i="".concat(Dd.paystackApiUrl,"transaction/set_referrer/").concat(t),o=kT(),a=r({Authorization:"Bearer ".concat(e)},o&&{"Accept-Language":o});return xT.post(i,{referrer:n},{headers:a}).then((function(t){return t.data}))},sx={initializeLog:function(t){var e=t||{},r=e.attempts,n=e.authentication,i=e.errors,o=e.history;this.log={start_time:Math.round(Date.now()/1e3),time_spent:0,attempts:r||0,authentication:n,errors:i||0,success:!1,mobile:VA(),input:[],history:o||[]}},getTimeSpent:function(){var t=Math.round(Date.now()/1e3);return this.log.time_spent=t-this.log.start_time,this.log.time_spent},logPageOpen:function(){return this.log.history.push({type:"open",message:"Opened checkout",time:this.getTimeSpent()}),this.saveLog()},logChannelSwitch:function(t){return this.log.history.push({type:"action",message:"Set payment method to: ".concat(t),time:this.getTimeSpent()}),this.saveLog()},logValidationErrors:function(t){var e=this;return t.forEach((function(t){e.log.history.push({type:"error",message:"Invalid ".concat(t),time:e.getTimeSpent()})})),this.saveLog()},logInput:function(t){var e=this.log.history.find((function(e){return e.message==="Filled this field: ".concat(t)}));return this.log.history.push({type:"input",message:"".concat(e?"Changed":"Filled"," this field: ").concat(t),time:this.getTimeSpent()}),this.saveLog()},logBankSelect:function(t){return this.log.history.push({type:"action",message:"Selected bank: ".concat(t),time:this.getTimeSpent()}),this.saveLog()},logAuthWindowOpen:function(){return this.log.history.push({type:"action",message:"Third-party authentication window opened",time:this.getTimeSpent()}),this.saveLog()},logAuthWindowClose:function(){return this.log.history.push({type:"action",message:"Third-party authentication window closed",time:this.getTimeSpent()}),this.saveLog()},logAPIResponse:function(t,e){switch(t.status){case"success":return this.logSuccess(e);case"pending":return this.logPending(e);case"failed":return this.logError(t.message);case"auth":return this.logAuth(t.data.auth);default:return!1}},logMobileMoneyActions:function(t){var e=t.numberOfTokenRequests,r=t.registrationToken;e?this.logTokenRequest("mobile money",e):r?this.logTokenSubmitted("mobile money"):this.logAttempt("mobile money")},logAPIResponseMessage:function(t){return this.log.history.push({type:"action",message:t,time:this.getTimeSpent()}),this.saveLog()},logAttempt:function(t){var e="Attempted to pay";return t&&(e+=" with ".concat(t)),this.log.attempts+=1,this.log.history.push({type:"action",message:e,time:this.getTimeSpent()}),this.saveLog()},logTokenRequest:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0===e?"Waiting for customer to submit OTP":"Customer requested to resend OTP";return this.log.history.push({type:"action",message:r,channel:t,time:this.getTimeSpent()}),this.saveLog()},logTokenSubmitted:function(t){return this.log.history.push({type:"action",message:"Customer submitted OTP",channel:t,time:this.getTimeSpent()}),this.saveLog()},logTokenAuthenticationFailure:function(t){var e=t?"Error: ".concat(t):"Error";return this.log.errors+=1,this.log.history.push({type:"error",message:e,authentication:"failed",time:this.getTimeSpent()}),this.saveLog()},logError:function(t){var e="Error";return t&&(e+=": ".concat(t)),this.log.errors+=1,this.log.history.push({type:"error",message:e,time:this.getTimeSpent()}),this.saveLog()},logAuth:function(t){return this.log.authentication=t,this.log.history.push({type:"auth",message:"Authentication Required: ".concat(t),time:this.getTimeSpent()}),this.saveLog()},logSuccess:function(t){var e="Successfully paid";return t&&(e+=" with ".concat(t)),this.log.success=!0,this.log.history.push({type:"success",message:e,time:this.getTimeSpent()}),this.saveLog()},logPending:function(t){var e="Payment in progress";return t&&(e+=" with ".concat(t)),this.log.history.push({type:"pending",message:e,time:this.getTimeSpent()}),this.saveLog()},logPageClose:function(){return this.log.history.push({type:"close",message:"Closed checkout",time:this.getTimeSpent()}),this.saveLog()},saveLog:function(){return ix(this.id,this.merchant.key,this.log)},saveIpAddress:function(){return ox(this.id,this.merchant.key)},saveReferrer:function(t){return ax(this.id,this.merchant.key,t)}},ux=function(){function t(e){var r=this;a(this,t),this.email=e.email,this.merchant={id:e.merchant_id,logo:e.merchant_logo,name:e.merchant_name,key:e.merchant_key,channelSettings:e.merchant_channel_settings||{}},this.status=e.transaction_status||e.status,this.accessCode=e.access_code,this.amount=e.amount,this.domain=e.domain,this.isTest="test"===e.domain,this.currency=e.currency,this.id=e.id,this.channels=e.channels,this.label=e.label,this.metadata=e.metadata||{},this.cancel_action=e.cancel_action||null,this.channel_options=e.channel_options||null,this.hash=e.hash||null,this.authorizations=e.authorizations,this.remember_card=!1,this.rememberMeEnabled=e.is_remember_me_enabled,this.card={},this.bankAccount={},this.mobileMoney={},this.ussd={},this.bankTransfer={},this.qr={},this.directDebit={},this.deviceFingerprint=e.deviceFingerprint||null,this.customer=e.customer,this.custom_filters=e.custom_filters||null,this.isCharging=!1,this.isListening=!1,this.transactionType=e.transaction_type||null,this.subscription=e.subscription||null,this.planDetails=e.plan_details||null,this.exchangeRate=e.exchange_rate||null,this.savedCardsToken=null,this.isSavedCardsEnabled=e.saved_cards&&e.saved_cards.enabled||null,window?new Promise((function(t,e){var r=new XMLHttpRequest;r.open("GET",Dd.pusherUrl),r.onload=function(){if(r.status>=200&&r.status<300){var n=document.createElement("script");n.appendChild(document.createTextNode(r.responseText)),document.head.appendChild(n),t()}else e(r.statusText)},r.onerror=function(){return e(r.statusText)},r.send(null)})):Promise.reject(new Error("Window object not available")),this.log=null,Object.assign(this,sx),this.initializeLog(e.log),this.saveIpAddress(),this.channels.forEach((function(t){var e=UA(t);Object.assign(r,e)})),"GHS"===e.currency&&e.elevy_percentage&&(this.elevyPercentage=e.elevy_percentage)}return u(t,[{key:"setMetadata",value:function(t,e){this.metadata[t]=e}},{key:"setDevice",value:function(t){this.deviceFingerprint?ld("Device ID has already been set by Checkout JS so there's no need to set this again"):this.deviceFingerprint=t}},{key:"listenForCharge",value:function(t,e){var r,n=this,i=t.channel,o=t.paymentMethod;window&&window.Pusher&&(r=new window.Pusher(Dd.pusherKey,{cluster:"eu",disableStats:!0}));var a={status:"error",message:"We could not listen for charge response. Use transaction.requery() to check the status."},s=function(){r.unsubscribe(i)};if(!r)return e({status:"error",message:"We could not listen for charge response."},Id);var u=r.subscribe(i);u.bind("pusher:subscription_succeeded",(function(){n.isListening=!0})),u.bind("pusher:subscription_error",(function(){n.isListening=!1,e(a,Id)})),u.bind("response",(function(t){var r=Gd.parse(t);n.logAPIResponse(r,o),e(r,s)}))}},{key:"requery",value:function(){return BT(this.id)}},{key:"markAsAbandoned",value:function(){return DT({publicKey:this.merchant.key,transactionId:this.id})}}]),t}(),cx={validate:function(t){var e=function(t){var e=[];return t&&"object"===n(t)?(Object.keys(Vc).forEach((function(r){var n=Vc[r],i=t[r];!n.required||i||t[n.fallback]?i&&!n.isValid(i)&&e.push({field:r,message:"Invalid field: ".concat(r)}):e.push({field:r,message:"Required field: ".concat(r)})})),e):(e.push({message:"Please supply a valid object"}),e)}(t);if(e.length){var r=y(e,1)[0].message;throw new rs(e,r)}},request:function(t){return o(regeneratorRuntime.mark((function e(){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pd();case 2:return n=e.sent,e.next=5,OT(r(r({},t),{device:n}));case 5:return i=e.sent,e.abrupt("return",i&&Object.seal(new ux(r(r({},i.data),{deviceFingerprint:n}))));case 7:case"end":return e.stop()}}),e)})))()},requestWithAccessCode:function(t){return o(regeneratorRuntime.mark((function e(){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pd();case 2:return n=e.sent,e.next=5,CT(t);case 5:return i=e.sent,e.abrupt("return",i&&Object.seal(new ux(r(r({},i.data),{deviceFingerprint:n}))));case 7:case"end":return e.stop()}}),e)})))()},getByAccessCode:function(t,e){return o(regeneratorRuntime.mark((function n(){var i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,pd();case 2:return i=n.sent,n.next=5,PT(t,e);case 5:return o=n.sent,n.abrupt("return",o&&Object.seal(new ux(r(r({},o.data),{deviceFingerprint:i}))));case 7:case"end":return n.stop()}}),n)})))()},initialize:function(t){return Object.seal(new ux(t))},verify:function(t){return o(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,RT(t);case 2:return r=e.sent,e.abrupt("return",r&&r.data);case 4:case"end":return e.stop()}}),e)})))()}},hx={},lx=function(t){var e=new URL("/bank",Dd.paystackApiUrl).toString(),n=kT(),i={params:t,headers:r({},n&&{"Accept-Language":n})};return xT.get(e,i).then((function(t){return t.data}))},fx=function(){var t=new URL("/checkout/resolutions",Dd.paystackApiUrl).toString(),e=kT(),n=r({},e&&{"Accept-Language":e});return xT.get(t,{headers:n}).then((function(t){return t.data}))},px=function(){var t=new URL("/checkout/celebrations",Dd.paystackApiUrl).toString(),e=kT(),n=r({},e&&{"Accept-Language":e});return xT.get(t,{headers:n}).then((function(t){return t.data}))},dx=function(t){var e=new URL("/address_verification/states",Dd.paystackApiUrl).toString(),n=kT(),i={params:t,headers:r({},n&&{"Accept-Language":n})};return xT.get(e,i).then((function(t){return t.data}))},gx=function(t){var e=new URL("/decision/bin/".concat(t),Dd.paystackApiUrl).toString(),n=kT(),i=r({},n&&{"Accept-Language":n});return hx[t]?Promise.resolve(hx[t]):xT.get(e,{headers:i}).then((function(e){var r=e.data;return hx[t]=r,r}))},mx=function(){function t(){a(this,t)}return u(t,null,[{key:"contents",value:function(){return[{key:"banks",usage:"Returns a list of banks that can be used to complete checkout"},{key:"resolutions",usage:"Returns a list of known errors, mapped to their suggested resolutions"},{key:"celebrations",usage:"Returns a list of upcoming celebrations"},{key:"states",usage:"Returns a list of states for a particular country"}]}},{key:"fetch",value:function(t,e){var r;if(this.contents().map((function(t){return t.key})).indexOf(t)<=-1)throw new Error("Please provide a valid config key. Use Toolkit.contents() to see available options.");switch(t){case"banks":r=lx(e||{pay_with_bank:"1"});break;case"resolutions":r=fx();break;case"celebrations":r=px();break;case"states":r=dx(e)}return r}},{key:"resolveCardBin",value:function(t){return gx(t)}}]),t}();return t.BankAccount=lA,t.Card=YE,t.Toolkit=mx,t.Transaction=cx,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
package/es/checkout.js CHANGED
@@ -18698,12 +18698,47 @@ var CardAPI = {
18698
18698
  }
18699
18699
  }, _callee4);
18700
18700
  }))();
18701
+ },
18702
+ chargeSavedCard: function chargeSavedCard(_ref9) {
18703
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
18704
+ var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18705
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
18706
+ while (1) {
18707
+ switch (_context5.prev = _context5.next) {
18708
+ case 0:
18709
+ token = _ref9.token, device = _ref9.device, cardCode = _ref9.cardCode, transaction = _ref9.transaction, selectedCurrency = _ref9.selectedCurrency;
18710
+ url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18711
+ language = getLanguage();
18712
+ headers = _objectSpread2({
18713
+ Authorization: "Bearer ".concat(token),
18714
+ 'jwt-auth': true
18715
+ }, language && {
18716
+ 'Accept-Language': language
18717
+ });
18718
+ data = {
18719
+ device: device,
18720
+ transaction: transaction,
18721
+ selectedCurrency: selectedCurrency
18722
+ };
18723
+ return _context5.abrupt("return", axiosInstance.post(url, data, {
18724
+ headers: headers
18725
+ }).then(function (response) {
18726
+ return ChargeResponses.parse(response.data);
18727
+ }));
18728
+
18729
+ case 6:
18730
+ case "end":
18731
+ return _context5.stop();
18732
+ }
18733
+ }
18734
+ }, _callee5);
18735
+ }))();
18701
18736
  }
18702
18737
  };
18703
18738
 
18704
18739
  var paymentMethod$3 = 'card';
18705
18740
 
18706
- function validate$4(card, isSetter) {
18741
+ function validate$3(card, isSetter) {
18707
18742
  return new Promise(function (resolve, reject) {
18708
18743
  var validation = Card.validate(card);
18709
18744
 
@@ -18724,7 +18759,7 @@ var CardCharge = {
18724
18759
  setCard: function setCard(params) {
18725
18760
  var _this = this;
18726
18761
 
18727
- return validate$4(params, true).then(function () {
18762
+ return validate$3(params, true).then(function () {
18728
18763
  _this.card = new Card(params);
18729
18764
  });
18730
18765
  },
@@ -18740,7 +18775,7 @@ var CardCharge = {
18740
18775
  return this.chargeCardWithPin(customFields);
18741
18776
  }
18742
18777
 
18743
- return validate$4(this.card).then(function () {
18778
+ return validate$3(this.card).then(function () {
18744
18779
  _this2.logAttempt(paymentMethod$3);
18745
18780
 
18746
18781
  var chargeParams = {
@@ -18923,6 +18958,18 @@ var CardCharge = {
18923
18958
  cardCode: cardCode,
18924
18959
  token: this.savedCardsToken
18925
18960
  });
18961
+ },
18962
+ chargeSavedCard: function chargeSavedCard(_ref5) {
18963
+ var cardCode = _ref5.cardCode,
18964
+ transaction = _ref5.transaction,
18965
+ selectedCurrency = _ref5.selectedCurrency;
18966
+ return CardAPI.chargeSavedCard({
18967
+ cardCode: cardCode,
18968
+ transaction: transaction,
18969
+ selectedCurrency: selectedCurrency,
18970
+ token: this.savedCardsToken,
18971
+ device: this.deviceFingerprint
18972
+ });
18926
18973
  }
18927
18974
  };
18928
18975
 
@@ -19077,7 +19124,7 @@ var EMandateAPI = {
19077
19124
 
19078
19125
  var paymentMethod$2 = 'bank account';
19079
19126
 
19080
- function validate$3(bankAccount, isSetter) {
19127
+ function validate$2(bankAccount, isSetter) {
19081
19128
  return new Promise(function (resolve, reject) {
19082
19129
  var validation = BankAccount.validate(bankAccount);
19083
19130
 
@@ -19095,14 +19142,14 @@ var EMandate = {
19095
19142
  setBankAccount: function setBankAccount(params) {
19096
19143
  var _this = this;
19097
19144
 
19098
- return validate$3(params, true).then(function () {
19145
+ return validate$2(params, true).then(function () {
19099
19146
  _this.bankAccount = new BankAccount(params);
19100
19147
  });
19101
19148
  },
19102
19149
  chargeBankAccount: function chargeBankAccount() {
19103
19150
  var _this2 = this;
19104
19151
 
19105
- return validate$3(this.bankAccount).then(function () {
19152
+ return validate$2(this.bankAccount).then(function () {
19106
19153
  _this2.logAttempt(paymentMethod$2);
19107
19154
 
19108
19155
  var verifyParams = {
@@ -19121,7 +19168,7 @@ var EMandate = {
19121
19168
  registerBankAccount: function registerBankAccount(birthday) {
19122
19169
  var _this3 = this;
19123
19170
 
19124
- return validate$3(this.bankAccount).then(function () {
19171
+ return validate$2(this.bankAccount).then(function () {
19125
19172
  var registerParams = {
19126
19173
  bankId: _this3.bankAccount.bankId,
19127
19174
  transactionId: _this3.id,
@@ -19138,7 +19185,7 @@ var EMandate = {
19138
19185
  authenticateBankAccount: function authenticateBankAccount(token) {
19139
19186
  var _this4 = this;
19140
19187
 
19141
- return validate$3(this.bankAccount).then(function () {
19188
+ return validate$2(this.bankAccount).then(function () {
19142
19189
  var chargeParams = {
19143
19190
  bankId: _this4.bankAccount.bankId,
19144
19191
  transactionId: _this4.id,
@@ -19363,7 +19410,7 @@ var QrAPI = {
19363
19410
  }
19364
19411
  };
19365
19412
 
19366
- function validate$2(channel) {
19413
+ function validate$1(channel) {
19367
19414
  return new Promise(function (resolve, reject) {
19368
19415
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19369
19416
 
@@ -19381,7 +19428,7 @@ var QRCharge = {
19381
19428
  var _this = this;
19382
19429
 
19383
19430
  var channel = _ref.channel;
19384
- return validate$2(channel).then(function () {
19431
+ return validate$1(channel).then(function () {
19385
19432
  if (_this.qr[channel]) {
19386
19433
  return _this.qr[channel];
19387
19434
  }
@@ -19403,7 +19450,7 @@ var QRCharge = {
19403
19450
  var _this2 = this;
19404
19451
 
19405
19452
  var channel = _ref2.channel;
19406
- return validate$2(channel).then(function () {
19453
+ return validate$1(channel).then(function () {
19407
19454
  if (!_this2.qr[channel]) {
19408
19455
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19409
19456
  }
@@ -19524,7 +19571,7 @@ var MobileMoneyAPI = {
19524
19571
  }
19525
19572
  };
19526
19573
 
19527
- function validate$1(phoneNumber) {
19574
+ function validate(phoneNumber) {
19528
19575
  return new Promise(function (resolve, reject) {
19529
19576
  var validation = PhoneNumber.validate(phoneNumber);
19530
19577
 
@@ -19545,7 +19592,7 @@ var MobileMoneyCharge = {
19545
19592
  provider = _ref.provider,
19546
19593
  voucher = _ref.voucher,
19547
19594
  registrationToken = _ref.registrationToken;
19548
- return validate$1(phoneNumber).then(function () {
19595
+ return validate(phoneNumber).then(function () {
19549
19596
  _this.logAttempt('mobile money');
19550
19597
 
19551
19598
  var params = {
@@ -19576,7 +19623,7 @@ var MobileMoneyCharge = {
19576
19623
  var phoneNumber = payload.phoneNumber,
19577
19624
  provider = payload.provider,
19578
19625
  registrationToken = payload.registrationToken;
19579
- return validate$1(phoneNumber).then(function () {
19626
+ return validate(phoneNumber).then(function () {
19580
19627
  _this2.logMobileMoneyActions(payload);
19581
19628
 
19582
19629
  var params = {
@@ -19632,233 +19679,6 @@ var MobileMoneyCharge = {
19632
19679
  }
19633
19680
  };
19634
19681
 
19635
- var PhoneAPI = {
19636
- verify: function verify(phoneNumber, publicKey) {
19637
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
19638
- var language = getLanguage();
19639
-
19640
- var headers = _objectSpread2({
19641
- Authorization: "Bearer ".concat(publicKey)
19642
- }, language && {
19643
- 'Accept-Language': language
19644
- });
19645
-
19646
- return axiosInstance.post(url, {
19647
- phone: phoneNumber
19648
- }, {
19649
- headers: headers
19650
- }).then(function (response) {
19651
- return response.data;
19652
- });
19653
- },
19654
- deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
19655
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
19656
- var language = getLanguage();
19657
-
19658
- var headers = _objectSpread2({
19659
- Authorization: "Bearer ".concat(publicKey)
19660
- }, language && {
19661
- 'Accept-Language': language
19662
- });
19663
-
19664
- return axiosInstance.post(url, {
19665
- phone: phoneNumber,
19666
- id: cardId
19667
- }, {
19668
- headers: headers
19669
- }).then(function (response) {
19670
- return response.data;
19671
- });
19672
- },
19673
- authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
19674
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
19675
- var language = getLanguage();
19676
-
19677
- var headers = _objectSpread2({
19678
- Authorization: "Bearer ".concat(publicKey)
19679
- }, language && {
19680
- 'Accept-Language': language
19681
- });
19682
-
19683
- return axiosInstance.post(url, {
19684
- phone: phoneNumber,
19685
- otp: otp,
19686
- transaction: transactionId
19687
- }, {
19688
- headers: headers
19689
- }).then(function (response) {
19690
- return response.data;
19691
- });
19692
- },
19693
- authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
19694
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
19695
- var language = getLanguage();
19696
-
19697
- var headers = _objectSpread2({
19698
- Authorization: "Bearer ".concat(publicKey)
19699
- }, language && {
19700
- 'Accept-Language': language
19701
- });
19702
-
19703
- return axiosInstance.post(url, {
19704
- phone: phoneNumber,
19705
- pin: pin,
19706
- transaction: transactionId
19707
- }, {
19708
- headers: headers
19709
- }).then(function (response) {
19710
- return response.data;
19711
- });
19712
- },
19713
- setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
19714
- var language = getLanguage();
19715
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
19716
-
19717
- var headers = _objectSpread2({
19718
- Authorization: "Bearer ".concat(publicKey)
19719
- }, language && {
19720
- 'Accept-Language': language
19721
- });
19722
-
19723
- return axiosInstance.post(url, {
19724
- phone: phoneNumber,
19725
- token: transactionToken,
19726
- transaction: transactionId,
19727
- pin: pin
19728
- }, {
19729
- headers: headers
19730
- }).then(function (response) {
19731
- return response.data;
19732
- });
19733
- },
19734
- charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
19735
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
19736
- var language = getLanguage();
19737
-
19738
- var headers = _objectSpread2({
19739
- Authorization: "Bearer ".concat(publicKey)
19740
- }, language && {
19741
- 'Accept-Language': language
19742
- });
19743
-
19744
- return axiosInstance.post(url, {
19745
- id: authId,
19746
- token: token,
19747
- cvv: cvv,
19748
- transaction: transactionId,
19749
- phone: phoneNumber
19750
- }, {
19751
- headers: headers
19752
- }).then(function (response) {
19753
- return response.data;
19754
- });
19755
- },
19756
- enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
19757
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
19758
- var language = getLanguage();
19759
-
19760
- var headers = _objectSpread2({
19761
- Authorization: "Bearer ".concat(publicKey)
19762
- }, language && {
19763
- 'Accept-Language': language
19764
- });
19765
-
19766
- return axiosInstance.post(url, {
19767
- phone: phoneNumber,
19768
- transaction: transactionId
19769
- }, {
19770
- headers: headers
19771
- }).then(function (response) {
19772
- return response.data;
19773
- });
19774
- }
19775
- };
19776
-
19777
- /*
19778
- TODO:
19779
- Implement analytics for Pay with Phone. Since unique actions are takens here e.g
19780
- user verifies pay with phone account, user charged saved card, etc, these should
19781
- all be reflected as custom analytics actions
19782
- */
19783
-
19784
- function validate(phoneNumber) {
19785
- return new Promise(function (resolve, reject) {
19786
- var validation = PhoneNumber.validate(phoneNumber);
19787
-
19788
- if (!validation.isValid) {
19789
- var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
19790
- reject(Error(errorMessage));
19791
- }
19792
-
19793
- resolve(validation);
19794
- });
19795
- }
19796
-
19797
- var PhoneNumberCharge = {
19798
- setCustomer: function setCustomer(_ref) {
19799
- var _this = this;
19800
-
19801
- var phoneNumber = _ref.phoneNumber;
19802
- return validate(phoneNumber).then(function () {
19803
- _this.customer = phoneNumber;
19804
- });
19805
- },
19806
- verifyCustomer: function verifyCustomer() {
19807
- var _this2 = this;
19808
-
19809
- return validate(this.customer).then(function () {
19810
- return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
19811
- });
19812
- },
19813
- deleteSavedCard: function deleteSavedCard(cardId) {
19814
- var _this3 = this;
19815
-
19816
- return validate(this.customer).then(function () {
19817
- return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
19818
- });
19819
- },
19820
- authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
19821
- var _this4 = this;
19822
-
19823
- return validate(this.customer).then(function () {
19824
- return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
19825
- });
19826
- },
19827
- authenticateCustomerPin: function authenticateCustomerPin(pin) {
19828
- var _this5 = this;
19829
-
19830
- return validate(this.customer).then(function () {
19831
- return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
19832
- });
19833
- },
19834
- setCustomerPin: function setCustomerPin(_ref2) {
19835
- var _this6 = this;
19836
-
19837
- var pin = _ref2.pin,
19838
- token = _ref2.token;
19839
- return validate(this.customer).then(function () {
19840
- return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
19841
- });
19842
- },
19843
- chargeSavedCard: function chargeSavedCard(_ref3) {
19844
- var _this7 = this;
19845
-
19846
- var cardId = _ref3.cardId,
19847
- token = _ref3.token,
19848
- cvv = _ref3.cvv;
19849
- return validate(this.customer).then(function () {
19850
- return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
19851
- });
19852
- },
19853
- enrollPhoneNumber: function enrollPhoneNumber(number) {
19854
- var _this8 = this;
19855
-
19856
- return validate(this.customer).then(function () {
19857
- return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
19858
- });
19859
- }
19860
- };
19861
-
19862
19682
  var DirectDebitAPI = {
19863
19683
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19864
19684
  var email = _ref.email,
@@ -20049,7 +19869,6 @@ var ChargeFunctions = {
20049
19869
  ussd: USSDCharge,
20050
19870
  qr: QRCharge,
20051
19871
  mobile_money: MobileMoneyCharge,
20052
- phone: PhoneNumberCharge,
20053
19872
  direct_debit: DirectDebitCharge,
20054
19873
  bank_transfer: PayWithTransferCharge,
20055
19874
  eft: EFT,
package/lib/checkout.js CHANGED
@@ -18702,12 +18702,47 @@ var CardAPI = {
18702
18702
  }
18703
18703
  }, _callee4);
18704
18704
  }))();
18705
+ },
18706
+ chargeSavedCard: function chargeSavedCard(_ref9) {
18707
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
18708
+ var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18709
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
18710
+ while (1) {
18711
+ switch (_context5.prev = _context5.next) {
18712
+ case 0:
18713
+ token = _ref9.token, device = _ref9.device, cardCode = _ref9.cardCode, transaction = _ref9.transaction, selectedCurrency = _ref9.selectedCurrency;
18714
+ url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18715
+ language = getLanguage();
18716
+ headers = _objectSpread2({
18717
+ Authorization: "Bearer ".concat(token),
18718
+ 'jwt-auth': true
18719
+ }, language && {
18720
+ 'Accept-Language': language
18721
+ });
18722
+ data = {
18723
+ device: device,
18724
+ transaction: transaction,
18725
+ selectedCurrency: selectedCurrency
18726
+ };
18727
+ return _context5.abrupt("return", axiosInstance.post(url, data, {
18728
+ headers: headers
18729
+ }).then(function (response) {
18730
+ return ChargeResponses.parse(response.data);
18731
+ }));
18732
+
18733
+ case 6:
18734
+ case "end":
18735
+ return _context5.stop();
18736
+ }
18737
+ }
18738
+ }, _callee5);
18739
+ }))();
18705
18740
  }
18706
18741
  };
18707
18742
 
18708
18743
  var paymentMethod$3 = 'card';
18709
18744
 
18710
- function validate$4(card, isSetter) {
18745
+ function validate$3(card, isSetter) {
18711
18746
  return new Promise(function (resolve, reject) {
18712
18747
  var validation = Card.validate(card);
18713
18748
 
@@ -18728,7 +18763,7 @@ var CardCharge = {
18728
18763
  setCard: function setCard(params) {
18729
18764
  var _this = this;
18730
18765
 
18731
- return validate$4(params, true).then(function () {
18766
+ return validate$3(params, true).then(function () {
18732
18767
  _this.card = new Card(params);
18733
18768
  });
18734
18769
  },
@@ -18744,7 +18779,7 @@ var CardCharge = {
18744
18779
  return this.chargeCardWithPin(customFields);
18745
18780
  }
18746
18781
 
18747
- return validate$4(this.card).then(function () {
18782
+ return validate$3(this.card).then(function () {
18748
18783
  _this2.logAttempt(paymentMethod$3);
18749
18784
 
18750
18785
  var chargeParams = {
@@ -18927,6 +18962,18 @@ var CardCharge = {
18927
18962
  cardCode: cardCode,
18928
18963
  token: this.savedCardsToken
18929
18964
  });
18965
+ },
18966
+ chargeSavedCard: function chargeSavedCard(_ref5) {
18967
+ var cardCode = _ref5.cardCode,
18968
+ transaction = _ref5.transaction,
18969
+ selectedCurrency = _ref5.selectedCurrency;
18970
+ return CardAPI.chargeSavedCard({
18971
+ cardCode: cardCode,
18972
+ transaction: transaction,
18973
+ selectedCurrency: selectedCurrency,
18974
+ token: this.savedCardsToken,
18975
+ device: this.deviceFingerprint
18976
+ });
18930
18977
  }
18931
18978
  };
18932
18979
 
@@ -19081,7 +19128,7 @@ var EMandateAPI = {
19081
19128
 
19082
19129
  var paymentMethod$2 = 'bank account';
19083
19130
 
19084
- function validate$3(bankAccount, isSetter) {
19131
+ function validate$2(bankAccount, isSetter) {
19085
19132
  return new Promise(function (resolve, reject) {
19086
19133
  var validation = BankAccount.validate(bankAccount);
19087
19134
 
@@ -19099,14 +19146,14 @@ var EMandate = {
19099
19146
  setBankAccount: function setBankAccount(params) {
19100
19147
  var _this = this;
19101
19148
 
19102
- return validate$3(params, true).then(function () {
19149
+ return validate$2(params, true).then(function () {
19103
19150
  _this.bankAccount = new BankAccount(params);
19104
19151
  });
19105
19152
  },
19106
19153
  chargeBankAccount: function chargeBankAccount() {
19107
19154
  var _this2 = this;
19108
19155
 
19109
- return validate$3(this.bankAccount).then(function () {
19156
+ return validate$2(this.bankAccount).then(function () {
19110
19157
  _this2.logAttempt(paymentMethod$2);
19111
19158
 
19112
19159
  var verifyParams = {
@@ -19125,7 +19172,7 @@ var EMandate = {
19125
19172
  registerBankAccount: function registerBankAccount(birthday) {
19126
19173
  var _this3 = this;
19127
19174
 
19128
- return validate$3(this.bankAccount).then(function () {
19175
+ return validate$2(this.bankAccount).then(function () {
19129
19176
  var registerParams = {
19130
19177
  bankId: _this3.bankAccount.bankId,
19131
19178
  transactionId: _this3.id,
@@ -19142,7 +19189,7 @@ var EMandate = {
19142
19189
  authenticateBankAccount: function authenticateBankAccount(token) {
19143
19190
  var _this4 = this;
19144
19191
 
19145
- return validate$3(this.bankAccount).then(function () {
19192
+ return validate$2(this.bankAccount).then(function () {
19146
19193
  var chargeParams = {
19147
19194
  bankId: _this4.bankAccount.bankId,
19148
19195
  transactionId: _this4.id,
@@ -19367,7 +19414,7 @@ var QrAPI = {
19367
19414
  }
19368
19415
  };
19369
19416
 
19370
- function validate$2(channel) {
19417
+ function validate$1(channel) {
19371
19418
  return new Promise(function (resolve, reject) {
19372
19419
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19373
19420
 
@@ -19385,7 +19432,7 @@ var QRCharge = {
19385
19432
  var _this = this;
19386
19433
 
19387
19434
  var channel = _ref.channel;
19388
- return validate$2(channel).then(function () {
19435
+ return validate$1(channel).then(function () {
19389
19436
  if (_this.qr[channel]) {
19390
19437
  return _this.qr[channel];
19391
19438
  }
@@ -19407,7 +19454,7 @@ var QRCharge = {
19407
19454
  var _this2 = this;
19408
19455
 
19409
19456
  var channel = _ref2.channel;
19410
- return validate$2(channel).then(function () {
19457
+ return validate$1(channel).then(function () {
19411
19458
  if (!_this2.qr[channel]) {
19412
19459
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19413
19460
  }
@@ -19528,7 +19575,7 @@ var MobileMoneyAPI = {
19528
19575
  }
19529
19576
  };
19530
19577
 
19531
- function validate$1(phoneNumber) {
19578
+ function validate(phoneNumber) {
19532
19579
  return new Promise(function (resolve, reject) {
19533
19580
  var validation = PhoneNumber.validate(phoneNumber);
19534
19581
 
@@ -19549,7 +19596,7 @@ var MobileMoneyCharge = {
19549
19596
  provider = _ref.provider,
19550
19597
  voucher = _ref.voucher,
19551
19598
  registrationToken = _ref.registrationToken;
19552
- return validate$1(phoneNumber).then(function () {
19599
+ return validate(phoneNumber).then(function () {
19553
19600
  _this.logAttempt('mobile money');
19554
19601
 
19555
19602
  var params = {
@@ -19580,7 +19627,7 @@ var MobileMoneyCharge = {
19580
19627
  var phoneNumber = payload.phoneNumber,
19581
19628
  provider = payload.provider,
19582
19629
  registrationToken = payload.registrationToken;
19583
- return validate$1(phoneNumber).then(function () {
19630
+ return validate(phoneNumber).then(function () {
19584
19631
  _this2.logMobileMoneyActions(payload);
19585
19632
 
19586
19633
  var params = {
@@ -19636,233 +19683,6 @@ var MobileMoneyCharge = {
19636
19683
  }
19637
19684
  };
19638
19685
 
19639
- var PhoneAPI = {
19640
- verify: function verify(phoneNumber, publicKey) {
19641
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
19642
- var language = getLanguage();
19643
-
19644
- var headers = _objectSpread2({
19645
- Authorization: "Bearer ".concat(publicKey)
19646
- }, language && {
19647
- 'Accept-Language': language
19648
- });
19649
-
19650
- return axiosInstance.post(url, {
19651
- phone: phoneNumber
19652
- }, {
19653
- headers: headers
19654
- }).then(function (response) {
19655
- return response.data;
19656
- });
19657
- },
19658
- deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
19659
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
19660
- var language = getLanguage();
19661
-
19662
- var headers = _objectSpread2({
19663
- Authorization: "Bearer ".concat(publicKey)
19664
- }, language && {
19665
- 'Accept-Language': language
19666
- });
19667
-
19668
- return axiosInstance.post(url, {
19669
- phone: phoneNumber,
19670
- id: cardId
19671
- }, {
19672
- headers: headers
19673
- }).then(function (response) {
19674
- return response.data;
19675
- });
19676
- },
19677
- authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
19678
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
19679
- var language = getLanguage();
19680
-
19681
- var headers = _objectSpread2({
19682
- Authorization: "Bearer ".concat(publicKey)
19683
- }, language && {
19684
- 'Accept-Language': language
19685
- });
19686
-
19687
- return axiosInstance.post(url, {
19688
- phone: phoneNumber,
19689
- otp: otp,
19690
- transaction: transactionId
19691
- }, {
19692
- headers: headers
19693
- }).then(function (response) {
19694
- return response.data;
19695
- });
19696
- },
19697
- authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
19698
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
19699
- var language = getLanguage();
19700
-
19701
- var headers = _objectSpread2({
19702
- Authorization: "Bearer ".concat(publicKey)
19703
- }, language && {
19704
- 'Accept-Language': language
19705
- });
19706
-
19707
- return axiosInstance.post(url, {
19708
- phone: phoneNumber,
19709
- pin: pin,
19710
- transaction: transactionId
19711
- }, {
19712
- headers: headers
19713
- }).then(function (response) {
19714
- return response.data;
19715
- });
19716
- },
19717
- setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
19718
- var language = getLanguage();
19719
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
19720
-
19721
- var headers = _objectSpread2({
19722
- Authorization: "Bearer ".concat(publicKey)
19723
- }, language && {
19724
- 'Accept-Language': language
19725
- });
19726
-
19727
- return axiosInstance.post(url, {
19728
- phone: phoneNumber,
19729
- token: transactionToken,
19730
- transaction: transactionId,
19731
- pin: pin
19732
- }, {
19733
- headers: headers
19734
- }).then(function (response) {
19735
- return response.data;
19736
- });
19737
- },
19738
- charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
19739
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
19740
- var language = getLanguage();
19741
-
19742
- var headers = _objectSpread2({
19743
- Authorization: "Bearer ".concat(publicKey)
19744
- }, language && {
19745
- 'Accept-Language': language
19746
- });
19747
-
19748
- return axiosInstance.post(url, {
19749
- id: authId,
19750
- token: token,
19751
- cvv: cvv,
19752
- transaction: transactionId,
19753
- phone: phoneNumber
19754
- }, {
19755
- headers: headers
19756
- }).then(function (response) {
19757
- return response.data;
19758
- });
19759
- },
19760
- enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
19761
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
19762
- var language = getLanguage();
19763
-
19764
- var headers = _objectSpread2({
19765
- Authorization: "Bearer ".concat(publicKey)
19766
- }, language && {
19767
- 'Accept-Language': language
19768
- });
19769
-
19770
- return axiosInstance.post(url, {
19771
- phone: phoneNumber,
19772
- transaction: transactionId
19773
- }, {
19774
- headers: headers
19775
- }).then(function (response) {
19776
- return response.data;
19777
- });
19778
- }
19779
- };
19780
-
19781
- /*
19782
- TODO:
19783
- Implement analytics for Pay with Phone. Since unique actions are takens here e.g
19784
- user verifies pay with phone account, user charged saved card, etc, these should
19785
- all be reflected as custom analytics actions
19786
- */
19787
-
19788
- function validate(phoneNumber) {
19789
- return new Promise(function (resolve, reject) {
19790
- var validation = PhoneNumber.validate(phoneNumber);
19791
-
19792
- if (!validation.isValid) {
19793
- var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
19794
- reject(Error(errorMessage));
19795
- }
19796
-
19797
- resolve(validation);
19798
- });
19799
- }
19800
-
19801
- var PhoneNumberCharge = {
19802
- setCustomer: function setCustomer(_ref) {
19803
- var _this = this;
19804
-
19805
- var phoneNumber = _ref.phoneNumber;
19806
- return validate(phoneNumber).then(function () {
19807
- _this.customer = phoneNumber;
19808
- });
19809
- },
19810
- verifyCustomer: function verifyCustomer() {
19811
- var _this2 = this;
19812
-
19813
- return validate(this.customer).then(function () {
19814
- return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
19815
- });
19816
- },
19817
- deleteSavedCard: function deleteSavedCard(cardId) {
19818
- var _this3 = this;
19819
-
19820
- return validate(this.customer).then(function () {
19821
- return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
19822
- });
19823
- },
19824
- authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
19825
- var _this4 = this;
19826
-
19827
- return validate(this.customer).then(function () {
19828
- return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
19829
- });
19830
- },
19831
- authenticateCustomerPin: function authenticateCustomerPin(pin) {
19832
- var _this5 = this;
19833
-
19834
- return validate(this.customer).then(function () {
19835
- return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
19836
- });
19837
- },
19838
- setCustomerPin: function setCustomerPin(_ref2) {
19839
- var _this6 = this;
19840
-
19841
- var pin = _ref2.pin,
19842
- token = _ref2.token;
19843
- return validate(this.customer).then(function () {
19844
- return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
19845
- });
19846
- },
19847
- chargeSavedCard: function chargeSavedCard(_ref3) {
19848
- var _this7 = this;
19849
-
19850
- var cardId = _ref3.cardId,
19851
- token = _ref3.token,
19852
- cvv = _ref3.cvv;
19853
- return validate(this.customer).then(function () {
19854
- return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
19855
- });
19856
- },
19857
- enrollPhoneNumber: function enrollPhoneNumber(number) {
19858
- var _this8 = this;
19859
-
19860
- return validate(this.customer).then(function () {
19861
- return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
19862
- });
19863
- }
19864
- };
19865
-
19866
19686
  var DirectDebitAPI = {
19867
19687
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19868
19688
  var email = _ref.email,
@@ -20053,7 +19873,6 @@ var ChargeFunctions = {
20053
19873
  ussd: USSDCharge,
20054
19874
  qr: QRCharge,
20055
19875
  mobile_money: MobileMoneyCharge,
20056
- phone: PhoneNumberCharge,
20057
19876
  direct_debit: DirectDebitCharge,
20058
19877
  bank_transfer: PayWithTransferCharge,
20059
19878
  eft: EFT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.19.0-dev.4",
3
+ "version": "1.19.0-dev.6",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",