File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ function generateParamCardSubscription() {
483
483
"interval" : 1 ,
484
484
"interval_unit" : "month" ,
485
485
"max_interval" : 12 ,
486
- "start_time" : "2021-11-30 07:25:01 +0700"
486
+ "start_time" : getFormattedTime ( 1000 * 60 * 60 * 24 * 2 ) // current time +2 days
487
487
} ,
488
488
"metadata" : {
489
489
"description" : "Recurring payment for A"
@@ -611,12 +611,24 @@ function generateParamMax(){
611
611
"finish" : "https://demo.midtrans.com"
612
612
} ,
613
613
"expiry" : {
614
- "start_time" : ( ( new Date ) . getFullYear ( ) + 1 ) + "-12-20 18:11:08 +0700" ,
614
+ "start_time" : getFormattedTime ( 1000 * 60 * 60 * 24 ) , // current time +24hrs
615
615
"unit" : "minutes" ,
616
616
"duration" : 1
617
617
} ,
618
618
"custom_field1" : "custom field 1 content" ,
619
619
"custom_field2" : "custom field 2 content" ,
620
620
"custom_field3" : "custom field 3 content"
621
621
}
622
- }
622
+ }
623
+
624
+ function getFormattedTime ( offsetInMilisecond = 0 ) {
625
+ let targetDate = new Date ( Date . now ( ) + offsetInMilisecond ) ;
626
+ // formatted according to API param spec
627
+ let formattedDateString = targetDate
628
+ . toISOString ( )
629
+ . split ( 'T' )
630
+ . join ( ' ' )
631
+ . split ( '.' ) [ 0 ]
632
+ + ' +0000' ;
633
+ return formattedDateString ;
634
+ }
Original file line number Diff line number Diff line change @@ -316,12 +316,24 @@ function generateParamMax(){
316
316
"finish" : "https://demo.midtrans.com"
317
317
} ,
318
318
"expiry" : {
319
- "start_time" : ( ( new Date ) . getFullYear ( ) + 1 ) + "-12-20 18:11:08 +0700" ,
319
+ "start_time" : getFormattedTime ( 1000 * 60 * 60 * 24 ) , // current time +24hrs
320
320
"unit" : "minutes" ,
321
321
"duration" : 1
322
322
} ,
323
323
"custom_field1" : "custom field 1 content" ,
324
324
"custom_field2" : "custom field 2 content" ,
325
325
"custom_field3" : "custom field 3 content"
326
326
}
327
- }
327
+ }
328
+
329
+ function getFormattedTime ( offsetInMilisecond = 0 ) {
330
+ let targetDate = new Date ( Date . now ( ) + offsetInMilisecond ) ;
331
+ // formatted according to API param spec
332
+ let formattedDateString = targetDate
333
+ . toISOString ( )
334
+ . split ( 'T' )
335
+ . join ( ' ' )
336
+ . split ( '.' ) [ 0 ]
337
+ + ' +0000' ;
338
+ return formattedDateString ;
339
+ }
You can’t perform that action at this time.
0 commit comments