summit-registration-lite 2.0.20 → 2.0.21
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.js +27 -41
- 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$
|
|
140
|
-
billing_address_zip_code: token.postal_code,
|
|
141
|
-
billing_address_city: ((_this$
|
|
142
|
-
billing_address_state: ((_this$
|
|
143
|
-
billing_address_country: ((_this$
|
|
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 (
|
|
149
|
-
|
|
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;
|
|
@@ -498,10 +484,10 @@ const reserveTicket = ({
|
|
|
498
484
|
if (!payload.response.amount) {
|
|
499
485
|
dispatch(payTicketWithProvider(provider));
|
|
500
486
|
return payload;
|
|
501
|
-
} else {
|
|
502
|
-
dispatch(changeStep(2));
|
|
503
|
-
return payload;
|
|
504
487
|
}
|
|
488
|
+
|
|
489
|
+
dispatch(changeStep(2));
|
|
490
|
+
return payload;
|
|
505
491
|
}).catch(e => {
|
|
506
492
|
dispatch((0,actions_namespaceObject.createAction)(CREATE_RESERVATION_ERROR)(e));
|
|
507
493
|
dispatch(stopWidgetLoading());
|