Skip to content

test: cover authorization_type and payment_plan on payment requests#434

Open
armando-rodriguez-cko wants to merge 1 commit into
masterfrom
fix/payment-request-field-gaps
Open

test: cover authorization_type and payment_plan on payment requests#434
armando-rodriguez-cko wants to merge 1 commit into
masterfrom
fix/payment-request-field-gaps

Conversation

@armando-rodriguez-cko

Copy link
Copy Markdown
Contributor

What

Adds unit tests for authorization_type and payment_plan on 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.ts files type these request bodies as Object/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 the payment_plan recurring 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

  • test/hosted-payments/hosted-payments.js
  • test/payments-links/payments-links.js
  • test/payment-sessions/payment-sessions-unit.js

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.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant