Skip to content

fix(airwallex): carry connector_order_id and access token in dedicated proto fields - #2028

Open
shuklatushar226 wants to merge 2 commits into
mainfrom
fix/airwallex-remove-feature-data-workaround
Open

fix(airwallex): carry connector_order_id and access token in dedicated proto fields#2028
shuklatushar226 wants to merge 2 commits into
mainfrom
fix/airwallex-remove-feature-data-workaround

Conversation

@shuklatushar226

Copy link
Copy Markdown
Contributor

Why

Raised in review on hyperswitch#13278 — connector-specific logic had leaked into the connector-agnostic UCS transformer on the Hyperswitch side.

Two proto gaps were being worked around by overloading connector_feature_data:

Message Missing Workaround
RecurringPaymentServiceChargeRequest connector_order_id caller wrote {"connector_order_id": "..."}, connector read the key back
CustomerServiceCreateRequest state caller wrote {"access_token": "..."}, connector read the key back

Airwallex needs both: its MIT leg confirms a pre-created PaymentIntent (so it needs the id from CreateOrder), and its customer API authenticates with a Bearer token separate from the merchant credentials.

Everywhere else connector_feature_data is an opaque, connector-owned blob round-tripped between legs. Overloading it with router-synthesized magic keys gave one field two contracts, with nothing but a string literal holding the two sides together — rename it on either side and it fails at runtime, not at build time.

What

  • payment.proto: add RecurringPaymentServiceChargeRequest.connector_order_id = 39 and CustomerServiceCreateRequest.state = 10
  • types.rs: map both into PaymentFlowData (the stateaccess_token extraction is the same one the recurring-charge impl already uses)
  • composite-service: thread state into the customer-create request, mirroring the neighbouring CustomerServiceGetRequest impl
  • airwallex.rs: drop both fallback reads; get_access_token() now goes through the normal path like the other nine call sites in the file

Net +32/−31 — this removes more than it adds.

Notes

  • Both fields are new optional tags (39 and 10 are free at 2026.07.07.2, 2026.07.28.0, and main), so the change is wire-compatible in both directions — old servers ignore them, new servers see None.
  • The composite authorize path previously had no way to pass a token to customer-create; it hardcoded nothing and the connector_feature_data workaround never covered it. Threading state closes that gap.
  • Verified: cargo clippy --workspace --all-targets clean.
  • The Hyperswitch side of this is held until a tag is cut from this — it pins 2026.07.07.2, which lacks both fields.

…d proto fields

The Airwallex MIT leg confirms a pre-created PaymentIntent, so it needs the
connector_order_id from CreateOrder. RecurringPaymentServiceChargeRequest had
no field for it, so callers smuggled it through connector_feature_data as
{"connector_order_id": "..."} and the connector read that magic key back out.
Same story for the connector-customer call: CustomerServiceCreateRequest had no
`state` field, so the Bearer token travelled as {"access_token": "..."} in the
same blob.

That overloaded connector_feature_data — everywhere else an opaque,
connector-owned pass-through — with a second undocumented contract, and put
knowledge of one connector's wire format into the connector-agnostic layer.

Add the two missing fields instead:
  - RecurringPaymentServiceChargeRequest.connector_order_id = 39
  - CustomerServiceCreateRequest.state = 10

map both into PaymentFlowData, thread `state` through the composite authorize
path (which previously had no way to pass a token to customer-create at all),
and drop both fallback reads from the Airwallex connector.

Both fields are new optional tags, so the change is wire-compatible in each
direction.
@shuklatushar226
shuklatushar226 requested review from a team as code owners July 31, 2026 11:45
Auto-applied by CI:
- cargo +nightly fmt --all
- make -C sdk generate (if applicable)
- make docs (if applicable)

This commit was automatically generated by GitHub Actions.
@XyneSpaces

Copy link
Copy Markdown

[blocking] payment.proto adds new fields to RecurringPaymentServiceChargeRequest and CustomerServiceCreateRequest, but this PR does not include the corresponding generated Rust under crates/types-traits/grpc-api-types/src/. The domain conversions now read connector_order_id / state, so consumers built from the checked-in generated API will not see the new fields.

Regenerate and commit the gRPC Rust artifacts for these proto changes.

@XyneSpaces

Copy link
Copy Markdown

[blocking] Please regenerate and commit the Rust gRPC artifacts for the new payment.proto fields. This PR adds CustomerServiceCreateRequest.state and RecurringPaymentServiceChargeRequest.connector_order_id, and the Rust code now reads those fields; without the matching crates/types-traits/grpc-api-types/src/ updates, the workspace will fail to compile.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants