|
@@ -0,0 +1,35 @@
|
|
|
|
|
+import sys
|
|
|
|
|
+
|
|
|
|
|
+import httpx
|
|
|
|
|
+
|
|
|
|
|
+from config import config
|
|
|
|
|
+
|
|
|
|
|
+def main() -> None:
|
|
|
|
|
+ (username,) = sys.argv[1:]
|
|
|
|
|
+ params = {'username': username, 'status': 'TERMINATED', 'limit': 200, 'page': 1}
|
|
|
|
|
+ while True:
|
|
|
|
|
+ (data,) = httpx.get(f'https://api.punoted.net/v1/contracts/?username={username}&limit=200', params=params,
|
|
|
|
|
+ headers={'X-Data-Token': config.punoted_api_key}).raise_for_status().json()
|
|
|
|
|
+ data['Contracts'].sort(key=lambda c: c['DateEpochMs'])
|
|
|
|
|
+ for contract in data['Contracts']:
|
|
|
|
|
+ conditions = contract['Conditions']
|
|
|
|
|
+ if len(conditions) != 2:
|
|
|
|
|
+ continue
|
|
|
|
|
+ payment = None
|
|
|
|
|
+ if conditions[0]['Type'] == 'PAYMENT' and conditions[1]['Type'] == 'DELIVERY':
|
|
|
|
|
+ payment, delivery = conditions
|
|
|
|
|
+ if payment['Amount'] < 100000 or payment['Amount'] > 1000000 or delivery['Address'] != 'JY-313f (JY-313)':
|
|
|
|
|
+ continue
|
|
|
|
|
+ elif conditions[0]['Type'] == 'LOAN_PAYOUT' and conditions[1]['Type'] == 'LOAN_INSTALLMENT':
|
|
|
|
|
+ payment, installment = conditions
|
|
|
|
|
+ if payment['Amount'] < 100000 or payment['Amount'] > 1000000:
|
|
|
|
|
+ continue
|
|
|
|
|
+ if payment is not None and payment['Status'] == 'FULFILLED':
|
|
|
|
|
+ print(f'{payment["Amount"]:9,} {payment["Currency"]}', contract['Status'], contract['Timestamp'],
|
|
|
|
|
+ contract['PartnerCode'], contract['PartnerName'])
|
|
|
|
|
+ if len(data['Contracts']) < 200:
|
|
|
|
|
+ break
|
|
|
|
|
+ params['page'] += 1
|
|
|
|
|
+
|
|
|
|
|
+if __name__ == '__main__':
|
|
|
|
|
+ main()
|