@pelcro/react-pelcro-js 3.26.0-beta.10 → 3.26.0-beta.11

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/index.cjs.js CHANGED
@@ -18211,7 +18211,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18211
18211
  } else if (type === "orderCreate") {
18212
18212
  purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18213
18213
  } else if (type === "invoicePayment") {
18214
- payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18214
+ payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18215
18215
  } else if (type === "updatePaymentSource") {
18216
18216
  createNewCybersourceCard();
18217
18217
  }
@@ -18541,7 +18541,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18541
18541
  } else if (type === "orderCreate") {
18542
18542
  purchase(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18543
18543
  } else if (type === "invoicePayment") {
18544
- payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18544
+ payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18545
18545
  } else if (type === "updatePaymentSource") {
18546
18546
  createNewTapCard();
18547
18547
  }
@@ -18752,7 +18752,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18752
18752
  } else if (type === "orderCreate") {
18753
18753
  purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18754
18754
  } else if (type === "invoicePayment") {
18755
- payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18755
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18756
18756
  } else if (type === "updatePaymentSource") {
18757
18757
  createNewVantivCard();
18758
18758
  }
@@ -19584,7 +19584,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19584
19584
  });
19585
19585
  });
19586
19586
  };
19587
- const payInvoice = (gatewayService, gatewayToken, dispatch) => {
19587
+ const payInvoice = function (gatewayService, gatewayToken, dispatch) {
19588
+ let cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
19588
19589
  const payment = new Payment(gatewayService);
19589
19590
  return payment.execute({
19590
19591
  type: PAYMENT_TYPES.PAY_INVOICE,
@@ -19592,7 +19593,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19592
19593
  isExistingSource: Boolean(selectedPaymentMethodId),
19593
19594
  invoiceId: invoice.id
19594
19595
  }, (err, res) => {
19595
- confirmStripeCardPayment(res, err);
19596
+ if (cb && typeof cb == "function") {
19597
+ cb(res, err);
19598
+ } else {
19599
+ dispatch({
19600
+ type: DISABLE_SUBMIT,
19601
+ payload: false
19602
+ });
19603
+ dispatch({
19604
+ type: LOADING,
19605
+ payload: false
19606
+ });
19607
+ if (err) {
19608
+ onFailure(err);
19609
+ return dispatch({
19610
+ type: SHOW_ALERT,
19611
+ payload: {
19612
+ type: "error",
19613
+ content: getErrorMessages(err)
19614
+ }
19615
+ });
19616
+ }
19617
+ onSuccess(res);
19618
+ }
19596
19619
  });
19597
19620
  };
19598
19621
  const updatePaymentSource = (state, dispatch) => {
@@ -19836,7 +19859,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19836
19859
  } else if (stripeSource && type === "orderCreate") {
19837
19860
  purchase(new StripeGateway(), stripeSource.id, state, dispatch);
19838
19861
  } else if (stripeSource && type === "invoicePayment") {
19839
- payInvoice(new StripeGateway(), stripeSource.id);
19862
+ payInvoice(new StripeGateway(), stripeSource.id, dispatch, confirmStripeCardPayment);
19840
19863
  }
19841
19864
  };
19842
19865
  const handlePaymentError = error => {
@@ -20008,7 +20031,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20008
20031
  case HANDLE_PAYPAL_SUBSCRIPTION:
20009
20032
  return lib_5(state, (state, dispatch) => {
20010
20033
  if (type === "invoicePayment") {
20011
- payInvoice(new PaypalGateway(), action.payload);
20034
+ payInvoice(new PaypalGateway(), action.payload, dispatch);
20012
20035
  } else {
20013
20036
  handlePaypalSubscription(state, action.payload);
20014
20037
  }
package/dist/index.esm.js CHANGED
@@ -18181,7 +18181,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18181
18181
  } else if (type === "orderCreate") {
18182
18182
  purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18183
18183
  } else if (type === "invoicePayment") {
18184
- payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18184
+ payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18185
18185
  } else if (type === "updatePaymentSource") {
18186
18186
  createNewCybersourceCard();
18187
18187
  }
@@ -18511,7 +18511,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18511
18511
  } else if (type === "orderCreate") {
18512
18512
  purchase(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18513
18513
  } else if (type === "invoicePayment") {
18514
- payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18514
+ payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18515
18515
  } else if (type === "updatePaymentSource") {
18516
18516
  createNewTapCard();
18517
18517
  }
@@ -18722,7 +18722,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18722
18722
  } else if (type === "orderCreate") {
18723
18723
  purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18724
18724
  } else if (type === "invoicePayment") {
18725
- payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18725
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18726
18726
  } else if (type === "updatePaymentSource") {
18727
18727
  createNewVantivCard();
18728
18728
  }
@@ -19554,7 +19554,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19554
19554
  });
19555
19555
  });
19556
19556
  };
19557
- const payInvoice = (gatewayService, gatewayToken, dispatch) => {
19557
+ const payInvoice = function (gatewayService, gatewayToken, dispatch) {
19558
+ let cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
19558
19559
  const payment = new Payment(gatewayService);
19559
19560
  return payment.execute({
19560
19561
  type: PAYMENT_TYPES.PAY_INVOICE,
@@ -19562,7 +19563,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19562
19563
  isExistingSource: Boolean(selectedPaymentMethodId),
19563
19564
  invoiceId: invoice.id
19564
19565
  }, (err, res) => {
19565
- confirmStripeCardPayment(res, err);
19566
+ if (cb && typeof cb == "function") {
19567
+ cb(res, err);
19568
+ } else {
19569
+ dispatch({
19570
+ type: DISABLE_SUBMIT,
19571
+ payload: false
19572
+ });
19573
+ dispatch({
19574
+ type: LOADING,
19575
+ payload: false
19576
+ });
19577
+ if (err) {
19578
+ onFailure(err);
19579
+ return dispatch({
19580
+ type: SHOW_ALERT,
19581
+ payload: {
19582
+ type: "error",
19583
+ content: getErrorMessages(err)
19584
+ }
19585
+ });
19586
+ }
19587
+ onSuccess(res);
19588
+ }
19566
19589
  });
19567
19590
  };
19568
19591
  const updatePaymentSource = (state, dispatch) => {
@@ -19806,7 +19829,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19806
19829
  } else if (stripeSource && type === "orderCreate") {
19807
19830
  purchase(new StripeGateway(), stripeSource.id, state, dispatch);
19808
19831
  } else if (stripeSource && type === "invoicePayment") {
19809
- payInvoice(new StripeGateway(), stripeSource.id);
19832
+ payInvoice(new StripeGateway(), stripeSource.id, dispatch, confirmStripeCardPayment);
19810
19833
  }
19811
19834
  };
19812
19835
  const handlePaymentError = error => {
@@ -19978,7 +20001,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19978
20001
  case HANDLE_PAYPAL_SUBSCRIPTION:
19979
20002
  return lib_5(state, (state, dispatch) => {
19980
20003
  if (type === "invoicePayment") {
19981
- payInvoice(new PaypalGateway(), action.payload);
20004
+ payInvoice(new PaypalGateway(), action.payload, dispatch);
19982
20005
  } else {
19983
20006
  handlePaypalSubscription(state, action.payload);
19984
20007
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.26.0-beta.10",
4
+ "version": "3.26.0-beta.11",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",