-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathobp_vMar2017.py
765 lines (700 loc) · 26.6 KB
/
obp_vMar2017.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
import json
import uuid
data = dict()
#
# use functions provided below as model for connecting to real data sources
#
def getFuncName(data):
jdata = json.loads(data)
if 'action' in jdata:
return json.loads(data)['action'].split('.')[1].replace('.', '') + json.loads(data)['action'].split('.')[2]
def getArguments(data):
r = dict()
args = json.loads(data)
for item in args.items():
k = item[0]
v = item[1]
if (k != "action"):
r.update({k: v})
return r
# getUser returns single user data
# accepts strings email and password as arguments
# returns string
#
# eg: http://127.0.0.1:8080/my/#s/direct
# getUserId --> AuthUser.getResourceUserId -->kafkaUser <- getUserFromConnector -->getUser
# this one is special, it is used for external user. if it is not exsting in OBP locally, this method will call.
def getUser(args):
global data
users = data['users']
# get arguments
username = args['username']
password = args['password']
if not username:
# return error if empty
return json.dumps({'error': 'no argument given'})
for u in users:
if username == u['email'] and password == u['password']:
# format result
s = {'errorCode': 'OBPS-001: ....',
'email': u['email'],
'displayName': u['displayName']}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'user',
'data': [s]}
# create json
j = json.dumps(r)
# return json result
return j
# return empty if not found
return json.dumps({'': ''})
# getBank returns single bank data
# accepts string bankId as argument
# returns string
#
def getBank(args):
global data
banks = data['banks']
# get argument
bankId = args['bankId']
if not bankId:
# return error if empty
return json.dumps({'error': 'no argument given'})
for b in banks:
if bankId == b['id']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'bankId': b['id'],
'name': b['fullName'],
'logo': b['logo'],
'url': b['website']}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'bank',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getBanks returns list of all banks
# accepts no arguments
# returns string
#
def getBanks(args):
global data
banks = data['banks']
l = []
for b in banks:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'bankId': b['id'],
'name': b['fullName'],
'logo': b['logo'],
'url': b['website']}
l.append(s)
r = {'count': '',
'pager': '',
'state': '',
'target': 'banks',
'data': l}
# create json
j = json.dumps(r)
# return result
return j
# getChallengeThreshold returns maximal amount of money
# that can be transfered without the challenge
# accepts arguments: bankId, accountId, viewId, transactionRequestType, currency, userId, userName
# returns string
#
def getChallengeThreshold(args):
transactionRequestType = args['transactionRequestType']
accountId = args['accountId']
currency = args['currency']
userId = args['userId']
username = args['username']
s = {'errorCode': 'OBPS-001: ....',
'limit': '1000',
'currency': 'EUR'}
r = {'count': '',
'pager': '',
'state': '',
'target': 'challengeThreshold',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# getChargeLevel returns charge level
# accepts arguments: bankId, accountId, viewId, transactionRequestType, currency, userId, userName
# returns string
#
def getChargeLevel(args):
transactionRequestType = args['transactionRequestType']
accountId = args['accountId']
currency = args['currency']
userId = args['userId']
username = args['username']
s = {'errorCode': 'OBPS-001: ....',
'amount': '0.001',
'currency': 'EUR'}
r = {'count': '',
'pager': '',
'state': '',
'target': 'chargeLevel',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# createChallenge returns id of challenge
# accepts arguments: transactionRequestType, userId, transactionRequestId, bankId, accountId
# returns string
#
def createChallenge(args):
transactionRequestType = args['transactionRequestType']
userId = args['userId']
username = args['username']
transactionRequestId = args['transactionRequestId']
bankId = args['bankId']
accountId = args['accountId']
s = {'errorCode': 'OBPS-001: ....',
'challengeId': str(uuid.uuid4())}
r = {'count': '',
'pager': '',
'state': '',
'target': 'challengeThreshold',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# validateChallengeAnswer returns is it challenge satisfied
# accepts arguments: challengeId, hashOfSuppliedAnswer
# returns string
#
def validateChallengeAnswer(args):
challengeId = args['challengeId']
hashOfSuppliedAnswer = args['hashOfSuppliedAnswer']
try:
changToInt = int(hashOfSuppliedAnswer)
except:
return json.dumps({'error': 'Need a numeric TAN'})
if changToInt <= 0:
return json.dumps({'error': 'Need a positive TAN'})
else:
answer = "true"
s = {'errorCode': 'OBPS-001: ....',
'answer': answer}
r = {'count': '',
'pager': '',
'state': '',
'target': 'challengeThreshold',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# getTransaction returns transaction data
# accepts arguments: bankId, accountId, and transactionId
# returns string
#
def getTransaction(args):
global data
transactions = data['transactions']
# get arguments
bankId = args['bankId']
accountId = args['accountId']
transactionId = args['transactionId']
for t in transactions:
# these transactions are imported when create sandbox, the older ones.
if 'thisAccount' in t:
if bankId == t['thisAccount']['bank'] and accountId == t['thisAccount']['id'] and transactionId == t['id']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'transactionId': t['id'],
'accountId': t['thisAccount']['id'],
'amount': t['details']['value'],
'bankId': t['thisAccount']['bank'],
'completedDate': t['details']['completed'],
'counterpartyId': '2330135d-fca8-4268-838d-833074985209',
'counterpartyName': 'counterpartyName',
'currency': 'EUR',
'description': t['details']['description'],
'newBalanceAmount': t['details']['newBalance'],
'newBalanceCurrency': 'EUR',
'postedDate': t['details']['posted'],
'type': t['details']['type'],
'userId': ''
}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'transaction',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# this is for new transactions, when create transaction, there will be create new records.
elif 'fromAccountBankId' in t:
if bankId == t['fromAccountBankId']and accountId == t['fromAccountId'] and transactionId == t['transactionId']:
s = {'errorCode': 'OBPS-001: ....',
'transactionId': t['transactionId'],
'accountId': t['fromAccountId'],
'amount': t['transactionAmount'],
'bankId': t['fromAccountBankId'],
'completedDate': t['transactionPostedDate'],
'counterpartyId': t['toCounterpartyId'],
'counterpartyName':t['toCounterpartyName'],
'currency': t['transactionCurrency'],
'description': t['transactionDescription'],
'newBalanceAmount': '0.0',
'newBalanceCurrency': 'EUR',
'postedDate': t['transactionPostedDate'],
'type': t['type'],
'userId': t['userId']
}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'transaction',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getTransactions returns list of transactions depending on queryParams
# accepts arguments: bankId, accountId, and queryParams
# returns string
#
def getTransactions(args):
global data
transactions = data['transactions']
# get arguments
bankId = args['bankId']
accountId = args['accountId']
# queryParams = args['queryParams']
l = []
for t in transactions:
# these transactions are imported when create sandbox, the older ones.
if 'thisAccount' in t:
if bankId == t['thisAccount']['bank'] and accountId == t['thisAccount']['id']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'transactionId': t['id'],
'accountId': t['thisAccount']['id'],
'amount': t['details']['value'],
'bankId': t['thisAccount']['bank'],
'completedDate': t['details']['completed'],
'counterpartyId': '2330135d-fca8-4268-838d-833074985209',
'counterpartyName': 'counterpartyName',
'currency': 'EUR',
'description': t['details']['description'],
'newBalanceAmount': t['details']['newBalance'],
'newBalanceCurrency': 'EUR',
'postedDate': t['details']['posted'],
'type': t['details']['type'],
'userId': ''
}
l.append(s)
# this is for new transactions, when create transaction, there will be create new records.
elif 'fromAccountBankId' in t:
if bankId == t['fromAccountBankId']and accountId == t['fromAccountId']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'transactionId': t['transactionId'],
'accountId': t['fromAccountId'],
'amount': t['transactionAmount'],
'bankId': t['fromAccountBankId'],
'completedDate': t['transactionPostedDate'],
'counterpartyId': t['toCounterpartyId'],
'counterpartyName':t['toCounterpartyName'],
'currency': t['transactionCurrency'],
'description': t['transactionDescription'],
'newBalanceAmount': '0.0',
'newBalanceCurrency': 'EUR',
'postedDate': t['transactionPostedDate'],
'type': t['type'],
'userId': t['userId']
}
l.append(s)
r = {'count': '',
'pager': '',
'state': '',
'target': 'transactions',
'data': l}
# create json
j = json.dumps(r)
# return result
return j
# Saves a transaction with amount @amt and counterparty @counterparty for account @account.
# Returns the id of the saved transaction.
def putTransaction(args):
global data
transactions = data['transactions']
# assemble the persistent data
transactionIdNew = str(uuid.uuid4())
tranactionNew = {
"userId": args['userId'],
"username": args['username'],
#fromAccount
"fromAccountName": args['fromAccountName'],
"fromAccountId": args['fromAccountId'],
"fromAccountBankId": args['fromAccountBankId'],
#transaction details
"transactionId": args['transactionId'],
"transactionRequestType": args['transactionRequestType'],
"transactionAmount": args['transactionAmount'],
"transactionCurrency": args['transactionCurrency'],
"transactionChargePolicy": args['transactionChargePolicy'],
"transactionChargeAmount": args['transactionChargeAmount'],
"transactionChargeCurrency": args['transactionChargeCurrency'],
"transactionDescription": args['transactionDescription'],
"transactionPostedDate": args['transactionPostedDate'],
#toAccount or toCounterparty
"toCounterpartyId": args['toCounterpartyId'],
"toCounterpartyName": args['toCounterpartyName'],
"toCounterpartyCurrency": args['toCounterpartyCurrency'],
"toCounterpartyRoutingAddress": args['toCounterpartyRoutingAddress'],
"toCounterpartyRoutingScheme": args['toCounterpartyRoutingScheme'],
"toCounterpartyBankRoutingAddress": args['toCounterpartyBankRoutingAddress'],
"toCounterpartyBankRoutingScheme": args['toCounterpartyBankRoutingScheme'],
'type': 'AC'
}
# append new element to the transactions attribute
transactions.append(tranactionNew)
# write the Json to lcal JSON file "example_import_mar2017.json"
with open('example_import_mar2017.json', 'w') as f:
json.dump(data, f)
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'transactionId': args['transactionId']}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'transaction',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# getBankAccount returns bank account data
# accepts arguments: bankId and accountId
# returns string
#
def getAccount(args):
global data
accounts = data['accounts']
# get arguments
bankId = ''
if 'bankId' in args:
bankId = args['bankId']
number = ''
if 'number' in args:
number = args['number']
accountId = ''
if 'accountId' in args:
accountId = args['accountId']
if not bankId and not accountId and not number:
# return error if empty
return json.dumps({'error': 'no argument given'})
for a in accounts:
if (bankId == a['bank'] and accountId == a['id']) or \
(bankId == a['bank'] and number == a['number']) or \
(not bankId and accountId == a['id']) or \
(not bankId and number == a['number']):
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'accountId': a['id'],
'bankId': a['bank'],
'label': a['label'],
'number': a['number'],
'type': a['type'],
'balanceAmount': a['balance']['amount'],
'balanceCurrency': a['balance']['currency'],
'iban': a['IBAN'],
'owners': a['owners'],
'generatePublicView': a['generatePublicView'],
'generateAccountantsView': a['generateAccountantsView'],
'generateAuditorsView': a['generateAuditorsView'],
'accountRoutingScheme': a['accountRoutingScheme'],
'accountRoutingAddress': a['accountRoutingAddress'],
'branchId': a['branchId']
}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'account',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getAccounts returns all accounts owned by user
# accepts arguments: userId
# returns string
#
def getAccounts(args):
global data
accounts = data['accounts']
# get arguments
if 'bankId' in args:
bankId = args['bankId']
if 'userId' in args:
userId = args['userId']
if 'username' in args:
username = args['username']
else:
username = ""
if not userId or not username or not bankId:
return json.dumps({'error': 'no argument given'})
l = []
for a in accounts:
if ((userId in a['owners'] or username in a['owners']) and bankId == a['bank']):
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'accountId': a['id'],
'bankId': a['bank'],
'label': a['label'],
'number': a['number'],
'type': a['type'],
'balanceAmount': a['balance']['amount'],
'balanceCurrency': a['balance']['currency'],
'iban': a['IBAN'],
'owners': a['owners'],
'generatePublicView': a['generatePublicView'],
'generateAccountantsView': a['generateAccountantsView'],
'generateAuditorsView': a['generateAuditorsView'],
'accountRoutingScheme': a['accountRoutingScheme'],
'accountRoutingAddress': a['accountRoutingAddress'],
'branchId': a['branchId']
}
l.append(s)
r = {'count': '',
'pager': '',
'state': '',
'target': 'accounts',
'data': l}
# create json
j = json.dumps(r)
# return result
return j
# return the latest single FXRate data specified by the fields: fromCurrencyCode and toCurrencyCode.
# If it is not found by (fromCurrencyCode, toCurrencyCode) order, it will try (toCurrencyCode, fromCurrencyCode) order.
# accepts string fromCurrencyCode and toCurrencyCode as arguments
# returns string
#
def getCurrentFxRate(args):
global data
fxRates = data['fxRates']
# get argument
fromCurrencyCode = args['fromCurrencyCode']
toCurrencyCode = args['toCurrencyCode']
if not fromCurrencyCode:
# return error if empty
return json.dumps({'error': 'no argument given'})
if not toCurrencyCode:
# return error if empty
return json.dumps({'error': 'no argument given'})
for f in fxRates:
# find FXRate by (fromCurrencyCode, toCurrencyCode), the normal order
if fromCurrencyCode == f['fromCurrencyCode'] and toCurrencyCode == f['toCurrencyCode']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'fromCurrencyCode': f['fromCurrencyCode'],
'toCurrencyCode': f['toCurrencyCode'],
'conversionValue': f['conversionValue'],
'inverseConversionValue': f['inverseConversionValue'],
'effectiveDate': f['effectiveDate']}
# create array for single result
r = {'count': '',
'pager': '',
'state': '',
'target': 'fx',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# find FXRate by (toCurrencyCode, fromCurrencyCode), the reverse order
elif toCurrencyCode == f['fromCurrencyCode'] and fromCurrencyCode == f['toCurrencyCode']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'fromCurrencyCode': f['toCurrencyCode'],
'toCurrencyCode': f['fromCurrencyCode'],
'conversionValue': f['conversionValue'],
'inverseConversionValue': f['inverseConversionValue'],
'effectiveDate': f['effectiveDate']}
# create array for single result
r = {'count': 1,
'pager': '',
'state': '',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getCounterpartyByCounterpartyId returns single Counterparty data
# accepts string counterpartyId as argument
# returns string
#
def getCounterpartyByCounterpartyId(args):
global data
counterparties = data['counterparties']
# get argument
counterpartyId = args['counterpartyId']
if not counterpartyId:
# return error if empty
return json.dumps({'error': 'no argument given'})
for c in counterparties:
if counterpartyId == c['counterpartyId']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'name': c['name'],
'createdByUserId': c['createdByUserId'],
'thisBankId': c['thisBankId'],
'thisAccountId': c['thisAccountId'],
'thisViewId': c['thisViewId'],
'counterpartyId': c['counterpartyId'],
'otherBankRoutingScheme': c['otherBankRoutingScheme'],
'otherBankRoutingAddress': c['otherBankRoutingAddress'],
'otherAccountRoutingScheme': c['otherAccountRoutingScheme'],
'otherAccountRoutingAddress': c['otherAccountRoutingAddress'],
'otherBranchRoutingScheme': c['otherBranchRoutingScheme'],
'otherBranchRoutingAddress': c['otherBranchRoutingAddress'],
'isBeneficiary': c['isBeneficiary']}
# create array for single result
r = {'count': 1,
'pager': '',
'state': '',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getCounterpartyByIban returns single Counterparty data
# accepts string Iban(otherAccountRoutingAddress) as argument
# (This is a helper method that assumes OtherAccountRoutingScheme=IBAN)
# returns string
#
def getCounterpartyByIban(args):
global data
counterparties = data['counterparties']
# get argument
otherAccountRoutingAddress = args['otherAccountRoutingAddress']
otherAccountRoutingScheme = args['otherAccountRoutingScheme']
if not otherAccountRoutingAddress or not otherAccountRoutingScheme:
# return error if empty
return json.dumps({'error': 'no argument given'})
for c in counterparties:
if otherAccountRoutingAddress == c['otherAccountRoutingAddress'] and \
otherAccountRoutingScheme == c['otherAccountRoutingScheme']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'name': c['name'],
'createdByUserId': c['createdByUserId'],
'thisBankId': c['thisBankId'],
'thisAccountId': c['thisAccountId'],
'thisViewId': c['thisViewId'],
'counterpartyId': c['counterpartyId'],
'otherBankRoutingScheme': c['otherBankRoutingScheme'],
'otherBankRoutingAddress': c['otherBankRoutingAddress'],
'otherAccountRoutingScheme': c['otherAccountRoutingScheme'],
'otherAccountRoutingAddress': c['otherAccountRoutingAddress'],
'otherBranchRoutingScheme': c['otherBranchRoutingScheme'],
'otherBranchRoutingAddress': c['otherBranchRoutingAddress'],
'isBeneficiary': c['isBeneficiary']}
# create array for single result
r = {'count': 1,
'pager': '',
'state': '',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getTransactionRequestTypeCharge returns single Charge data
# accepts arguments: bankId, accountId, viewId and transactionRequestType
# returns string
#
def getTransactionRequestTypeCharge(args):
global data
transactionRequestTypes = data['transactionRequestTypes']
# get argument
# It just for test reponse, no authenticate or exsiting check here
bankId = args['bankId']
accountId = args['accountId']
viewId = args['viewId']
transactionRequestType = args['transactionRequestType']
if not transactionRequestType:
# return error if empty
return json.dumps({'error': 'no argument given'})
for t in transactionRequestTypes:
if transactionRequestType == t['transactionRequestType']:
# assemble the return string
s = {'errorCode': 'OBPS-001: ....',
'transactionRequestType': t['transactionRequestType'],
'bankId': t['bankId'],
'chargeCurrency': t['chargeCurrency'],
'chargeAmount': t['chargeAmount'],
'chargeSummary': t['chargeSummary']}
# create array for single result
r = {'count': 1,
'pager': '',
'state': '',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j
# return empty if not found
return json.dumps({'': ''})
# getTransactionRequestStatusesImpl
# accepts arguments: None
# returns string:
def getTransactionRequestStatusesImpl(args):
transactionRequestId = "1234567"
s = {'errorCode': 'OBPS-001: ....',
"transactionRequestId": transactionRequestId,
"bulkTransactionsStatus": [
{
"transactionId": "1",
"transactionStatus": "2",
"transactionTimestamp": "3"
},
{
"transactionId": "1",
"transactionStatus": "2",
"transactionTimestamp": "3"
}
]
}
r = {'count': 1,
'pager': '',
'state': '',
'data': [s]}
# create json
j = json.dumps(r)
# return result
return j