Skip to content

feat: add authorization_type and payment_plan to hosted, link and session payment requests#341

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

feat: add authorization_type and payment_plan to hosted, link and session payment requests#341
armando-rodriguez-cko wants to merge 1 commit into
masterfrom
fix/payment-request-field-gaps

Conversation

@armando-rodriguez-cko

Copy link
Copy Markdown
Contributor

Summary

Adds two properties that swagger introduced to HostedPaymentsRequest, PaymentLinksRequest and CreatePaymentSessionsBaseRequest but were missing from the corresponding PHP request classes:

  • authorization_type — string, allowed values Final / Estimated (default Final). Matches how PaymentRequest already exposes authorization_type as a plain string property. (Note: the existing Checkout\AuthorizationType class is for SDK auth modes, not payment authorization, so it is intentionally not reused.)
  • payment_plan — typed as the existing Checkout\Payments\PaymentPlan, which already maps the PaymentSessionPaymentPlanRecurring schema. Added the one missing field amount_variability (Fixed/Variable) to that class.

Applied to:

  • lib/Checkout/Payments/Hosted/HostedPaymentsSessionRequest.php
  • lib/Checkout/Payments/Links/PaymentLinkRequest.php
  • lib/Checkout/Payments/Sessions/PaymentSessionsRequest.php

Part of a cross-SDK sweep aligning request models with recent swagger additions.

Tests

Added test/Checkout/Tests/Payments/PaymentRequestFieldsSerializationTest.php covering serialization of both new fields across all three request classes, plus omission of unset fields.

vendor/bin/phpunit test/Checkout/Tests/Payments/PaymentRequestFieldsSerializationTest.php
OK (4 tests, 12 assertions)
vendor/bin/phpunit test/Checkout/Tests/JsonSerializerTest.php
OK (7 tests, 8 assertions)

PHP lint + phpcs pre-commit hook passed on all changed files.

Follow-up

None required for typing — PaymentPlan was a good fit and only needed amount_variability added.

…sion payment requests

Adds the authorization_type (Final/Estimated) and payment_plan properties
to HostedPaymentsSessionRequest, PaymentLinkRequest and PaymentSessionsRequest,
matching the swagger additions to HostedPaymentsRequest, PaymentLinksRequest and
CreatePaymentSessionsBaseRequest.

payment_plan is typed as the existing Checkout\Payments\PaymentPlan, which
already maps the PaymentSessionPaymentPlanRecurring schema; added the missing
amount_variability field to it.

Adds serialization tests for the new fields.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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