Skip to content

Commit 38812de

Browse files
committed
Fix is_paid false bug
1 parent 7686f57 commit 38812de

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

paddle/_subscription_payments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def list_subscription_payments(
2727
'plan': plan,
2828
'is_one_off_charge': is_one_off_charge,
2929
} # type: PaddleJsonType
30-
if is_paid and isinstance(is_paid, bool):
30+
if is_paid is not None and isinstance(is_paid, bool):
3131
json['is_paid'] = 1 if is_paid else 0
3232
if _from:
3333
json['from'] = validate_date(_from, '_from')

tests/test_subscription_payments.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ def test_list_subscription_payments_with_from_to(paddle_client): # NOQA: F811
8888
assert payout_date < to
8989

9090

91+
def test_list_subscription_payments_with_is_paid(paddle_client): # NOQA: F811,E501
92+
response = paddle_client.list_subscription_payments(
93+
is_paid=False
94+
)
95+
96+
if not response:
97+
warning = ('No subscription payments returned by '
98+
'list_subscription_payments in test_list_subscription_payments_with_is_paid') # NOQA: E501
99+
warnings.warn(warning, BadPaddleDataWarning)
100+
skip_message = ('list_subscription_payments did not return any subscription payments') # NOQA: E501
101+
pytest.skip(skip_message)
102+
103+
for payment in response:
104+
assert payment['is_paid'] == 0
105+
106+
91107
# ToDo: Fix this
92108
@pytest.mark.xfail(raises=PaddleException, reason='Date issue, unsure why')
93109
def test_reschedule_subscription_payment(paddle_client): # NOQA: F811

0 commit comments

Comments
 (0)