feat(msi): add POST /monthly_installments/validate to the spec - #124
Draft
leofischer wants to merge 1 commit into
Draft
feat(msi): add POST /monthly_installments/validate to the spec#124leofischer wants to merge 1 commit into
leofischer wants to merge 1 commit into
Conversation
The endpoint exists in payments-api (config/routes.rb:736 ->
MonthlyInstallmentsController#validate) and the public dev center
documents it as step 1 of the Direct API MSI flow, but it was absent
from the spec, so no SDK exposes it.
Request and response schemas are derived from BinValidatorService:
request - bin (6 or 8 digits, 8 falls back to 6 on no match),
amount in minor units
response - available_installments[{months, amount}] and
bin_info{country, scheme, issuer}, both always present
(#retrieve_legacy / #retrieve_via_engine)
available_installments is documented as legitimately empty for a card
that does not qualify, since #retrieve_monthly_installments returns []
rather than raising when validate_card_rules? fails.
_build/api.yaml is NOT regenerated: `make merge` needs a running Docker
daemon, which was unavailable. Run `make merge` before merging.
Co-Authored-By: Claude Opus 5 (1M context) <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.
What
Adds
POST /monthly_installments/validateto the spec. The endpoint exists and the public dev center documents it, but it is absent here, so no SDK exposes it.payments-apiconfig/routes.rb:736→MonthlyInstallmentsController#validatedev-centerdocs/PAGOS A LA MEDIDA CON DIRECT API/aceptar-pagos-con-tarjetas-1/meses-sin-intereses-api.mdas step 1 of the Direct API MSI flow, with a curl example and a full field tableMerchants are currently told to call an endpoint their SDK has no method for.
Schema derivation
Everything comes from
BinValidatorService, not from the docs:bin— 6 or 8 digits, 8 retried as 6 on no matchBIN_SIZE = 8;#load_bin_information_with_fallback(@bin = bin[0..5])amount— minor units#calculate_monthly_installments(amount / months.to_f)available_installments[].months/.amount#calculate_monthly_installments,#adapt_engine_options(monthly_fee→amount)bin_info—country,scheme,issuer#bin_info_summary(exactly these three keys)#retrieve_legacyand#retrieve_via_engineboth return the same two keysmonths∈ {3, 6, 9, 12, 18, 24}MONTHLY_INSTALLMENTS = [3, 6, 9, 12, 18, 24]available_installmentsis documented as legitimately empty rather than an error case:#retrieve_monthly_installmentsreturns[]whenvalidate_card_rules?fails (debit, or credit not issued in Mexico). Client code that treats "no error" as "MSI available" will offer plazos the charge then rejects. Same note is going into the dev center in conekta/dev-center#55.Verification
resources/,requestBodies/andschemas/follow thetokens/layout exactly. Every$refreachable fromapi.yamlresolves and every file parses — 276 files walked._build/api.yamlis not regenerated:make mergeneeds a running Docker daemon and none was available here. Runmake mergebefore merging.Why this is a draft — please confirm the endpoint is public surface
MonthlyInstallmentsControllercarries the comment "Add MSI validation for checkout-fe". It was built for Conekta's own checkout frontend, and adding it here generates public SDK methods in every language, which is a commitment to its stability. Two ways to resolve, and it is your call which:Either way the current state is inconsistent.
Two other spec gaps I found and did NOT add
Both exist in
payments-apiand appear in public dev center pages, but I have no evidence they are intended as public API surface, and I will not invent a contract for them:POST /payees—config/routes.rb:495, underApiConstraintsversion scoping, so which API versions expose it also needs confirming. Appears ingenerar-una-dispersión-a-terceros-con-direct-api.md:79.PUT/GET /checkout_configuration—config/routes.rb:383. Appears inhosted-payments.md:905.Worth a decision alongside this one.