Skip to content

Add ACH stop-payment support - #82

Merged
julia-truss merged 4 commits into
masterfrom
add-ach-stop-payment
Jun 29, 2026
Merged

Add ACH stop-payment support#82
julia-truss merged 4 commits into
masterfrom
add-ach-stop-payment

Conversation

@claude

@claude claude Bot commented Jun 29, 2026

Copy link
Copy Markdown

Requested by Julia Park · Slack thread

What

Adds ACH stop-payment support to the SDK, mirroring the existing check stop-payment support:

  • CreateAchStopPaymentRequest (JSON:API type achStopPayment) in unit/models/payment.py.
  • UpdateAchStopPaymentRequest (JSON:API type achStopPayment) for the update endpoint, also in unit/models/payment.py.
  • A new ach_stop_payments resource exposing create and update (plus list/disable), wired onto the Unit facade.

The SDK previously supported only CHECK stop payments; this fills in the ACH variant.

Why

Truss needs to create and update ad-hoc ACH stop payments in Unit to block unauthorized third-party debits for a customer. The existing SDK only covered check stop payments, leaving no way to call the ACH stop-payment endpoints.

How

  • New request model CreateAchStopPaymentRequest(UnitRequest) with constructor (originator_name=None, direction="Debit", min_amount=None, expiration=None, is_multi_use=False, description=None, relationships=None). to_json_api() delegates to UnitRequest.to_payload("achStopPayment", self.relationships), which camelCases attribute keys (originatorName, minAmount, isMultiUse, etc.) and attaches the account relationship.
  • New request model UpdateAchStopPaymentRequest(UnitRequest) with constructor (stop_payment_id, tags=None). stop_payment_id is used only in the URL (PATCH /stop-payments/{id}) and is kept out of the JSON:API body; to_json_api() emits type: "achStopPayment" with the updatable tags attribute, mirroring the existing Patch*PaymentRequest models.
  • New AchStopPaymentResource(BaseResource) in unit/api/ach_stop_payment_resource.py with self.resource = "stop-payments" and a create(request) that POSTs and decodes the response via DtoDecoder (falling back to RawUnitObject, same as the check version). Also includes update(request) (PATCH /stop-payments/{id}), list() (GET /stop-payments) and disable(stop_payment_id) (POST /stop-payments/{id}/disable).
  • Wired self.ach_stop_payments = AchStopPaymentResource(api_url, token) into the Unit facade in unit/__init__.py, next to check_stop_payments.

Public interface (called by the Truss API):

from unit.models.payment import CreateAchStopPaymentRequest, UpdateAchStopPaymentRequest
unit_client.ach_stop_payments.create(request)
unit_client.ach_stop_payments.update(request)

Dependency note

The consuming Truss API PR depends on this SDK change being merged/released first.

Refs ENG-4839.

Consumed by Truss-pmts/api#5019 (https://github.com/Truss-pmts/api/pull/5019).

claude added 2 commits June 29, 2026 16:30
…payments resource)

Adds CreateAchStopPaymentRequest (type achStopPayment) to unit/models/payment.py,
a new AchStopPaymentResource with create/list/disable mirroring the existing
check stop-payment support, wires ach_stop_payments into the Unit facade, and
adds a parallel e2e test.

ENG-4839
@julia-truss
julia-truss marked this pull request as ready for review June 29, 2026 17:30
from typing import Union


class AchStopPaymentResource(BaseResource):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should we also add a get method?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — added a get(stop_payment_id) method in f220f19.

@julia-truss
julia-truss merged commit 6fee39a into master Jun 29, 2026
3 of 4 checks passed
@julia-truss
julia-truss deleted the add-ach-stop-payment branch June 29, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants