Skip to content

Request ID NPE Fix - #69

Merged
ZweWaiYanHtet merged 2 commits into
masterfrom
fix/request-id-uuid-validation
Sep 4, 2026
Merged

ZweWaiYanHtet merged 2 commits into
masterfrom
fix/request-id-uuid-validation

Conversation

@ZweWaiYanHtet

Copy link
Copy Markdown
Contributor

Ref: https://github.com/pokepay/pokepay-server/issues/7660

This pull request improves the handling and validation of the optional requestId (idempotency key) parameter across both the Dart and Android native layers. The main goal is to ensure that requestId is always validated in Dart, enforcing a strict UUID format compatible with both Android and iOS, and to prevent silent failures or inconsistencies in idempotency behavior between platforms.

Key changes include:

Validation and Consistency Improvements:

  • Added a new Dart utility validateRequestId in lib/parameters/request_id.dart to strictly validate requestId against the canonical UUID format, ensuring both Android and iOS plugins behave identically and preventing malformed values from reaching the native layer.
  • Updated all transaction-related API calls in Dart (lib/bank_api/transaction.dart, lib/pokepay_sdk.dart) to apply validateRequestId before passing requestId to the native plugins, ensuring only valid or null values are sent. [1] [2] [3] [4] [5]

Android Native Handling:

  • Refactored the Android plugin (PokepaySdkPlugin.java) to use a new parseRequestId helper that passes through nulls and delegates all format validation to Dart, preventing silent omission of invalid requestId values and aligning error behavior with platform expectations. [1] [2] [3] [4] [5] [6]

Codebase Maintenance:

  • Updated import statements in Dart files to include the new request_id.dart module where necessary. [1] [2]

@taniryo-kun

Copy link
Copy Markdown
Collaborator

@ZweWaiYanHtet This also should not be able to pass uppercase UUIDs, is it ok?

@ZweWaiYanHtet

Copy link
Copy Markdown
Contributor Author

@ZweWaiYanHtet This also should not be able to pass uppercase UUIDs, is it ok?

iOS should be fine. Let me check Android.

@ZweWaiYanHtet

Copy link
Copy Markdown
Contributor Author

It should be fine with both iOS and Android since native side will normalize it but I changed to a stricter regex just in case.

@taniryo-kun taniryo-kun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZweWaiYanHtet
ZweWaiYanHtet merged commit af49a1a into master Sep 4, 2026
3 checks passed
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