swell-js 5.6.1 → 5.7.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.
package/dist/api.mjs CHANGED
@@ -446,7 +446,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
446
446
  const api = {};
447
447
 
448
448
  Object.assign(api, {
449
- version: '5.6.1',
449
+ version: '5.7.0',
450
450
  options,
451
451
  request,
452
452
 
package/dist/payment.mjs CHANGED
@@ -678,6 +678,7 @@ async function createPaymentMethod(stripe, cardElement, cart) {
678
678
  return error
679
679
  ? { error }
680
680
  : {
681
+ gateway: 'stripe',
681
682
  token: paymentMethod.id,
682
683
  last4: paymentMethod.card.last4,
683
684
  exp_month: paymentMethod.card.exp_month,
@@ -948,6 +949,10 @@ class StripeCardPayment extends Payment {
948
949
  throw new Error(paymentMethod.error.message);
949
950
  }
950
951
 
952
+ if (!isLiveMode(this.method.mode)) {
953
+ paymentMethod.test = true;
954
+ }
955
+
951
956
  // should save payment method data when payment amount is not chargeable
952
957
  if (!isStripeChargeableAmount(cart.capture_total, cart.currency)) {
953
958
  await this.updateCart({
@@ -3883,7 +3888,7 @@ class QuickpayCardPayment extends Payment {
3883
3888
  }
3884
3889
 
3885
3890
  get orderId() {
3886
- return Math.random().toString(36).substr(2, 9);
3891
+ return Math.random().toString(36).slice(2, 11);
3887
3892
  }
3888
3893
 
3889
3894
  async tokenize() {
@@ -3945,6 +3950,12 @@ class QuickpayCardPayment extends Payment {
3945
3950
  throw new Error(card.error.message);
3946
3951
  }
3947
3952
 
3953
+ card.gateway = 'quickpay';
3954
+
3955
+ if (!isLiveMode(this.method.mode)) {
3956
+ card.test = true;
3957
+ }
3958
+
3948
3959
  await this.updateCart({
3949
3960
  billing: {
3950
3961
  method: 'card',
package/dist/swell.cjs CHANGED
@@ -7296,6 +7296,7 @@ async function createPaymentMethod(stripe, cardElement, cart) {
7296
7296
  return error
7297
7297
  ? { error }
7298
7298
  : {
7299
+ gateway: 'stripe',
7299
7300
  token: paymentMethod.id,
7300
7301
  last4: paymentMethod.card.last4,
7301
7302
  exp_month: paymentMethod.card.exp_month,
@@ -7566,6 +7567,10 @@ class StripeCardPayment extends Payment {
7566
7567
  throw new Error(paymentMethod.error.message);
7567
7568
  }
7568
7569
 
7570
+ if (!isLiveMode(this.method.mode)) {
7571
+ paymentMethod.test = true;
7572
+ }
7573
+
7569
7574
  // should save payment method data when payment amount is not chargeable
7570
7575
  if (!isStripeChargeableAmount(cart.capture_total, cart.currency)) {
7571
7576
  await this.updateCart({
@@ -10501,7 +10506,7 @@ class QuickpayCardPayment extends Payment {
10501
10506
  }
10502
10507
 
10503
10508
  get orderId() {
10504
- return Math.random().toString(36).substr(2, 9);
10509
+ return Math.random().toString(36).slice(2, 11);
10505
10510
  }
10506
10511
 
10507
10512
  async tokenize() {
@@ -10563,6 +10568,12 @@ class QuickpayCardPayment extends Payment {
10563
10568
  throw new Error(card.error.message);
10564
10569
  }
10565
10570
 
10571
+ card.gateway = 'quickpay';
10572
+
10573
+ if (!isLiveMode(this.method.mode)) {
10574
+ card.test = true;
10575
+ }
10576
+
10566
10577
  await this.updateCart({
10567
10578
  billing: {
10568
10579
  method: 'card',
@@ -12944,7 +12955,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
12944
12955
  const api = {};
12945
12956
 
12946
12957
  Object.assign(api, {
12947
- version: '5.6.1',
12958
+ version: '5.7.0',
12948
12959
  options,
12949
12960
  request,
12950
12961