Add ACH stop-payment support - #82
Merged
Merged
Conversation
…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
marked this pull request as ready for review
June 29, 2026 17:30
samuelvasco
reviewed
Jun 29, 2026
| from typing import Union | ||
|
|
||
|
|
||
| class AchStopPaymentResource(BaseResource): |
Collaborator
There was a problem hiding this comment.
question: should we also add a get method?
Author
There was a problem hiding this comment.
Good call — added a get(stop_payment_id) method in f220f19.
samuelvasco
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 typeachStopPayment) inunit/models/payment.py.UpdateAchStopPaymentRequest(JSON:API typeachStopPayment) for the update endpoint, also inunit/models/payment.py.ach_stop_paymentsresource exposingcreateandupdate(pluslist/disable), wired onto theUnitfacade.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
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 toUnitRequest.to_payload("achStopPayment", self.relationships), which camelCases attribute keys (originatorName,minAmount,isMultiUse, etc.) and attaches theaccountrelationship.UpdateAchStopPaymentRequest(UnitRequest)with constructor(stop_payment_id, tags=None).stop_payment_idis used only in the URL (PATCH /stop-payments/{id}) and is kept out of the JSON:API body;to_json_api()emitstype: "achStopPayment"with the updatabletagsattribute, mirroring the existingPatch*PaymentRequestmodels.AchStopPaymentResource(BaseResource)inunit/api/ach_stop_payment_resource.pywithself.resource = "stop-payments"and acreate(request)that POSTs and decodes the response viaDtoDecoder(falling back toRawUnitObject, same as the check version). Also includesupdate(request)(PATCH /stop-payments/{id}),list()(GET /stop-payments) anddisable(stop_payment_id)(POST /stop-payments/{id}/disable).self.ach_stop_payments = AchStopPaymentResource(api_url, token)into theUnitfacade inunit/__init__.py, next tocheck_stop_payments.Public interface (called by the Truss API):
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).