fix(maya): capture missing response fields + surface raw connector response - #2134
Merged
Conversation
kanikac199
force-pushed
the
fix/maya-response-missing-fields
branch
from
August 14, 2026 11:17
c29ad9c to
4398720
Compare
kanikac199
force-pushed
the
fix/maya-response-missing-fields
branch
from
August 14, 2026 11:26
4398720 to
07e96eb
Compare
Maya's payment-inquiry (PSync) and refund responses return fields the connector was neither deserializing nor handing back, so they were silently dropped from the response body we emit. Amount/currency now go through Prism's money framework (`AmountConvertor::convert_back` -> `MinorUnit`) and feed each flow's integrity check, matching the house pattern (stripe/xendit/airwallex): - PSync (`MayaWebhookBody`): add `isPaid`, `amount`, `currency`, `canCapture`, `createdAt`, `updatedAt`. `amount` is modeled as `StringMajorUnit` because Maya's live payment response serializes it as a decimal string (e.g. "100") -- despite the API reference documenting a JSON number (verified end-to-end against the sandbox). `convert_back` via `StringMajorUnitForConnector` populates `PaymentSynIntegrityObject`. `isPaid`/`canCapture`/`canVoid`/`canRefund`/`createdAt`/`updatedAt` have no typed slot, so they are surfaced via `connector_metadata`. - Refund (`MayaRefundResponse`): add `amount` (also a JSON string -> `StringMajorUnit`) and `currency`; `convert_back` populates `RefundIntegrityObject`. Integrity objects are only set when Maya returns both amount and currency (it omits them for e.g. expired payments); all new fields are optional with `#[serde(default)]`. RSync's integrity object is identity-based (connector txn/refund id), so its amount is modeled but not wired to an amount integrity check. Validated end-to-end against Maya sandbox via the Prism HTTP server: authorize -> wallet payment -> PSync (PAYMENT_SUCCESS) -> refund (REFUND_SUCCESS); the new fields now appear in the typed connector response and integrity amount converts "100" -> 10000 minor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kanikac199
force-pushed
the
fix/maya-response-missing-fields
branch
from
August 14, 2026 12:02
07e96eb to
47c8ff1
Compare
Populate `raw_connector_response` in connector code for every Maya flow, mirroring the flywire/kount pattern (and Maya's existing webhook path), so the connector's response body is captured regardless of the `return_raw_connector_data` config flag. - Authorize / PSync / Void / Refund / RSync transformers: set `resource_common_data.raw_connector_response` to the serialized parsed response (`serde_json::to_string(&item.response)`), wrapped in `Secret`. - Error path (`get_error_response`): set `raw_connector_response` to the byte-exact response body (`String::from_utf8_lossy(&res.response)`) instead of `None`. Verified end-to-end against the Maya sandbox with the flag OFF (development): `raw_connector_response` now appears in the authorize and PSync composite responses. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shuklatushar226
previously approved these changes
Aug 17, 2026
The PSync transformer stuffed isPaid/canVoid/canRefund/canCapture/ createdAt/updatedAt into `connector_metadata`. These are now already surfaced through `raw_connector_response` and `typed_connector_response` (the full payment object), and nothing consumes the metadata back, so it was pure duplication. Removed. Addresses review comment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Aishwariyaa-Anand
approved these changes
Aug 17, 2026
shuklatushar226
approved these changes
Aug 17, 2026
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.
Description
Two related connector-response improvements for the Maya connector (one commit each):
1. Capture missing PSync & refund response fields via the money framework
Maya's payment-inquiry (PSync) and refund responses returned fields the connector was neither deserializing nor handing back, so they were dropped from the emitted response.
MayaWebhookBody): addisPaid,amount,currency,canCapture,createdAt,updatedAt.amountis modeled asStringMajorUnit(Maya serializes it as a JSON string"100", despite the API reference documenting a number), run throughAmountConvertor::convert_backand surfaced viaPaymentSynIntegrityObject. The non-money flags/timestamps go throughconnector_metadata.MayaRefundResponse): addamount(also a string) +currency→RefundIntegrityObject.2. Surface raw connector response on all flows
Populate
raw_connector_responsein connector code for Authorize / PSync / Void / Refund / RSync (mirrors flywire/kount and Maya's existing webhook path), plus the error path (get_error_response). This captures the raw response independent of thereturn_raw_connector_dataconfig flag (off in development).No need to pass user_id , since it is optional and not needed for current implementation.
Motivation and Context
The connector was silently dropping response data Maya returns. Because the emitted response body is re-serialized from the typed structs, any unmodeled field never reached the caller — losing amount/currency (needed for money-framework integrity verification) and operational flags (
isPaid,canVoid,canRefund,canCapture) as well as the raw connector payload. This models those fields and routes amount/currency through the money framework so PSync/refund amounts are verified against intent, and makes the raw connector response available on every flow.Additional Changes
(No proto/contract change — the response fields already exist; they are now populated. No config changes committed.)
How did you test it?