diff --git a/bfxapi/examples/rest/merchant.py b/bfxapi/examples/rest/merchant.py new file mode 100644 index 0000000..91521fa --- /dev/null +++ b/bfxapi/examples/rest/merchant.py @@ -0,0 +1,33 @@ +import os +import sys +import asyncio +sys.path.append('../../../') +from bfxapi import Client + +API_KEY=os.getenv("BFX_KEY") +API_SECRET=os.getenv("BFX_SECRET") + +bfx = Client( + API_KEY=API_KEY, + API_SECRET=API_SECRET, + logLevel='DEBUG' +) + +async def run(): + await bfx.rest.submit_invoice(amount='2.0', currency='USD', pay_currencies=['BTC', 'ETH'], order_id='order123', webhook='https://example.com/api/v3/order/order123', + redirect_url='https://example.com/api/v3/order/order123', customer_info_nationality='DE', + customer_info_resid_country='GB', customer_info_resid_city='London', customer_info_resid_zip_code='WC2H 7NA', + customer_info_resid_street='5-6 Leicester Square', customer_info_resid_building_no='23 A', + customer_info_full_name='John Doe', customer_info_email='john@example.com', duration=86339) + + invoices = await bfx.rest.get_invoices() + print(invoices) + + # await bfx.rest.complete_invoice(id=invoices[0]['id'], pay_ccy='BTC', deposit_id=1357996) + + unlinked_deposits = await bfx.rest.get_unlinked_deposits(ccy='BTC') + print(unlinked_deposits) + + +t = asyncio.ensure_future(run()) +asyncio.get_event_loop().run_until_complete(t) diff --git a/bfxapi/rest/bfx_rest.py b/bfxapi/rest/bfx_rest.py index 430d72d..a2a104e 100644 --- a/bfxapi/rest/bfx_rest.py +++ b/bfxapi/rest/bfx_rest.py @@ -1139,7 +1139,7 @@ class BfxRest: @param customer_info_resid_building_no str: Optional, customer's residential building number/name @param duration int: Optional, invoice expire time in seconds, minimal duration is 5 mins (300) and maximal duration is 24 hours (86400). Default value is 15 minutes """ - endpoint = '/auth/w/ext/pay/invoice/create' + endpoint = 'auth/w/ext/pay/invoice/create' payload = { 'amount': amount, 'currency': currency, @@ -1177,7 +1177,7 @@ class BfxRest: @param end int: Millisecond end time @param limit int: Millisecond start time """ - endpoint = '/auth/w/ext/pay/invoices' + endpoint = 'auth/r/ext/pay/invoices' payload = {} if id: @@ -1204,7 +1204,7 @@ class BfxRest: @param deposit_id int: Movement/Deposit Id linked to invoice as payment @param ledger_id int: Ledger entry Id linked to invoice as payment, use either depositId or ledgerId """ - endpoint = '/auth/w/ext/pay/invoice/complete' + endpoint = 'auth/w/ext/pay/invoice/complete' payload = { 'id': id, 'payCcy': pay_ccy @@ -1227,7 +1227,7 @@ class BfxRest: @param start int: Millisecond start time @param end int: Millisecond end time """ - endpoint = '/auth/w/ext/pay/deposits/unlinked' + endpoint = 'auth/r/ext/pay/deposits/unlinked' payload = { 'ccy': ccy }