forked from GithubBackups/healthchecks
Show refunded transactions correctly in the billing history.
This commit is contained in:
parent
3c0b9834e9
commit
080e44f7ba
@ -1,5 +1,6 @@
|
||||
from mock import Mock, patch
|
||||
|
||||
from django.utils.timezone import now
|
||||
from hc.payments.models import Subscription
|
||||
from hc.test import BaseTestCase
|
||||
|
||||
@ -15,8 +16,8 @@ class BillingHistoryTestCase(BaseTestCase):
|
||||
@patch("hc.payments.models.braintree")
|
||||
def test_it_works(self, mock_braintree):
|
||||
|
||||
m1 = Mock(id="abc123", amount=123)
|
||||
m2 = Mock(id="def456", amount=456)
|
||||
m1 = Mock(id="abc123", amount=123, created_at=now())
|
||||
m2 = Mock(id="def456", amount=456, created_at=now())
|
||||
mock_braintree.Transaction.search.return_value = [m1, m2]
|
||||
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
|
@ -82,4 +82,7 @@
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.text-muted code {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,13 @@
|
||||
<th>Date</th>
|
||||
<th>Payment Method</th>
|
||||
<th>Amount</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{% for tx in transactions %}
|
||||
<tr>
|
||||
<td>{{ tx.created_at }}</td>
|
||||
<tr {% if tx.type == "credit" %}class="text-muted"{% endif %}>
|
||||
<td title="{{ tx.created_at }}">{{ tx.created_at|date:"N j, Y" }}</td>
|
||||
<td>
|
||||
{% if tx.payment_instrument_type == "paypal_account" %}
|
||||
Paypal from {{ tx.paypal.payer_email }}
|
||||
@ -20,17 +21,19 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if tx.currency_iso_code == "USD" %}
|
||||
${{ tx.amount }}
|
||||
{% elif tx.currency_iso_code == "EUR" %}
|
||||
€{{ tx.amount }}
|
||||
{% if tx.type == "credit" %}
|
||||
-{{ tx.amount }} {{ tx.currency_iso_code }}
|
||||
{% else %}
|
||||
{{ tx.currency_iso_code }} {{ tx.amount }}
|
||||
{{ tx.amount }} {{ tx.currency_iso_code }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ tx.type|capfirst }}</td>
|
||||
<td><code>{{ tx.status }}</code></td>
|
||||
<td>
|
||||
{% if tx.type == "credit" %}
|
||||
{% else %}
|
||||
<a href="{% url 'hc-invoice-pdf' tx.id %}">PDF Invoice</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor%}
|
||||
|
Loading…
x
Reference in New Issue
Block a user