test: cover authorization_type and payment_plan on payment requests#434
Open
armando-rodriguez-cko wants to merge 1 commit into
Open
test: cover authorization_type and payment_plan on payment requests#434armando-rodriguez-cko wants to merge 1 commit into
armando-rodriguez-cko wants to merge 1 commit into
Conversation
The Node SDK passes request bodies through as plain objects, so authorization_type and payment_plan (added in recent swagger to HostedPaymentsRequest, PaymentLinksRequest, and CreatePaymentSessionsBaseRequest) already work without type changes. Add unit tests for hosted payments, payment links, and payment sessions that exercise these fields and assert they are sent on the request body, locking in support. Part of a cross-SDK sweep.
|
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.



What
Adds unit tests for
authorization_typeandpayment_planon the three payment-creation requests that recently gained these fields in swagger:HostedPaymentsRequest(cko.hostedPayments.create)PaymentLinksRequest(cko.paymentLinks.create)CreatePaymentSessionsBaseRequest(cko.paymentSessions.request)Why tests, not type defs
Investigated the SDK's type system. The
.d.tsfiles type these request bodies asObject/any(e.g.create: (body: Object) => Promise<Object>), and the runtime passes plain objects straight through to the HTTP layer. There are no explicit per-field request models to extend. So the correct, convention-matching change is test coverage that documents and locks in support for the new fields, rather than inventing a typing system the repo doesn't use.Each test uses a nock request-body matcher to assert the new fields (
authorization_type: 'Estimated'and thepayment_planrecurring object —amount_variability,days_between_payments,total_number_of_payments, etc.) are serialized onto the outgoing request.Part of a cross-SDK sweep for these payment-request field gaps.
Tests
npx mocha 'test/**/*.js'→ 851 passing, 0 failing, including the 3 new tests. (When the three touched files are run in isolation there are pre-existing nock interceptor-ordering failures unrelated to this change; the full suite — how CI runs — is green.)Files