fix(SettlementTerm): open enum for acceptedPaymentMethods + add UPI, PAYMENT_URL#52
Open
ameetdesh wants to merge 1 commit into
Open
Conversation
…PAYMENT_URL The previous `additionalProperties: true` on a `type: string` item was a no-op — that keyword applies only to objects, not strings. Validators correctly enforced the two-value enum and rejected any extension values (e.g. "UPI"). Switch to the standard open-enum pattern via anyOf: - branch 1: string restricted to the known set [CASH_DEPOSIT, BANK_TRANSFER, UPI, PAYMENT_URL] - branch 2: plain string, allowing any extension value to pass validation New enum values added: - UPI — payment via UPI VPA (pairs with payTo.vpa) - PAYMENT_URL — hosted checkout URL handling multiple methods (pairs with payTo.paymentUrl) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
@ameetdesh A better way would be to update this schema - https://github.com/beckn/schemas/blob/main/schema/AcceptedPaymentMethod/v2.0/attributes.yaml, and use a $ref in SettlementTerm to refer to this. In fact it wouldn't hurt to alias this to just PaymentMethod instead of prefixing it with "Accepted" and deprecate it eventually. If there are no schemas referring to this currently, we can directly do a rename and push. |
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.
Problem
acceptedPaymentMethodsusedadditionalProperties: trueon atype: stringitem to signal extensibility, but this is a no-op in JSON Schema — that keyword only applies to objects, not strings. Validators correctly enforced the two-value enum[CASH_DEPOSIT, BANK_TRANSFER]and rejected any extension values (e.g."UPI").Fix
Switch to the standard open-enum pattern using
anyOf:This means:
New enum values
UPIpayTo.vpa(e.g."sellerplatform@hdfc")PAYMENT_URLpayTo.paymentUrl; gateway handles method selectionRelationship to
payTovariants🤖 Generated with Claude Code