Skip to content

Commit

Permalink
Add refund_to_payer to Refund
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Nov 18, 2018
1 parent 8689c33 commit f8fad46
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Fixed
- Fix missing field "refund_to_payer" in Refund model

## [0.10.0] - 2018-11-18
### Added
Expand Down
19 changes: 19 additions & 0 deletions djpaypal/migrations/0008_refund_refund_to_payer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.1.2 on 2018-11-18 22:14

from django.db import migrations
import djpaypal.fields


class Migration(migrations.Migration):

dependencies = [
('djpaypal', '0007_sale_invoice_number'),
]

operations = [
migrations.AddField(
model_name='refund',
name='refund_to_payer',
field=djpaypal.fields.CurrencyAmountField(editable=False, null=True),
),
]
1 change: 1 addition & 0 deletions djpaypal/models/payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Refund(PaypalObject):
max_length=31, choices=enums.RefundReasonCode.choices, editable=False,
help_text="The PayPal-assigned reason codes for the refund."
)
refund_to_payer = CurrencyAmountField(null=True, editable=False)
refund_funding_type = models.CharField(
max_length=6, choices=enums.RefundFundingType.choices, editable=False,
help_text=(
Expand Down
22 changes: 20 additions & 2 deletions tests/fixtures/webhooks/payment.sale.refunded.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@
"create_time": "2014-10-31T15:42:24Z",
"resource_type": "sale",
"event_type": "PAYMENT.SALE.REFUNDED",
"summary": "A 0.01 USD sale payment was refunded",
"summary": "A 0.02 USD sale payment was refunded",
"resource": {
"amount": {
"total": "-0.01",
"total": "0.02",
"currency": "USD"
},
"id": "6YX43824R4443062K",
"parent_payment": "PAY-5437236047802405NKRJ22UA",
"update_time": "2014-10-31T15:41:51Z",
"state": "completed",
"create_time": "2014-10-31T15:41:51Z",
"invoice_number": "",
"refund_from_received_amount": {
"total": "0.01",
"currency": "USD"
},
"refund_from_transaction_fee": {
"total": "0.01",
"currency": "USD"
},
"refund_reason_code": "REFUND",
"refund_to_payer": {
"total": "0.02",
"currency": "USD"
},
"total_refunded_amount": {
"total": "0.02",
"currency": "USD"
},
"links": [
{
"href": "https://api.paypal.com/v1/payments/refund/6YX43824R4443062K",
Expand Down

0 comments on commit f8fad46

Please sign in to comment.