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YD,EAEzC,E,UC3FJE,EAAOC,QAAUC,M,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,CAAC,GAOX,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,OACf,C,8FCrBA,aAAS,8EAAAQ,YAAY,G","sources":["webpack://AJN/./src/js/site/braintree.ts","webpack://AJN/external var \"jQuery\"","webpack://AJN/webpack/bootstrap","webpack://AJN/./src/js/site.ts"],"sourcesContent":["import * as $ from 'jquery';\r\n\r\ndeclare var braintree: any;\r\n\r\n// assume these IDs for dom objects\r\nconst containerid = '#dropin-container';\r\nconst submitbuttonid = '#submit-button';\r\nconst processingid = '#processing-message';\r\nconst checkoutmessageid = '#checkout-message';\r\n\r\nexport interface BraintreeConfig {\r\n clientToken: string;\r\n urlProcess: string; // '/Registration/PaymentBTProcess.ashx'\r\n urlReceipt: string; // '/Registration/RegisterReceipt.aspx'\r\n}\r\n\r\nexport class BraintreePay {\r\n config: BraintreeConfig;\r\n submitButton: HTMLInputElement;\r\n container: HTMLDivElement;\r\n processing: HTMLDivElement;\r\n checkoutmessage: HTMLDivElement;\r\n\r\n constructor(config: BraintreeConfig) {\r\n this.config = config;\r\n this.submitButton = document.querySelector(submitbuttonid) as HTMLInputElement;\r\n this.container = document.querySelector(containerid) as HTMLDivElement;\r\n this.processing = document.querySelector(processingid) as HTMLDivElement;\r\n this.checkoutmessage = document.querySelector(checkoutmessageid) as HTMLDivElement;\r\n }\r\n\r\n initalize() {\r\n const self = this;\r\n braintree.dropin.create({\r\n // Insert your tokenization key here\r\n authorization: this.config.clientToken,\r\n container: '#dropin-container'\r\n }, function (createErr, instance) {\r\n if (createErr) {\r\n // Handle any errors that might've occurred when creating Drop-in\r\n console.error(createErr);\r\n self.showError(createErr);\r\n return;\r\n }\r\n self.submitButton.addEventListener('click', function () {\r\n self.handleSubmit(instance);\r\n });\r\n self.submitButton.disabled = false;\r\n });\r\n }\r\n\r\n handleSubmit(instance: any) {\r\n const self = this;\r\n self.submitButton.disabled = true;\r\n self.container.style.display = \"none\";\r\n self.processing.style.display = \"block\";\r\n instance.requestPaymentMethod(function (requestPaymentMethodErr, payload) {\r\n // When the user clicks on the 'Submit payment' button this code will send the\r\n // encrypted payment information in a variable called a payment method nonce\r\n if (requestPaymentMethodErr) {\r\n console.error(requestPaymentMethodErr);\r\n self.showError(requestPaymentMethodErr);\r\n return;\r\n }\r\n else {\r\n $.ajax({\r\n type: 'POST',\r\n url: self.config.urlProcess,\r\n data: {\r\n 'payment_method_nonce': payload.nonce\r\n }\r\n }).done(function (result) {\r\n if (result.success) {\r\n window.location.href = self.config.urlReceipt;\r\n } else {\r\n instance.clearSelectedPaymentMethod();\r\n self.showError('Payment Error ' + result.message);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n showError(errormsg: string) {\r\n this.submitButton.disabled = false;\r\n this.container.style.display = \"block\";\r\n this.processing.style.display = \"none\";\r\n if (errormsg) {\r\n this.checkoutmessage.style.display = \"block\";\r\n this.checkoutmessage.innerHTML = errormsg;\r\n }\r\n }\r\n}","module.exports = jQuery;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export type {BraintreeConfig } from \"./site/braintree\";\r\nexport { BraintreePay } from \"./site/braintree\";\r\n"],"names":["constructor","config","this","submitButton","document","querySelector","container","processing","checkoutmessage","initalize","self","braintree","dropin","create","authorization","clientToken","createErr","instance","console","error","showError","addEventListener","handleSubmit","disabled","style","display","requestPaymentMethod","requestPaymentMethodErr","payload","$","ajax","type","url","urlProcess","data","nonce","done","result","success","window","location","href","urlReceipt","clearSelectedPaymentMethod","message","errormsg","innerHTML","module","exports","jQuery","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","BraintreePay"],"sourceRoot":""}