@rebilly/framepay-vue 1.2.0 → 1.4.0

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.
Files changed (3) hide show
  1. package/README.md +5 -9
  2. package/dist/build.js +53 -49
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,7 +18,7 @@ This is the repo for the official Vue.js wrapper for Rebilly's [FramePay](https:
18
18
  - [On a component (rebilly-form, rebilly-card etc)](#on-a-component-rebilly-form-rebilly-card-etc)
19
19
  - [Lazy loading Framepay files](#lazy-loading-framepay-files)
20
20
  - [Usage](#usage)
21
- - [Digital wallets](#digital-wallets)
21
+ - [Google Pay and Apple Pay](#google-pay-and-apple-pay)
22
22
  - [With rebilly-form](#with-rebilly-form)
23
23
  - [With rebilly-form and custom submit logic](#with-rebilly-form-and-custom-submit-logic)
24
24
  - [With rebilly-token](#with-rebilly-token)
@@ -165,26 +165,22 @@ The script will only be loaded the first time `created()` is called, so you can
165
165
  - `RebillyCard` automatically mounts the combined credit card payment method
166
166
  - `RebillyCardCvv`, `RebillycardExpiration`, and `RebillyCardNumber` mount three separate components for collecting credit info
167
167
  - `RebillyBankAccountNumber`, `RebillyBankAccountType`, and `RebillyBankRoutingNumber` mount the `ach` (bank account) payment method
168
- - `RebillyDigitalWallet` and `RebillyApplePay` mount Google Pay and Apple Pay respectively. These two methods are different from the rest, as they require additional inputs and emit the payment token with a separate event.
168
+ - `RebillyGooglePay` and `RebillyApplePay` mount Google Pay and Apple Pay respectively. These two methods are different from the rest, as they require additional inputs and emit the payment token with a separate event.
169
169
 
170
170
  Two more components are also offered for convenience:
171
171
 
172
172
  - `RebillyForm` wraps a regular HTML `form`. It automatically detects payment method components and performs token creation/injection when the form is submitted. It is the simplest way to get started with `framepay-vue`.
173
173
  - `RebillyToken` can be added to any standard form, and when present will automatically receive the token created by `createToken()`. You do not need to use `RebillyToken` if you are using `RebillyForm` already.
174
174
 
175
- #### Digital wallets
176
- `RebillyDigitaWallet` and `RebillyApplePay` are used like so:
175
+ #### Google Pay and Apple Pay
176
+ `RebillyGooglePay` and `RebillyApplePay` are used like so:
177
177
  ```html
178
178
  <rebilly-apple-pay
179
- :form="form"
180
- :extraData="extraData"
181
179
  @token-ready="handleToken"
182
180
  />
183
181
  ```
184
182
 
185
183
  whereas:
186
- * `:form` is the DOM element of your payment form (this does not need to be `<rebilly-form>`, it could be any DOM element).
187
- * `:extraData` is an object containing any additional information you'd like to supply for the token creation.
188
184
  * `@token-ready` is an event emitted once the payment token has been generated and its payload contains the token object.
189
185
 
190
186
  #### With rebilly-form
@@ -213,7 +209,7 @@ Any DOM attributes you attach to `RebillyForm` will automatically be passed to t
213
209
 
214
210
  `@error` will expose the error message returned if the `Rebilly.createToken()` request failed. You can inspect `error.message` and `error.code`.
215
211
 
216
- `@token-ready` will expose the token object, if a digital wallet element was mounted in the form.
212
+ `@token-ready` will expose the token object, if a Google/Apple Pay element was mounted in the form.
217
213
 
218
214
  See here for all arguments to `extraData`: https://rebilly.github.io/framepay-docs/reference/rebilly.html#extra-data.
219
215
 
package/dist/build.js CHANGED
@@ -128,8 +128,9 @@ var REBILLY_BBAN_ACCOUNT_TYPE = 'accountType';
128
128
  var REBILLY_BBAN_ROUTING_NUMBER = 'routingNumber';
129
129
  var REBILLY_BBAN_ACCOUNT_NUMBER = 'accountNumber';
130
130
  var REBILLY_IBAN = 'iban';
131
- var REBILLY_DIGITAL_WALLET = 'digitalWallet';
131
+ var REBILLY_GOOGLE_PAY = 'googlePay';
132
132
  var REBILLY_APPLE_PAY = 'applePay';
133
+ var REBILLY_PAYPAL = 'paypal';
133
134
  var FIELD_TYPES = {
134
135
  REBILLY_CARD: REBILLY_CARD,
135
136
  REBILLY_CARD_CVV: REBILLY_CARD_CVV,
@@ -139,8 +140,9 @@ var FIELD_TYPES = {
139
140
  REBILLY_BBAN_ROUTING_NUMBER: REBILLY_BBAN_ROUTING_NUMBER,
140
141
  REBILLY_BBAN_ACCOUNT_NUMBER: REBILLY_BBAN_ACCOUNT_NUMBER,
141
142
  REBILLY_IBAN: REBILLY_IBAN,
142
- REBILLY_DIGITAL_WALLET: REBILLY_DIGITAL_WALLET,
143
- REBILLY_APPLE_PAY: REBILLY_APPLE_PAY
143
+ REBILLY_GOOGLE_PAY: REBILLY_GOOGLE_PAY,
144
+ REBILLY_APPLE_PAY: REBILLY_APPLE_PAY,
145
+ REBILLY_PAYPAL: REBILLY_PAYPAL
144
146
  };
145
147
 
146
148
  function createToken (form, extraData) {
@@ -496,7 +498,7 @@ var BaseElementMixin = {
496
498
  }
497
499
  };
498
500
 
499
- var DigitalWalletMixin = {
501
+ var GooglePayMixin = {
500
502
  render: function render(createElement) {
501
503
  return createElement('div', {
502
504
  domProps: {
@@ -508,9 +510,7 @@ var DigitalWalletMixin = {
508
510
  id: {
509
511
  type: String
510
512
  },
511
- configuration: {},
512
- form: {},
513
- extraData: {}
513
+ configuration: {}
514
514
  },
515
515
  data: function data() {
516
516
  return {
@@ -524,40 +524,27 @@ var DigitalWalletMixin = {
524
524
 
525
525
  initializeRebilly(this.configuration).then(function (Rebilly) {
526
526
  try {
527
- var form = document.getElementById('rebilly-form') || _this.form;
528
-
529
- if (_this.elementType === 'digitalWallet') {
530
- _this.element = Rebilly.digitalWallet.mount(selector, {
531
- type: 'googlePay',
532
- form: form,
533
- extraData: _this.extraData
534
- });
535
-
536
- _this.element.on('ready', function () {
537
- return _this.$emit('ready');
538
- });
539
-
540
- _this.element.on('change', function (e) {
541
- return _this.$emit('change', e);
542
- });
543
-
544
- _this.element.on('focus', function () {
545
- return _this.$emit('focus');
546
- });
547
-
548
- _this.element.on('blur', function () {
549
- return _this.$emit('blur');
550
- });
551
-
552
- _this.element.on('error', function () {
553
- return _this.$emit('error');
554
- });
555
- } else if (_this.elementType === 'applePay') {
556
- _this.element = Rebilly.applePay.mount(selector, {
557
- form: form,
558
- extraData: _this.extraData
559
- });
560
- }
527
+ _this.element = Rebilly.googlePay.mount(selector);
528
+
529
+ _this.element.on('ready', function () {
530
+ return _this.$emit('ready');
531
+ });
532
+
533
+ _this.element.on('change', function (e) {
534
+ return _this.$emit('change', e);
535
+ });
536
+
537
+ _this.element.on('focus', function () {
538
+ return _this.$emit('focus');
539
+ });
540
+
541
+ _this.element.on('blur', function () {
542
+ return _this.$emit('blur');
543
+ });
544
+
545
+ _this.element.on('error', function () {
546
+ return _this.$emit('error');
547
+ });
561
548
 
562
549
  Rebilly.on('token-ready', function (token) {
563
550
  // https://github.com/vuejs/vue/issues/4332#issuecomment-263444492
@@ -592,7 +579,7 @@ var DigitalWalletMixin = {
592
579
  }
593
580
  };
594
581
 
595
- var ApplePayMixin = {
582
+ var NonIframeElementMixin = {
596
583
  render: function render(createElement) {
597
584
  return createElement('div', {
598
585
  domProps: {
@@ -618,7 +605,15 @@ var ApplePayMixin = {
618
605
 
619
606
  initializeRebilly(this.configuration).then(function (Rebilly) {
620
607
  try {
621
- _this.element = Rebilly.applePay.mount(selector);
608
+ var namespace = null;
609
+
610
+ if (_this.elementType === FIELD_TYPES.REBILLY_APPLE_PAY) {
611
+ namespace = Rebilly.applePay;
612
+ } else if (_this.elementType === FIELD_TYPES.REBILLY_PAYPAL) {
613
+ namespace = Rebilly.paypal;
614
+ }
615
+
616
+ _this.element = namespace.mount(selector);
622
617
  Rebilly.on('token-ready', function (token) {
623
618
  // https://github.com/vuejs/vue/issues/4332#issuecomment-263444492
624
619
  // Emit token on the element level:
@@ -724,14 +719,14 @@ var RebillyIban = {
724
719
  },
725
720
  mixins: [BaseElementMixin]
726
721
  };
727
- var RebillyDigitalWallet = {
728
- name: 'rebilly-digital-wallet',
722
+ var RebillyGooglePay = {
723
+ name: 'rebilly-google-pay',
729
724
  data: function data() {
730
725
  return {
731
- elementType: FIELD_TYPES.REBILLY_DIGITAL_WALLET
726
+ elementType: FIELD_TYPES.REBILLY_GOOGLE_PAY
732
727
  };
733
728
  },
734
- mixins: [DigitalWalletMixin]
729
+ mixins: [GooglePayMixin]
735
730
  };
736
731
  var RebillyApplePay = {
737
732
  name: 'rebilly-apple-pay',
@@ -740,7 +735,16 @@ var RebillyApplePay = {
740
735
  elementType: FIELD_TYPES.REBILLY_APPLE_PAY
741
736
  };
742
737
  },
743
- mixins: [ApplePayMixin]
738
+ mixins: [NonIframeElementMixin]
739
+ };
740
+ var RebillyPaypal = {
741
+ name: 'rebilly-paypal',
742
+ data: function data() {
743
+ return {
744
+ elementType: FIELD_TYPES.REBILLY_PAYPAL
745
+ };
746
+ },
747
+ mixins: [NonIframeElementMixin]
744
748
  };
745
749
 
746
750
  var FramePay = {
@@ -752,4 +756,4 @@ var FramePay = {
752
756
  };
753
757
 
754
758
  export default FramePay;
755
- export { RebillyApplePay, RebillyBbanAccountNumber, RebillyBbanAccountType, RebillyBbanRoutingNumber, RebillyCard, RebillyCardCvv, RebillyCardExpiration, RebillyCardNumber, RebillyDigitalWallet, FIELD_TYPES as RebillyFieldTypes, __vue_component__ as RebillyForm, RebillyIban, __vue_component__$1 as RebillyToken, createToken, updateConfig };
759
+ export { RebillyApplePay, RebillyBbanAccountNumber, RebillyBbanAccountType, RebillyBbanRoutingNumber, RebillyCard, RebillyCardCvv, RebillyCardExpiration, RebillyCardNumber, FIELD_TYPES as RebillyFieldTypes, __vue_component__ as RebillyForm, RebillyGooglePay, RebillyIban, RebillyPaypal, __vue_component__$1 as RebillyToken, createToken, updateConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/framepay-vue",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Official Vue wrapper for Rebilly FramePay",
5
5
  "author": "Rebilly",
6
6
  "repository": "https://github.com/Rebilly/framepay-vue",