@@ -170,7 +170,9 @@ async function processStep (paymentScheduler) {
170170 */
171171async function setPaymentSchedulerStep ( paymentScheduler ) {
172172 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 ) {
174176 paymentScheduler . step = 5
175177 } else if ( challenge . status === ChallengeStatus . ACTIVE ) {
176178 paymentScheduler . step = 3
@@ -301,6 +303,8 @@ async function withRetry (func, argArr, predictFunc, step) {
301303 try {
302304 // mock code
303305 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 )
304308 if ( step === stepEnum [ 1 ] ) {
305309 return '00000000-0000-0000-0000-000000000000'
306310 } else if ( step === stepEnum [ 4 ] ) {
@@ -316,7 +320,7 @@ async function withRetry (func, argArr, predictFunc, step) {
316320 const now = Date . now ( )
317321 // The following is the case of not retrying:
318322 // 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
320324 // 3. The request execution time exceeds the configured time
321325 // 4. The processing time of the payment record exceeds the configured time
322326 if ( tryCount > MAX_RETRY_COUNT || ! predictFunc ( err ) || now - processStatus . requestStartTime > PER_REQUEST_MAX_TIME || now - processStatus . paymentStartTime > PER_PAYMENT_MAX_TIME ) {
0 commit comments