@alipay/ams-checkout 0.0.1755253657-dev.2 → 0.0.1755258111-dev.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.
@@ -177,24 +177,19 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
177
177
|
key: "sendRequestAndWaitWebLaunch",
|
178
178
|
value: function sendRequestAndWaitWebLaunch() {
|
179
179
|
var _this = this;
|
180
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch start');
|
181
180
|
var webLaunchPromise = new Promise(function (resolve, reject) {
|
182
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch webLaunchPromise start');
|
183
181
|
var t = setTimeout(function () {
|
184
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch webLaunchPromise timeout');
|
185
182
|
reject(new Error('Load resource timeout'));
|
186
183
|
}, _this.LOAD_APP_RESOURCES_TIMEOUT);
|
187
184
|
_this.eventCenter.listen('onLaunch', function (res) {
|
188
185
|
clearTimeout(t);
|
189
186
|
resolve(res);
|
190
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch webLaunchPromise onLaunch');
|
191
187
|
_this.logger.logInfo({
|
192
188
|
title: 'sdk_event_webAppOnLaunch'
|
193
189
|
});
|
194
190
|
});
|
195
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch completed');
|
196
191
|
});
|
197
|
-
|
192
|
+
|
198
193
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
199
194
|
Promise.all([this.initSecuritySDK(), this.processQuery(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
200
195
|
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext3, _this$paymentContext$4;
|
@@ -203,7 +198,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
203
198
|
queryRes = _ref2[1],
|
204
199
|
submitRes = _ref2[2],
|
205
200
|
_webLaunchRes = _ref2[3];
|
206
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch success', _initSecurityRes, queryRes, submitRes, _webLaunchRes);
|
207
201
|
var logMetaData = _this.logger.getLogConfig().mdata;
|
208
202
|
var data = {
|
209
203
|
sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
|
@@ -236,18 +230,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
236
230
|
if (queryRes) {
|
237
231
|
data.queryResult = queryRes;
|
238
232
|
}
|
239
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch enter.dispatchToApp start', data);
|
240
233
|
_this.eventCenter.dispatchToApp({
|
241
234
|
event: 'renderComponent',
|
242
235
|
data: data
|
243
236
|
});
|
244
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch enter.dispatchToApp completed');
|
245
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch completed');
|
246
237
|
_this.logger.logInfo({
|
247
238
|
title: 'sdk_event_renderComponent'
|
248
239
|
});
|
249
240
|
}).catch(function (error) {
|
250
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch ERROR', error);
|
251
241
|
_this.eventCenter.emit(EVENT.destroy.name, {});
|
252
242
|
_this.eventCenter.emit(EVENT.eventCallback.name, {
|
253
243
|
code: eventCodeEnum.SDK_INTERNAL_ERROR,
|
@@ -266,7 +256,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
266
256
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
267
257
|
while (1) switch (_context2.prev = _context2.next) {
|
268
258
|
case 0:
|
269
|
-
console.log('[DEBUG] processQuery start');
|
270
259
|
queryParams = {
|
271
260
|
paymentSessionData: ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionId) || '',
|
272
261
|
paymentSessionConfig: (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionConfig
|
@@ -276,23 +265,18 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
276
265
|
isFirstTimeToPay = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.autoDebitWithToken);
|
277
266
|
needQueryRender = true;
|
278
267
|
try {
|
279
|
-
console.log('[DEBUG] processQuery JSON.parse(extendInfo) start', extendInfo);
|
280
268
|
extendInfoData = JSON.parse(extendInfo);
|
281
269
|
needQueryRender = isEmpty(extendInfoData.needQueryRender) || extendInfoData.needQueryRender === true;
|
282
|
-
console.log('[DEBUG] processQuery JSON.parse(extendInfo) completed', needQueryRender);
|
283
270
|
} catch (error) {
|
284
|
-
console.log('[DEBUG] processQuery JSON.parse(extendInfo) ERROR', error);
|
285
271
|
console.log(error);
|
286
272
|
}
|
287
273
|
this.allowQueryCall = needQueryRender && isFirstTimeToPay && needAccountConfirmPage;
|
288
|
-
console.log('[DEBUG] processQuery allowQueryCall', this.allowQueryCall);
|
289
274
|
if (this.allowQueryCall) {
|
290
|
-
_context2.next =
|
275
|
+
_context2.next = 9;
|
291
276
|
break;
|
292
277
|
}
|
293
|
-
console.log('[DEBUG] processQuery allowQueryCall NO', this.allowQueryCall);
|
294
278
|
return _context2.abrupt("return", null);
|
295
|
-
case
|
279
|
+
case 9:
|
296
280
|
requestBizId = uuid();
|
297
281
|
this.logger.logInfo({
|
298
282
|
title: 'sdk_event_sdkQuery'
|
@@ -300,11 +284,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
300
284
|
config: JSON.stringify(queryParams.paymentSessionConfig),
|
301
285
|
requestId: requestBizId
|
302
286
|
});
|
303
|
-
console.log('[DEBUG] processQuery ServiceProvider.getInstance start');
|
304
287
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
305
|
-
|
306
|
-
_context2.prev = 17;
|
307
|
-
console.log('[DEBUG] processQuery requester.request<CashierSdkActionQuerySessionResult start');
|
288
|
+
_context2.prev = 12;
|
308
289
|
_context2.t0 = requester;
|
309
290
|
_context2.t1 = _objectSpread(_objectSpread({}, queryParams), {}, {
|
310
291
|
actionType: 'init',
|
@@ -313,9 +294,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
313
294
|
});
|
314
295
|
_context2.t2 = this.initConfig.environment;
|
315
296
|
_context2.t3 = this.SDK_REQUEST_TIMEOUT;
|
316
|
-
_context2.next =
|
297
|
+
_context2.next = 19;
|
317
298
|
return this.acquireApdidToken();
|
318
|
-
case
|
299
|
+
case 19:
|
319
300
|
_context2.t4 = _context2.sent;
|
320
301
|
_context2.t5 = {
|
321
302
|
deviceId: _context2.t4
|
@@ -329,11 +310,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
329
310
|
needEnvInfo: true,
|
330
311
|
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
331
312
|
};
|
332
|
-
_context2.next =
|
313
|
+
_context2.next = 25;
|
333
314
|
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t7);
|
334
|
-
case
|
315
|
+
case 25:
|
335
316
|
res = _context2.sent;
|
336
|
-
console.log('[DEBUG] processQuery requester.request<CashierSdkActionQuerySessionResult completed', res);
|
337
317
|
this.logger.logInfo({
|
338
318
|
title: 'sdk_event_sdkQueryEnd'
|
339
319
|
}, {
|
@@ -341,12 +321,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
341
321
|
requestId: requestBizId,
|
342
322
|
rpcTraceId: res.traceId
|
343
323
|
});
|
344
|
-
console.log('[DEBUG] processQuery completed', res);
|
345
324
|
return _context2.abrupt("return", res);
|
346
|
-
case
|
347
|
-
_context2.prev =
|
348
|
-
_context2.t8 = _context2["catch"](
|
349
|
-
console.log('[DEBUG] processQuery ERROR', _context2.t8);
|
325
|
+
case 30:
|
326
|
+
_context2.prev = 30;
|
327
|
+
_context2.t8 = _context2["catch"](12);
|
350
328
|
this.logger.logError({
|
351
329
|
title: 'sdk_event_sdkQuery_failed'
|
352
330
|
}, {
|
@@ -356,11 +334,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
356
334
|
rpcTraceId: _context2.t8 === null || _context2.t8 === void 0 ? void 0 : _context2.t8.traceId
|
357
335
|
});
|
358
336
|
return _context2.abrupt("return", null);
|
359
|
-
case
|
337
|
+
case 34:
|
360
338
|
case "end":
|
361
339
|
return _context2.stop();
|
362
340
|
}
|
363
|
-
}, _callee2, this, [[
|
341
|
+
}, _callee2, this, [[12, 30]]);
|
364
342
|
}));
|
365
343
|
function processQuery() {
|
366
344
|
return _processQuery.apply(this, arguments);
|
@@ -376,7 +354,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
376
354
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
377
355
|
while (1) switch (_context3.prev = _context3.next) {
|
378
356
|
case 0:
|
379
|
-
console.log('DEBUG] processSubmitPay start');
|
380
357
|
submitParams = {
|
381
358
|
paymentSessionData: ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionId) || '',
|
382
359
|
paymentSessionConfig: (_this$paymentContext10 = this.paymentContext) === null || _this$paymentContext10 === void 0 || (_this$paymentContext10 = _this$paymentContext10.paymentSessionObj) === null || _this$paymentContext10 === void 0 ? void 0 : _this$paymentContext10.paymentSessionConfig
|
@@ -397,22 +374,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
397
374
|
}
|
398
375
|
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
399
376
|
//console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
400
|
-
|
401
|
-
console.log('DEBUG] processSubmitPay allowSubmitPayCallAhead start', this.allowSubmitPayCallAhead);
|
402
377
|
if (this.allowSubmitPayCallAhead) {
|
403
|
-
_context3.next =
|
378
|
+
_context3.next = 7;
|
404
379
|
break;
|
405
380
|
}
|
406
|
-
//console.log('[web-sdk] DO NOT call submitPay');
|
407
|
-
console.log('DEBUG] processSubmitPay allowSubmitPayCallAhead ', {
|
408
|
-
message: 'sdk no need to make submitPay request',
|
409
|
-
success: true
|
410
|
-
});
|
411
381
|
return _context3.abrupt("return", {
|
412
382
|
message: 'sdk no need to make submitPay request',
|
413
383
|
success: true
|
414
384
|
});
|
415
|
-
case
|
385
|
+
case 7:
|
416
386
|
requestBizId = uuid(); // 下面真实发请求
|
417
387
|
this.logger.logInfo({
|
418
388
|
title: 'sdk_event_submitPay'
|
@@ -420,7 +390,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
420
390
|
config: JSON.stringify(submitParams.paymentSessionConfig),
|
421
391
|
requestId: requestBizId
|
422
392
|
});
|
423
|
-
console.log('DEBUG] processSubmitPay channelBehavior?.buildSubmitPayExtParams start');
|
424
393
|
// 由渠道定制点来构建额外参数
|
425
394
|
extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
|
426
395
|
instanceId: this.instanceId,
|
@@ -431,19 +400,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
431
400
|
env: this.initConfig.environment,
|
432
401
|
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion,
|
433
402
|
notRedirectAfterComplete: ((_this$paymentContext12 = this.paymentContext) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.startBizFlowOptions) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.submitPayRequestExtra) === null || _this$paymentContext12 === void 0 ? void 0 : _this$paymentContext12.notRedirectAfterComplete) === true
|
434
|
-
})) || {};
|
435
|
-
console.log('DEBUG] processSubmitPay channelBehavior?.buildSubmitPayExtParams completed', extParams);
|
436
|
-
|
437
|
-
// 二次支付不再需要该参数
|
403
|
+
})) || {}; // 二次支付不再需要该参数
|
438
404
|
if (!autoDebitWithToken) {
|
439
405
|
extParams.complianceSDK = true;
|
440
406
|
}
|
441
407
|
submitParams.extParams = extParams;
|
442
|
-
console.log('DEBUG] processSubmitPay ServiceProvider.getInstance start');
|
443
408
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
444
|
-
|
445
|
-
_context3.prev = 20;
|
446
|
-
console.log('DEBUG] processSubmitPay requester.request<CashierSubmitPayResult start');
|
409
|
+
_context3.prev = 13;
|
447
410
|
_context3.t0 = requester;
|
448
411
|
_context3.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
|
449
412
|
integrationType: 'SDK',
|
@@ -451,9 +414,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
451
414
|
});
|
452
415
|
_context3.t2 = this.initConfig.environment;
|
453
416
|
_context3.t3 = this.SDK_REQUEST_TIMEOUT;
|
454
|
-
_context3.next =
|
417
|
+
_context3.next = 20;
|
455
418
|
return this.acquireApdidToken();
|
456
|
-
case
|
419
|
+
case 20:
|
457
420
|
_context3.t4 = _context3.sent;
|
458
421
|
_context3.t5 = {
|
459
422
|
deviceId: _context3.t4
|
@@ -467,11 +430,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
467
430
|
needEnvInfo: true,
|
468
431
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
469
432
|
};
|
470
|
-
_context3.next =
|
433
|
+
_context3.next = 26;
|
471
434
|
return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t7);
|
472
|
-
case
|
435
|
+
case 26:
|
473
436
|
res = _context3.sent;
|
474
|
-
console.log('DEBUG] processSubmitPay requester.request<CashierSubmitPayResult completed', res);
|
475
437
|
this.logger.logInfo({
|
476
438
|
title: 'sdk_event_submitPayEnd'
|
477
439
|
}, {
|
@@ -479,12 +441,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
479
441
|
requestId: requestBizId,
|
480
442
|
rpcTraceId: res.traceId
|
481
443
|
});
|
482
|
-
console.log('DEBUG] processSubmitPay completed', res);
|
483
444
|
return _context3.abrupt("return", res);
|
484
|
-
case
|
485
|
-
_context3.prev =
|
486
|
-
_context3.t8 = _context3["catch"](
|
487
|
-
console.log('DEBUG] processSubmitPay ERROR', _context3.t8);
|
445
|
+
case 31:
|
446
|
+
_context3.prev = 31;
|
447
|
+
_context3.t8 = _context3["catch"](13);
|
488
448
|
this.logger.logError({
|
489
449
|
title: 'sdk_event_submitPay_failed'
|
490
450
|
}, {
|
@@ -494,11 +454,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
494
454
|
rpcTraceId: _context3.t8 === null || _context3.t8 === void 0 ? void 0 : _context3.t8.traceId
|
495
455
|
});
|
496
456
|
return _context3.abrupt("return", null);
|
497
|
-
case
|
457
|
+
case 35:
|
498
458
|
case "end":
|
499
459
|
return _context3.stop();
|
500
460
|
}
|
501
|
-
}, _callee3, this, [[
|
461
|
+
}, _callee3, this, [[13, 31]]);
|
502
462
|
}));
|
503
463
|
function processSubmitPay() {
|
504
464
|
return _processSubmitPay.apply(this, arguments);
|
@@ -539,15 +499,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
539
499
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
540
500
|
while (1) switch (_context5.prev = _context5.next) {
|
541
501
|
case 0:
|
542
|
-
|
543
|
-
_context5.prev = 1;
|
502
|
+
_context5.prev = 0;
|
544
503
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
545
504
|
nonInitSecuritySDK = (_this$paymentContext$11 = (_this$paymentContext$12 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$12 === void 0 ? void 0 : _this$paymentContext$12.nonInitSecuritySDK) !== null && _this$paymentContext$11 !== void 0 ? _this$paymentContext$11 : false;
|
546
505
|
signButtonDisplay = (_this$paymentContext$13 = (_this$paymentContext$14 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$14 === void 0 ? void 0 : _this$paymentContext$14.signButtonDisplay) !== null && _this$paymentContext$13 !== void 0 ? _this$paymentContext$13 : false;
|
547
506
|
userSignAgreement = (_this$paymentContext$15 = (_this$paymentContext$16 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$16 === void 0 ? void 0 : _this$paymentContext$16.userSignAgreement) !== null && _this$paymentContext$15 !== void 0 ? _this$paymentContext$15 : false;
|
548
507
|
isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
549
508
|
shouldInitSecuritySDK = false;
|
550
|
-
console.log("[DEBUG] initSecuritySDK -- productSceneVersion:".concat(productSceneVersion, " | nonInitSecuritySDK:").concat(nonInitSecuritySDK, " | signButtonDisplay:").concat(signButtonDisplay, " | userSignAgreement:").concat(userSignAgreement, " | isFirstTimeToPay:").concat(isFirstTimeToPay));
|
551
509
|
if (nonInitSecuritySDK) {
|
552
510
|
// 钱包不依赖风控
|
553
511
|
// console.log('[web-sdk][security-sdk] DO NOT init security sdk when nonInitSecuritySDK is true');
|
@@ -569,33 +527,27 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
569
527
|
}
|
570
528
|
}
|
571
529
|
if (!shouldInitSecuritySDK) {
|
572
|
-
_context5.next =
|
530
|
+
_context5.next = 11;
|
573
531
|
break;
|
574
532
|
}
|
575
|
-
|
576
|
-
_context5.next = 14;
|
533
|
+
_context5.next = 11;
|
577
534
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
578
|
-
case
|
579
|
-
console.log("[DEBUG] securityService.initSecurity completed ");
|
580
|
-
case 15:
|
581
|
-
console.log('[DEBUG] initSecuritySDK completed');
|
535
|
+
case 11:
|
582
536
|
this.logger.logInfo({
|
583
537
|
title: 'a3753.b101271.c388193.d514078'
|
584
538
|
}, {
|
585
539
|
riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
|
586
540
|
});
|
587
|
-
_context5.next =
|
541
|
+
_context5.next = 16;
|
588
542
|
break;
|
589
|
-
case
|
590
|
-
_context5.prev =
|
591
|
-
_context5.t0 = _context5["catch"](
|
592
|
-
|
593
|
-
// do nothing when init security failed
|
594
|
-
case 22:
|
543
|
+
case 14:
|
544
|
+
_context5.prev = 14;
|
545
|
+
_context5.t0 = _context5["catch"](0);
|
546
|
+
case 16:
|
595
547
|
case "end":
|
596
548
|
return _context5.stop();
|
597
549
|
}
|
598
|
-
}, _callee5, this, [[
|
550
|
+
}, _callee5, this, [[0, 14]]);
|
599
551
|
}));
|
600
552
|
function initSecuritySDK() {
|
601
553
|
return _initSecuritySDK.apply(this, arguments);
|
@@ -50,7 +50,6 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
50
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
52
52
|
case 0:
|
53
|
-
console.log('[DEBUG] request start', requestData, options);
|
54
53
|
envInfo = this.getEnvInfo(options);
|
55
54
|
_data = [_objectSpread(_objectSpread({}, requestData), {}, {
|
56
55
|
envInfo: envInfo,
|
@@ -60,31 +59,24 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
60
59
|
})];
|
61
60
|
startTime = Date.now();
|
62
61
|
traceId = '';
|
63
|
-
_context.prev =
|
64
|
-
console.log('[DEBUG] createRequestInstance start');
|
62
|
+
_context.prev = 4;
|
65
63
|
myRequest = this.createRequestInstance(options);
|
66
|
-
|
67
|
-
console.log('[DEBUG] myRequest start');
|
68
|
-
_context.next = 12;
|
64
|
+
_context.next = 8;
|
69
65
|
return myRequest({
|
70
66
|
data: _data
|
71
67
|
});
|
72
|
-
case
|
68
|
+
case 8:
|
73
69
|
_yield$myRequest = _context.sent;
|
74
70
|
data = _yield$myRequest.data;
|
75
71
|
headers = _yield$myRequest.headers;
|
76
|
-
console.log('[DEBUG] myRequest completed', data, headers);
|
77
72
|
resData = data || {};
|
78
73
|
traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
|
79
74
|
resData.traceId = traceId || '';
|
80
|
-
console.log('[DEBUG] handleGetWayError start');
|
81
75
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
82
|
-
console.log('[DEBUG] handleGetWayError completed', handleGetWayError);
|
83
76
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
84
|
-
_context.next =
|
77
|
+
_context.next = 20;
|
85
78
|
break;
|
86
79
|
}
|
87
|
-
console.log('[DEBUG] handleGetWayError errorCode', handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode);
|
88
80
|
errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
|
89
81
|
errorCode = handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode;
|
90
82
|
this.reportRequestTimeCost({
|
@@ -97,17 +89,12 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
97
89
|
errorMessage: errorMessage,
|
98
90
|
traceId: traceId
|
99
91
|
});
|
100
|
-
console.log('[DEBUG] handleGetWayError error', {
|
101
|
-
errorMessage: errorMessage,
|
102
|
-
errorCode: errorCode,
|
103
|
-
success: false
|
104
|
-
});
|
105
92
|
throw new Error(JSON.stringify({
|
106
93
|
errorMessage: errorMessage,
|
107
94
|
errorCode: errorCode,
|
108
95
|
success: false
|
109
96
|
}));
|
110
|
-
case
|
97
|
+
case 20:
|
111
98
|
this.reportRequestTimeCost({
|
112
99
|
title: 'a3753.b101271.c388193.d521387',
|
113
100
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
@@ -118,18 +105,16 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
118
105
|
errorMessage: '',
|
119
106
|
traceId: traceId
|
120
107
|
});
|
121
|
-
console.log('[DEBUG] request completed', resData);
|
122
108
|
return _context.abrupt("return", resData);
|
123
|
-
case
|
124
|
-
_context.prev =
|
125
|
-
_context.t0 = _context["catch"](
|
109
|
+
case 24:
|
110
|
+
_context.prev = 24;
|
111
|
+
_context.t0 = _context["catch"](4);
|
126
112
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
127
113
|
success: false,
|
128
114
|
errorCode: errorEnum.SYSTEM,
|
129
115
|
traceId: traceId,
|
130
116
|
errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
131
117
|
});
|
132
|
-
console.log('[DEBUG] request error 1', _error);
|
133
118
|
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
134
119
|
_errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
|
135
120
|
this.reportRequestTimeCost({
|
@@ -141,12 +126,6 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
141
126
|
code: _errorCode,
|
142
127
|
errorMessage: JSON.stringify((_error === null || _error === void 0 ? void 0 : _error.errorMessage) || _context.t0)
|
143
128
|
});
|
144
|
-
console.log('[DEBUG] request error 2', {
|
145
|
-
success: false,
|
146
|
-
errorCode: _errorCode,
|
147
|
-
traceId: traceId,
|
148
|
-
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
149
|
-
});
|
150
129
|
return _context.abrupt("return", Promise.reject({
|
151
130
|
success: false,
|
152
131
|
errorCode: _errorCode,
|
@@ -154,11 +133,11 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
154
133
|
stack: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.stack,
|
155
134
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.errorMessage
|
156
135
|
}));
|
157
|
-
case
|
136
|
+
case 31:
|
158
137
|
case "end":
|
159
138
|
return _context.stop();
|
160
139
|
}
|
161
|
-
}, _callee, this, [[
|
140
|
+
}, _callee, this, [[4, 24]]);
|
162
141
|
}));
|
163
142
|
function request(_x, _x2) {
|
164
143
|
return _request.apply(this, arguments);
|