summit-registration-lite 3.0.2 → 3.0.3

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 (2) hide show
  1. package/dist/index.js +27 -41
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -90,7 +90,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
90
90
 
91
91
 
92
92
 
93
-
94
93
  class LawPayProvider {
95
94
  constructor({
96
95
  reservation,
@@ -101,9 +100,9 @@ class LawPayProvider {
101
100
  dispatch: _dispatch
102
101
  }) {
103
102
  _defineProperty(this, "payTicket", ({
104
- token
103
+ token = null
105
104
  }) => async dispatch => {
106
- var _this$userProfile, _this$userProfile2, _this$userProfile3, _this$userProfile4;
105
+ var _this$userProfile, _this$userProfile2, _this$userProfile3, _this$userProfile4, _this$userProfile5, _this$userProfile6;
107
106
 
108
107
  // Pay using affinity lawpay
109
108
  const errorHandler = (err, res) => (dispatch, state) => {
@@ -135,44 +134,31 @@ class LawPayProvider {
135
134
  expand: 'tickets,' + 'tickets.owner,' + 'tickets.owner.extra_questions,' + 'tickets.badge,' + 'tickets.badge.type,' + 'tickets.badge.type.access_levels,' + 'tickets.badge.type.features,' + 'tickets.ticket_type,' + 'tickets.ticket_type.taxes'
136
135
  };
137
136
  let normalizedEntity = {
138
- billing_address_1: token.address1 || '',
139
- billing_address_2: ((_this$userProfile = this.userProfile) === null || _this$userProfile === void 0 ? void 0 : _this$userProfile.address2) || '',
140
- billing_address_zip_code: token.postal_code,
141
- billing_address_city: ((_this$userProfile2 = this.userProfile) === null || _this$userProfile2 === void 0 ? void 0 : _this$userProfile2.locality) || '',
142
- billing_address_state: ((_this$userProfile3 = this.userProfile) === null || _this$userProfile3 === void 0 ? void 0 : _this$userProfile3.region) || '',
143
- billing_address_country: ((_this$userProfile4 = this.userProfile) === null || _this$userProfile4 === void 0 ? void 0 : _this$userProfile4.country) || '',
144
- payment_method_id: token.id
137
+ billing_address_1: token ? token.address1 : ((_this$userProfile = this.userProfile) === null || _this$userProfile === void 0 ? void 0 : _this$userProfile.address1) || '',
138
+ billing_address_2: ((_this$userProfile2 = this.userProfile) === null || _this$userProfile2 === void 0 ? void 0 : _this$userProfile2.address2) || '',
139
+ billing_address_zip_code: token ? token.postal_code : ((_this$userProfile3 = this.userProfile) === null || _this$userProfile3 === void 0 ? void 0 : _this$userProfile3.postal_code) || '',
140
+ billing_address_city: ((_this$userProfile4 = this.userProfile) === null || _this$userProfile4 === void 0 ? void 0 : _this$userProfile4.locality) || '',
141
+ billing_address_state: ((_this$userProfile5 = this.userProfile) === null || _this$userProfile5 === void 0 ? void 0 : _this$userProfile5.region) || '',
142
+ billing_address_country: ((_this$userProfile6 = this.userProfile) === null || _this$userProfile6 === void 0 ? void 0 : _this$userProfile6.country) || ''
145
143
  };
146
- this.dispatch(startWidgetLoading());
147
144
 
148
- if (this.reservation.amount > 0) {
149
- return (0,actions_namespaceObject.putRequest)(null, (0,actions_namespaceObject.createAction)(PAY_RESERVATION), `${this.apiBaseUrl}/api/v1/summits/${this.summitId}/orders/${this.reservation.hash}/checkout`, normalizedEntity, errorHandler // entity
150
- )(params)(this.dispatch).then(payload => {
151
- this.dispatch(stopWidgetLoading());
152
- this.dispatch((0,actions_namespaceObject.createAction)(CLEAR_RESERVATION)({}));
153
- this.dispatch(changeStep(3));
154
- return payload;
155
- }).catch(e => {
156
- this.dispatch(removeReservedTicket());
157
- this.dispatch(changeStep(1));
158
- this.dispatch(stopWidgetLoading());
159
- return e;
160
- }); // The payment has succeeded. Display a success message.
161
- } else {
162
- // FREE TICKET
163
- return (0,actions_namespaceObject.putRequest)(null, (0,actions_namespaceObject.createAction)(PAY_RESERVATION), `${this.apiBaseUrl}/api/v1/summits/${this.summitId}/orders/${this.reservation.hash}/checkout`, normalizedEntity, errorHandler // entity
164
- )(params)(this.dispatch).then(payload => {
165
- this.dispatch(stopWidgetLoading());
166
- this.dispatch((0,actions_namespaceObject.createAction)(CLEAR_RESERVATION)({}));
167
- this.dispatch(changeStep(3));
168
- return payload;
169
- }).catch(e => {
170
- this.dispatch(removeReservedTicket());
171
- this.dispatch(changeStep(1));
172
- this.dispatch(stopWidgetLoading());
173
- return e;
174
- }); // The payment has succeeded. Display a success message.
145
+ if (token) {
146
+ normalizedEntity['payment_method_id'] = token.id;
175
147
  }
148
+
149
+ this.dispatch(startWidgetLoading());
150
+ return (0,actions_namespaceObject.putRequest)(null, (0,actions_namespaceObject.createAction)(PAY_RESERVATION), `${this.apiBaseUrl}/api/v1/summits/${this.summitId}/orders/${this.reservation.hash}/checkout`, normalizedEntity, errorHandler // entity
151
+ )(params)(this.dispatch).then(payload => {
152
+ this.dispatch(stopWidgetLoading());
153
+ this.dispatch((0,actions_namespaceObject.createAction)(CLEAR_RESERVATION)({}));
154
+ this.dispatch(changeStep(3));
155
+ return payload;
156
+ }).catch(e => {
157
+ this.dispatch(removeReservedTicket());
158
+ this.dispatch(changeStep(1));
159
+ this.dispatch(stopWidgetLoading());
160
+ return e;
161
+ }); // The payment has succeeded. Display a success message.
176
162
  });
177
163
 
178
164
  this.reservation = reservation;
@@ -500,10 +486,10 @@ const reserveTicket = ({
500
486
  if (!payload.response.amount) {
501
487
  dispatch(payTicketWithProvider(provider));
502
488
  return payload;
503
- } else {
504
- dispatch(changeStep(2));
505
- return payload;
506
489
  }
490
+
491
+ dispatch(changeStep(2));
492
+ return payload;
507
493
  }).catch(e => {
508
494
  dispatch((0,actions_namespaceObject.createAction)(CREATE_RESERVATION_ERROR)(e));
509
495
  dispatch(stopWidgetLoading());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "summit-registration-lite",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Summit Registration Lite",
5
5
  "main": "index.js",
6
6
  "scripts": {