@@ -170,7 +170,9 @@ async function processStep (paymentScheduler) {
170
170
*/
171
171
async function setPaymentSchedulerStep ( paymentScheduler ) {
172
172
const challenge = await getChallenge ( paymentScheduler . challengeId )
173
- if ( challenge . status === ChallengeStatus . COMPLETED ) {
173
+ if ( SWITCH === PaymentProcessingSwitch . OFF ) {
174
+ paymentScheduler . step = 5
175
+ } else if ( challenge . status === ChallengeStatus . COMPLETED ) {
174
176
paymentScheduler . step = 5
175
177
} else if ( challenge . status === ChallengeStatus . ACTIVE ) {
176
178
paymentScheduler . step = 3
@@ -301,6 +303,8 @@ async function withRetry (func, argArr, predictFunc, step) {
301
303
try {
302
304
// mock code
303
305
if ( SWITCH === PaymentProcessingSwitch . OFF ) {
306
+ // without actual API calls by adding delay (for example 1 second for each step), to simulate the act
307
+ sleep ( 1000 )
304
308
if ( step === stepEnum [ 1 ] ) {
305
309
return '00000000-0000-0000-0000-000000000000'
306
310
} else if ( step === stepEnum [ 4 ] ) {
@@ -316,7 +320,7 @@ async function withRetry (func, argArr, predictFunc, step) {
316
320
const now = Date . now ( )
317
321
// The following is the case of not retrying:
318
322
// 1. The number of retries exceeds the configured number
319
- // 2. The thrown error does not meet the retry conditions
323
+ // 2. The thrown error does not match the retry conditions
320
324
// 3. The request execution time exceeds the configured time
321
325
// 4. The processing time of the payment record exceeds the configured time
322
326
if ( tryCount > MAX_RETRY_COUNT || ! predictFunc ( err ) || now - processStatus . requestStartTime > PER_REQUEST_MAX_TIME || now - processStatus . paymentStartTime > PER_PAYMENT_MAX_TIME ) {
0 commit comments