Sha256: 4c50b63bc283ac114ead3264120ad3d43590896fc37606053a6143b43b1cb9d2
Contents?: true
Size: 1015 Bytes
Versions: 3
Compression:
Stored size: 1015 Bytes
Contents
SolidusPaypalBraintree.HostedForm = function(paymentMethodId) { this.paymentMethodId = paymentMethodId; this.client = null; }; SolidusPaypalBraintree.HostedForm.prototype.initialize = function() { this.client = SolidusPaypalBraintree.createClient({paymentMethodId: this.paymentMethodId}); return this.client.initialize(). then(this._createHostedFields.bind(this)); }; SolidusPaypalBraintree.HostedForm.prototype._createHostedFields = function () { if (!this.client) { throw new Error("Client not initialized, please call initialize first!"); } var opts = { client: this.client.getBraintreeInstance(), fields: { number: { selector: "#card_number" + this.paymentMethodId }, cvv: { selector: "#card_code" + this.paymentMethodId }, expirationDate: { selector: "#card_expiry" + this.paymentMethodId } } }; return SolidusPaypalBraintree.PromiseShim.convertBraintreePromise(braintree.hostedFields.create, [opts]); };
Version data entries
3 entries across 3 versions & 1 rubygems