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