pik / pypayd

a small daemon for processing bitcoin payments
MIT License
4 stars 4 forks source link

Transaction state API method? #9

Closed ser closed 8 years ago

ser commented 8 years ago

What is the way to check for transaction state?

I was assuming it is https://github.com/pik/pypayd/blob/master/src/api.py#L49 but: 'PaymentHandler' object has no attribute 'CheckPaymentsFor'

ser commented 8 years ago

hi, any help to check the state of transaction?

i was assuming i should do it in that way:

import json
import requests
pypayd_headers = {'content-type': 'application/json'}
pypayd_payload = { "method": "check_order_status", "params": {"order_id": "44sblablablas4"}, "jsonrpc": "2.0", "id": 0,}
print(requests.post("http://192.168.41.103:3080", data=json.dumps(pypayd_payload), headers=pypayd_headers).json())

{'id': 0, 'error': {'code': -32000, 'message': 'Server error', 'data': {'type': 'AttributeError', 'args': 
["'PaymentHandler' object has no attribute 'CheckPaymentsFor'"], 'message': "'PaymentHandler' object has no attribute 'CheckPaymentsFor'"}}, 'jsonrpc': '2.0'}
pik commented 8 years ago

Hi, check_order_status was an old method that I had forgotten to deprecate from the API. Currently the API methods are get_filled_orders (created since), get_unfilled_orders (created since), get_orders ( by receiving_address, order_id) and get_payments. Generically the method currently constructs queries of the WHERE is = : format, so if you need something non-standard you should use method: 'query' with an SQL statement.

I'll update the docs.

ser commented 8 years ago

OK, cheers! Now I do understand. Thanks :)