Repository navigation
Correct SDK against current TapPay docs (0.7.1) - #5
Merged
Merged
Conversation
Four fixes found by checking the SDK against the current TapPay documentation. Two are defects introduced in 0.7.0, which was tagged but never published to PyPI, so no released version exposed them. Models.Currencies listed 11 currencies TapPay does not accept. 0.7.0 shipped JPY, GBP, AUD, EUR, CNY, KRW, SGD, THB, PHP, IDR and VND on assumption rather than from the docs. They autocompleted in an IDE and looked sanctioned, so they would have been shipped to production and rejected at the API. TapPay documents exactly four, each tied to an acquirer: TWD, HKD (Bank of China), MYR (RAZER PAY) and USD (Global Payments). Removed rather than deprecated, since keeping them keeps suggesting values that fail. Plain currency strings still pass through, so a currency TapPay adds later remains usable. raise_on_error=True raised on normal end-of-pagination. The Record API answers status 2 for "end of list, no more records under the given filter", which is how paging terminates. Every non-zero status was treated as a failure, so paging to the end of any query raised TapPayError. Benign statuses are now scoped per endpoint through BENIGN_STATUSES: 2 is benign for /tpc/transaction/query only, and still raises everywhere else. Full refunds were unreachable. refund() required amount, but TapPay documents it as needed only for a partial refund; omitting it refunds the whole transaction. amount is now optional and omitted from the request when None. Passing 0 still sends 0, because a zero-value partial refund is not the same as a full one. The default read timeout was 27.0s, taken from a generic requests convention. TapPay documents 30s because banks take longer at peak, so the shorter value could report a timeout for a transaction that succeeded. DEFAULT_TIMEOUT is now (3.05, 30.0). Verified against the Backend, Advanced Features and Reference pages as of 2026-09-09. 102 tests, coverage remains 100%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Four corrections found by checking the SDK against the current TapPay
documentation. Two are defects introduced in 0.7.0. That version was tagged
but never published to PyPI, so no released version ever exposed them.
Fixes
Models.Currencieslisted 11 currencies TapPay does not accept0.7.0 shipped
JPY,GBP,AUD,EUR,CNY,KRW,SGD,THB,PHP,IDRandVND. None are documented; they were added on assumption rather thanfrom the docs. They autocompleted in an IDE and looked sanctioned, so they would
eventually have reached production and been rejected at the API.
TapPay documents exactly four, each tied to the acquirer on your merchant
account:
TWDHKDMYRUSDRemoved rather than deprecated — keeping them would keep suggesting values that
fail. Plain currency strings still pass through, so the enum narrows what the
SDK suggests, not what a caller may send.
raise_on_error=Trueraised on normal end-of-paginationThe Record API answers
status: 2for "end of list, no more records under thegiven filter" — how paging terminates. 0.7.0 treated every non-zero status as a
failure, so paging to the end of any query raised
TapPayError.Benign statuses are now scoped per endpoint via
BENIGN_STATUSES.2is benignfor
/tpc/transaction/queryonly and still raises everywhere else, which iscovered by a test asserting the same status raises on a payment endpoint.
Full refunds were unreachable
refund()requiredamount, but TapPay documents it as needed "only forpartial refund" — omitting it refunds the whole transaction. There was no way
to express a full refund without already knowing the exact amount.
amountis now optional and dropped from the request whenNone. It usesis not Nonerather than a truthiness check:0is falsy but means azero-value partial refund, and a truthy test would silently turn that into
refunding the entire transaction.
Default read timeout was below TapPay's documented minimum
It was 27.0s, taken from a generic
requestsconvention. TapPay documents 30sbecause banks take longer at peak, so the shorter value could report a timeout
for a transaction that actually succeeded — the worst failure mode for a payment
client.
DEFAULT_TIMEOUTis now(3.05, 30.0).Verification
102 tests, coverage stays at 100%.
ruffandmypyclean. Verified in a cleanworktree, and end-to-end:
Scope
Checked against the Backend, Advanced Features and Reference pages as of
2026-09-09. TapPay publishes no API changelog, so these are differences observed
against current documentation, not a dated diff.
Deferred to 0.8.0 and recorded in
CHANGELOG.md:pay_by_tokenaccepts nocardholder (whose
phone_numberandemailare required for 3D-secure tokenpayments);
CardHolderDatais missingname_en,phone_number_country_code,member_idandbank_member_idand validates none of the documented fieldlengths;
filtersanddetailsare required by this SDK but optional in theAPI; and nine documented endpoints remain unimplemented, including
reconciliation, card metadata and update-cardholder.
Note on
v0.7.0That tag is on
masterand carries the fabricated currency list. It neverreached PyPI so nobody can have installed it, but it is a public artifact
advertising currencies TapPay rejects. Worth deleting it or tagging
v0.7.1promptly behind it.
🤖 Generated with Claude Code