@alipay/ams-checkout 0.0.1710212811-dev.15 → 0.0.1710212811-dev.18
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.
@@ -39,6 +39,7 @@ import { BusManager, BusMessage } from "../bus";
|
|
39
39
|
import { ApplePayActionEnum, PaymentActionEnum } from "../bus/interface";
|
40
40
|
import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
|
41
41
|
import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
42
|
+
import { SecurityBusSubscriber } from "../bus/ability/security";
|
42
43
|
import { TrackerBusSubscriber } from "../bus/ability/tracker";
|
43
44
|
export var getComponentSign = function getComponentSign(params) {
|
44
45
|
var _params$paymentSessio = params.paymentSessionConfig,
|
@@ -110,7 +111,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
110
111
|
function AMSComponent(options) {
|
111
112
|
var _this;
|
112
113
|
_classCallCheck(this, AMSComponent);
|
113
|
-
BusManager.clear();
|
114
114
|
_this = _super.call(this, options);
|
115
115
|
// Instantiate the plug-in and set render
|
116
116
|
_defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
|
@@ -205,9 +205,9 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
205
205
|
key: "registerBusAbility",
|
206
206
|
value: function registerBusAbility() {
|
207
207
|
var _this$originOptions,
|
208
|
-
_this2 = this
|
209
|
-
_this$originOptions2;
|
208
|
+
_this2 = this;
|
210
209
|
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod);
|
210
|
+
BusManager.clear();
|
211
211
|
BusManager.addInterceptor({
|
212
212
|
onPublishException: function onPublishException(message, e) {
|
213
213
|
_this2.logger.logInfo({
|
@@ -218,7 +218,14 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
218
218
|
}
|
219
219
|
});
|
220
220
|
// subscribe basic ablility
|
221
|
-
BusManager.subscribe(new SDKCallbackBusSubscriber((
|
221
|
+
BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) {
|
222
|
+
var _this2$originOptions;
|
223
|
+
(_this2$originOptions = _this2.originOptions) === null || _this2$originOptions === void 0 || _this2$originOptions.onEventCallback(state);
|
224
|
+
}));
|
225
|
+
BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
|
226
|
+
var _this2$_componentApp;
|
227
|
+
return (_this2$_componentApp = _this2._componentApp) === null || _this2$_componentApp === void 0 ? void 0 : _this2$_componentApp.getDeviceIdAndLog(deviceIdParameter, isPolling);
|
228
|
+
}));
|
222
229
|
BusManager.subscribe(new TrackerBusSubscriber(this.logger));
|
223
230
|
// subscribe plugin
|
224
231
|
BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
|
@@ -126,58 +126,81 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
126
126
|
}).send();
|
127
127
|
return;
|
128
128
|
}
|
129
|
+
var getDeviceId = /*#__PURE__*/function () {
|
130
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
131
|
+
var _yield$BusManager$pub, _this$_parseData;
|
132
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
133
|
+
while (1) switch (_context.prev = _context.next) {
|
134
|
+
case 0:
|
135
|
+
_context.next = 2;
|
136
|
+
return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId, JSON.stringify({
|
137
|
+
deviceIdParameter: {
|
138
|
+
productScene: (_this$_parseData = _this._parseData) === null || _this$_parseData === void 0 || (_this$_parseData = _this$_parseData.paymentSessionConfig) === null || _this$_parseData === void 0 ? void 0 : _this$_parseData.productScene
|
139
|
+
}
|
140
|
+
})));
|
141
|
+
case 2:
|
142
|
+
_context.t1 = _yield$BusManager$pub = _context.sent;
|
143
|
+
_context.t0 = _context.t1 === null;
|
144
|
+
if (_context.t0) {
|
145
|
+
_context.next = 6;
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
_context.t0 = _yield$BusManager$pub === void 0;
|
149
|
+
case 6:
|
150
|
+
if (!_context.t0) {
|
151
|
+
_context.next = 10;
|
152
|
+
break;
|
153
|
+
}
|
154
|
+
_context.t2 = void 0;
|
155
|
+
_context.next = 11;
|
156
|
+
break;
|
157
|
+
case 10:
|
158
|
+
_context.t2 = _yield$BusManager$pub.getJSONObject();
|
159
|
+
case 11:
|
160
|
+
return _context.abrupt("return", _context.t2);
|
161
|
+
case 12:
|
162
|
+
case "end":
|
163
|
+
return _context.stop();
|
164
|
+
}
|
165
|
+
}, _callee);
|
166
|
+
}));
|
167
|
+
return function getDeviceId() {
|
168
|
+
return _ref.apply(this, arguments);
|
169
|
+
};
|
170
|
+
}();
|
129
171
|
/**
|
130
172
|
* Get MerchantSession spi
|
131
173
|
* @param event
|
132
174
|
*/
|
133
175
|
var getMerchantSession = /*#__PURE__*/function () {
|
134
|
-
var
|
135
|
-
var _yield$BusManager$pub;
|
176
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
136
177
|
var validationUrl, requestParams;
|
137
|
-
return _regeneratorRuntime().wrap(function
|
138
|
-
while (1) switch (
|
178
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
179
|
+
while (1) switch (_context2.prev = _context2.next) {
|
139
180
|
case 0:
|
140
|
-
validationUrl =
|
181
|
+
validationUrl = _ref2.validationUrl;
|
141
182
|
// get validateUrl
|
142
183
|
requestParams = {
|
143
184
|
validateUrl: validationUrl,
|
144
185
|
paymentSessionData: _this._sessionData
|
145
186
|
}; // get deviceId
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
return
|
187
|
+
_context2.t0 = getApplePayPaymentSession;
|
188
|
+
_context2.t1 = _this._sessionData;
|
189
|
+
_context2.t2 = requestParams;
|
190
|
+
_context2.t3 = _this._options.environment;
|
191
|
+
_context2.next = 8;
|
192
|
+
return getDeviceId();
|
152
193
|
case 8:
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
_context.next = 12;
|
157
|
-
break;
|
158
|
-
}
|
159
|
-
_context.t4 = _yield$BusManager$pub === void 0;
|
160
|
-
case 12:
|
161
|
-
if (!_context.t4) {
|
162
|
-
_context.next = 16;
|
163
|
-
break;
|
164
|
-
}
|
165
|
-
_context.t6 = void 0;
|
166
|
-
_context.next = 17;
|
167
|
-
break;
|
168
|
-
case 16:
|
169
|
-
_context.t6 = _yield$BusManager$pub.getData();
|
170
|
-
case 17:
|
171
|
-
_context.t7 = _context.t6;
|
172
|
-
_context.t8 = {
|
173
|
-
deviceId: _context.t7
|
194
|
+
_context2.t4 = _context2.sent;
|
195
|
+
_context2.t5 = {
|
196
|
+
deviceId: _context2.t4
|
174
197
|
};
|
175
|
-
|
176
|
-
env:
|
177
|
-
envInfo:
|
198
|
+
_context2.t6 = {
|
199
|
+
env: _context2.t3,
|
200
|
+
envInfo: _context2.t5
|
178
201
|
};
|
179
|
-
|
180
|
-
return
|
202
|
+
_context2.t7 = _this.logger;
|
203
|
+
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1, _context2.t2, _context2.t6, _context2.t7).then(function (res) {
|
181
204
|
if (res !== null && res !== void 0 && res.success && res.merchantSessionObject) {
|
182
205
|
return Promise.resolve(res.merchantSessionObject);
|
183
206
|
}
|
@@ -188,14 +211,14 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
188
211
|
}).catch(function (error) {
|
189
212
|
return Promise.reject(error);
|
190
213
|
}));
|
191
|
-
case
|
214
|
+
case 13:
|
192
215
|
case "end":
|
193
|
-
return
|
216
|
+
return _context2.stop();
|
194
217
|
}
|
195
|
-
},
|
218
|
+
}, _callee2);
|
196
219
|
}));
|
197
220
|
return function getMerchantSession(_x) {
|
198
|
-
return
|
221
|
+
return _ref3.apply(this, arguments);
|
199
222
|
};
|
200
223
|
}();
|
201
224
|
|
@@ -204,53 +227,34 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
204
227
|
* @param tokens
|
205
228
|
*/
|
206
229
|
var completePaymentAuthorized = /*#__PURE__*/function () {
|
207
|
-
var
|
208
|
-
var _yield$BusManager$pub2;
|
230
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
209
231
|
var paymentToken, params;
|
210
|
-
return _regeneratorRuntime().wrap(function
|
211
|
-
while (1) switch (
|
232
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
233
|
+
while (1) switch (_context3.prev = _context3.next) {
|
212
234
|
case 0:
|
213
|
-
paymentToken =
|
235
|
+
paymentToken = _ref4.paymentToken;
|
214
236
|
params = {
|
215
237
|
paymentFactors: {
|
216
238
|
instPaymentToken: paymentToken
|
217
239
|
},
|
218
240
|
paymentSessionData: _this._sessionData
|
219
241
|
};
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
return
|
242
|
+
_context3.t0 = submitPayInfo;
|
243
|
+
_context3.t1 = params;
|
244
|
+
_context3.t2 = _this._options.environment;
|
245
|
+
_context3.next = 7;
|
246
|
+
return getDeviceId();
|
225
247
|
case 7:
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
_context2.next = 11;
|
230
|
-
break;
|
231
|
-
}
|
232
|
-
_context2.t3 = _yield$BusManager$pub2 === void 0;
|
233
|
-
case 11:
|
234
|
-
if (!_context2.t3) {
|
235
|
-
_context2.next = 15;
|
236
|
-
break;
|
237
|
-
}
|
238
|
-
_context2.t5 = void 0;
|
239
|
-
_context2.next = 16;
|
240
|
-
break;
|
241
|
-
case 15:
|
242
|
-
_context2.t5 = _yield$BusManager$pub2.getData();
|
243
|
-
case 16:
|
244
|
-
_context2.t6 = _context2.t5;
|
245
|
-
_context2.t7 = {
|
246
|
-
deviceId: _context2.t6
|
248
|
+
_context3.t3 = _context3.sent;
|
249
|
+
_context3.t4 = {
|
250
|
+
deviceId: _context3.t3
|
247
251
|
};
|
248
|
-
|
249
|
-
env:
|
250
|
-
envInfo:
|
252
|
+
_context3.t5 = {
|
253
|
+
env: _context3.t2,
|
254
|
+
envInfo: _context3.t4
|
251
255
|
};
|
252
|
-
|
253
|
-
return
|
256
|
+
_context3.t6 = _this.logger;
|
257
|
+
return _context3.abrupt("return", (0, _context3.t0)(_context3.t1, _context3.t5, _context3.t6).then(function (res) {
|
254
258
|
_this.logger.logInfo({
|
255
259
|
name: 'APPLE_PAY',
|
256
260
|
title: 'submitPayStatus',
|
@@ -268,14 +272,14 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
268
272
|
}).catch(function (error) {
|
269
273
|
return Promise.reject(error);
|
270
274
|
}));
|
271
|
-
case
|
275
|
+
case 12:
|
272
276
|
case "end":
|
273
|
-
return
|
277
|
+
return _context3.stop();
|
274
278
|
}
|
275
|
-
},
|
279
|
+
}, _callee3);
|
276
280
|
}));
|
277
281
|
return function completePaymentAuthorized(_x2) {
|
278
|
-
return
|
282
|
+
return _ref5.apply(this, arguments);
|
279
283
|
};
|
280
284
|
}();
|
281
285
|
var completeApplePay = function completeApplePay(data) {
|