Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ Payment account transactions

.. code:: python

# Get a single payment account transaction
client.payment_account_transactions.get('BA123', params={...})

# List payment account transactions
client.payment_account_transactions.list('BA123', params={...})

Expand Down
4 changes: 4 additions & 0 deletions gocardless_pro/resources/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def payer_authorisation(self):
def payment(self):
return self.attributes.get('payment')

@property
def payment_account_transaction(self):
return self.attributes.get('payment_account_transaction')

@property
def payment_request_payment(self):
return self.attributes.get('payment_request_payment')
Expand Down
4 changes: 4 additions & 0 deletions gocardless_pro/resources/outbound_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ def creditor(self):
def customer(self):
return self.attributes.get('customer')

@property
def outbound_payment_import(self):
return self.attributes.get('outbound_payment_import')

@property
def recipient_bank_account(self):
return self.attributes.get('recipient_bank_account')
Expand Down
23 changes: 23 additions & 0 deletions gocardless_pro/services/payment_account_transactions_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ class PaymentAccountTransactionsService(base_service.BaseService):
RESOURCE_NAME = 'payment_account_transactions'


def get(self,identity,params=None, headers=None):
"""Get a single payment account transaction.

Retrieves the details of an existing payment account transaction.

Args:
identity (string): The unique ID of the [bank account](#core-endpoints-creditor-bank-accounts) which happens to be the payment account.
params (dict, optional): Query string parameters.

Returns:
PaymentAccountTransaction
"""
path = self._sub_url_params('/payment_account_transactions/:identity', {

'identity': identity,
})


response = self._perform_request('GET', path, params, headers,
retry_failures=True)
return self._resource_for(response)


def list(self,identity,params=None, headers=None):
"""List payment account transactions.

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/events.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions tests/fixtures/outbound_payments.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,43 @@
"method": "POST",
"path_template": "/outbound_payments",
"url_params": [],
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
},
"withdraw": {
"method": "POST",
"path_template": "/outbound_payments/withdrawal",
"url_params": [],
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
},
"cancel": {
"method": "POST",
"path_template": "/outbound_payments/:identity/actions/cancel",
"url_params": ["OUT123"],
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
},
"approve": {
"method": "POST",
"path_template": "/outbound_payments/:identity/actions/approve",
"url_params": ["OUT123"],
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
},
"get": {
"method": "GET",
"path_template": "/outbound_payments/:identity",
"url_params": ["OUT123"],
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
},
"list": {
"method": "GET",
"path_template": "/outbound_payments",
"url_params": [],
"body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"outbound_payments":[{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}},{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}]}
"body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"outbound_payments":[{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}},{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}]}
},
"update": {
"method": "PUT",
"path_template": "/outbound_payments/:identity",
"url_params": ["OUT123"],
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
"body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}}
},
"stats": {
"method": "GET",
Expand Down
8 changes: 7 additions & 1 deletion tests/fixtures/payment_account_transactions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{


"get": {
"method": "GET",
"path_template": "/payment_account_transactions/:identity",
"url_params": ["BA123"],
"body": {"payment_account_transactions":{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 101","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"}}
},
"list": {
"method": "GET",
"path_template": "/payment_accounts/:identity/transactions",
"url_params": ["BA123"],
"body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"payment_account_transactions":[{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 101","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"},{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 102","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"}]}
"body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"payment_account_transactions":[{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 102","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"},{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 103","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"}]}
}
}
1 change: 1 addition & 0 deletions tests/integration/events_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def test_events_get():
assert response.links.parent_event == body.get('links')['parent_event']
assert response.links.payer_authorisation == body.get('links')['payer_authorisation']
assert response.links.payment == body.get('links')['payment']
assert response.links.payment_account_transaction == body.get('links')['payment_account_transaction']
assert response.links.payment_request_payment == body.get('links')['payment_request_payment']
assert response.links.payout == body.get('links')['payout']
assert response.links.previous_customer_bank_account == body.get('links')['previous_customer_bank_account']
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/outbound_payments_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_outbound_payments_create():
assert response.status == body.get('status')
assert response.links.creditor == body.get('links')['creditor']
assert response.links.customer == body.get('links')['customer']
assert response.links.outbound_payment_import == body.get('links')['outbound_payment_import']
assert response.links.recipient_bank_account == body.get('links')['recipient_bank_account']
assert response.verifications.recipient_bank_account_holder_verification == body.get('verifications')['recipient_bank_account_holder_verification']

Expand Down Expand Up @@ -104,6 +105,7 @@ def test_outbound_payments_withdraw():
assert response.status == body.get('status')
assert response.links.creditor == body.get('links')['creditor']
assert response.links.customer == body.get('links')['customer']
assert response.links.outbound_payment_import == body.get('links')['outbound_payment_import']
assert response.links.recipient_bank_account == body.get('links')['recipient_bank_account']
assert response.verifications.recipient_bank_account_holder_verification == body.get('verifications')['recipient_bank_account_holder_verification']

Expand Down Expand Up @@ -146,6 +148,7 @@ def test_outbound_payments_cancel():
assert response.status == body.get('status')
assert response.links.creditor == body.get('links')['creditor']
assert response.links.customer == body.get('links')['customer']
assert response.links.outbound_payment_import == body.get('links')['outbound_payment_import']
assert response.links.recipient_bank_account == body.get('links')['recipient_bank_account']
assert response.verifications.recipient_bank_account_holder_verification == body.get('verifications')['recipient_bank_account_holder_verification']

Expand Down Expand Up @@ -188,6 +191,7 @@ def test_outbound_payments_approve():
assert response.status == body.get('status')
assert response.links.creditor == body.get('links')['creditor']
assert response.links.customer == body.get('links')['customer']
assert response.links.outbound_payment_import == body.get('links')['outbound_payment_import']
assert response.links.recipient_bank_account == body.get('links')['recipient_bank_account']
assert response.verifications.recipient_bank_account_holder_verification == body.get('verifications')['recipient_bank_account_holder_verification']

Expand Down Expand Up @@ -230,6 +234,7 @@ def test_outbound_payments_get():
assert response.status == body.get('status')
assert response.links.creditor == body.get('links')['creditor']
assert response.links.customer == body.get('links')['customer']
assert response.links.outbound_payment_import == body.get('links')['outbound_payment_import']
assert response.links.recipient_bank_account == body.get('links')['recipient_bank_account']
assert response.verifications.recipient_bank_account_holder_verification == body.get('verifications')['recipient_bank_account_holder_verification']

Expand Down Expand Up @@ -351,6 +356,7 @@ def test_outbound_payments_update():
assert response.status == body.get('status')
assert response.links.creditor == body.get('links')['creditor']
assert response.links.customer == body.get('links')['customer']
assert response.links.outbound_payment_import == body.get('links')['outbound_payment_import']
assert response.links.recipient_bank_account == body.get('links')['recipient_bank_account']
assert response.verifications.recipient_bank_account_holder_verification == body.get('verifications')['recipient_bank_account_holder_verification']

Expand Down
Loading
Loading