Skip to content

Commit 64b7779

Browse files
committed
Written test cases for bill, ledger,refund and payoutrecipients
1 parent dc316a3 commit 64b7779

File tree

6 files changed

+363
-10
lines changed

6 files changed

+363
-10
lines changed

src/bitpay_sdk/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,9 @@ def get_bills(self, status: str = None) -> [Bill]:
625625
exe.get_api_code())
626626

627627
try:
628-
bills = Bill(**response_json)
628+
bills = []
629+
for bill_data in response_json:
630+
bills.append(Bill(**bill_data))
629631
except Exception as exe:
630632
raise BillQueryException("failed to deserialize BitPay server response"
631633
" (Bill) : %s" % str(exe))
@@ -702,11 +704,11 @@ def deliver_bill(self, bill_id: str, bill_token: str) -> bool:
702704
exe.get_api_code())
703705

704706
try:
705-
bill = Bill(**response_json)
707+
result = response_json
706708
except Exception as exe:
707709
raise BillDeliveryException("failed to deserialize BitPay server response"
708710
" (Bill) : %s" % str(exe))
709-
return bill
711+
return result
710712

711713
def get_ledger(self, currency: str, start_date: str, end_date: str) -> [Ledger]:
712714
"""

src/bitpay_sdk/exceptions/bill_query_exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class BillQueryException(BillException):
99
BillQueryException
1010
"""
1111
__bitpay_message = "Failed to retrieve bill"
12-
__bitpay_code = "BITPAY-REFUND-GET"
12+
__bitpay_code = "BITPAY-BILL-GET"
1313
__api_code = ""
1414

1515
def __init__(self, message, code=113, api_code="000000"):

src/bitpay_sdk/models/payout/payout_recipients.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ class PayoutRecipients:
66
__recipients = []
77
__token = ""
88

9-
def __init__(self):
10-
pass
9+
def __init__(self, recipients=[]):
10+
self.__recipients = recipients
1111

1212
def get_guid(self):
1313
"""
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class RecipientStatus:
2+
"""
3+
Recipient Status
4+
"""
5+
INVITED = "invited"
6+
UNVERIFIED = "unverified"
7+
VERIFIED = "verified"
8+
ACTIVE = "active"
9+
PAUSED = "paused"
10+
REMOVED = "removed"

src/bitpay_sdk/utils/rest_cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def response_to_json_string(self, response):
150150
# raise BitPayException("Error: HTTP response is null")
151151

152152
response_obj = response.json()
153-
154153
if "status" in response_obj:
155154
if response_obj["status"] == 'error':
156155
raise BitPayException("Error: " + response_obj["error"], response_obj["code"])

0 commit comments

Comments
 (0)