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UO,GAIf,OAAO,CACHE,KAAM,OACNC,IAAKpB,EAAKT,OAAO8B,WACjBC,KAAM,CACF,qBAAwBJ,EAAQK,SAErCC,MAAK,SAAUC,GACVA,EAAOC,QACPC,OAAOC,SAASC,KAAO7B,EAAKT,OAAOuC,YAEnCvB,EAASwB,6BACT/B,EAAKU,UAAU,kCAAoCe,EAAOO,SAElE,GAER,GACJ,CAEA,SAAAtB,CAAUuB,GACNzC,KAAKC,aAAaoB,UAAW,EAC7BrB,KAAKI,UAAUkB,MAAMC,QAAU,QAC/BvB,KAAKK,WAAWiB,MAAMC,QAAU,OAC5BkB,IACAzC,KAAKM,gBAAgBgB,MAAMC,QAAU,QACrCvB,KAAKM,gBAAgBoC,UAAYD,EAEzC,G","sources":["webpack://AJN/webpack/bootstrap","webpack://AJN/webpack/runtime/define property getters","webpack://AJN/webpack/runtime/hasOwnProperty shorthand","webpack://AJN/webpack/runtime/make namespace object","webpack://AJN/external var \"jQuery\"","webpack://AJN/./src/js/site/braintree.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = jQuery;","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}"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","jQuery","BraintreePay","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","type","url","urlProcess","data","nonce","done","result","success","window","location","href","urlReceipt","clearSelectedPaymentMethod","message","errormsg","innerHTML"],"sourceRoot":""}