Skip to content

fix(plugin): run without options and keep an existing Google Pay manifest entry - #56

Merged
jkasprzyk17 merged 1 commit into
mainfrom
fix/expo-plugin-optional-props
Oct 27, 2026
Merged

jkasprzyk17 merged 1 commit into
mainfrom
fix/expo-plugin-optional-props

Conversation

@jkasprzyk17

@jkasprzyk17 jkasprzyk17 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #23

Summary

  • "plugins": ["@gmisoftware/react-native-pay"] no longer crashes expo prebuild with Cannot read properties of undefined (reading 'enableGooglePay'). The entrypoint defaults the undefined props Expo passes to {}, and withGooglePay and withApplePay keep a strict ConfigPlugin<ReactNativePayPluginProps> contract.
  • enableGooglePay has three states: true adds com.google.android.gms.wallet.api.enabled, false removes it, and omitted (or null) leaves the Android manifest alone, so an entry added by another plugin (Stripe, for example) survives.
  • withApplePay normalizes merchantIdentifier to one list, and prebuild warns (WarningAggregator.addWarningIOS) about IDs that don't start with merchant.. They are still added.
  • Docs (setup/expo-plugin.md, compatibility.md), type.ts JSDoc, CHANGELOG.md and SPEC-003 describe the new contract.

Test plan

  • cd package && bun run typecheck
  • cd package && bun run lint
  • cd package && bun run test:ci (10 suites, 146 tests). The new tests fail on main with the TypeError from the issue.
  • cd package && bun run check:docs
  • bun run docs:build
  • Built app.plugin.js (bun run typescript) and called it the way Expo does: no options and merchantIdentifier: [] register no mods; enableGooglePay: false registers the manifest mod; com.example.app prints the warning.
  • ./gradlew :gmisoftware_react-native-pay:testDebugUnitTest (not run: no Kotlin changes)
  • xcodebuild test ... -scheme NitroPay-Unit-Tests (not run: no Swift changes)
  • cd example && bunx expo run:ios / run:android (not run: build-time plugin change only. src/plugin/__tests__/index.integration.test.ts runs the plugin through Expo's withPlugins and mod pipeline on a real manifest object instead. The example passes both options, so its output is unchanged.)

Risk

  • Behaviour change: apps that omitted enableGooglePay and relied on the plugin removing the Google Pay meta-data now keep it. Set enableGooglePay: false to keep removing it, then run npx expo prebuild --clean. Configs that set the option, including the example, behave as before.
  • merchantIdentifier: [] or [''] no longer registers the two iOS mods. They wrote nothing before, so the generated files are the same.

Notes

  • JSON null for enableGooglePay is treated as omitted, as the issue specifies ("remove it only when it is explicitly false").
  • A merchant ID without the merchant. prefix warns instead of failing, so prebuilds that work today keep working.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…fest entry

Listing "@gmisoftware/react-native-pay" without an options object crashed
expo prebuild, because the plugin destructured undefined props. The
entrypoint now defaults them, and the sub-plugins keep a strict contract.

When enableGooglePay was omitted, the plugin removed
com.google.android.gms.wallet.api.enabled even if another plugin had
added it. It now adds the entry for true, removes it for false and leaves
the manifest alone when the option is omitted.

withApplePay normalizes merchant IDs once and warns about IDs that do not
start with "merchant.".

Closes #23
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 4f92690c-784c-4c77-9192-2310606291b1
Commits

Reviewing files that changed from the base of the PR and between 05b782c and 4ef828e.

Files ignored due to path filters: 1
  • .ai/specs/SPEC-003-2026-02-10-expo-config-plugin-contract.md is excluded by !.ai/**
Files selected for processing: 11
  • CHANGELOG.md
  • docs/docs/compatibility.md
  • docs/docs/setup/expo-plugin.md
  • package/src/plugin/__tests__/index.integration.test.ts
  • package/src/plugin/__tests__/index.test.ts
  • package/src/plugin/__tests__/withApplePay.test.ts
  • package/src/plugin/__tests__/withGooglePay.test.ts
  • package/src/plugin/index.ts
  • package/src/plugin/type.ts
  • package/src/plugin/withApplePay.ts
  • package/src/plugin/withGooglePay.ts

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Expo prebuild no longer crashes when plugin options are omitted. Without options, the plugin leaves existing platform configuration unchanged.
    • Google Pay is added to the Android manifest when enabled and removed when explicitly disabled; omitting the option preserves the existing entry.
    • Prebuild now warns when a merchant identifier does not start with merchant..
  • Documentation

    • Clarified that plugin options are optional and explained how Google Pay settings affect the Android manifest.

The Expo plugin now accepts omitted options. Omitted enableGooglePay leaves Android manifest processing unchanged, while explicit values continue to add or remove the metadata. The Apple Pay plugin filters empty merchant identifiers and warns when an identifier lacks the merchant. prefix.

Changes: Expo plugin options

Layer / File(s) Summary
Optional props and Google Pay metadata
package/src/plugin/index.ts, package/src/plugin/type.ts, package/src/plugin/withGooglePay.ts, package/src/plugin/__tests__/*, docs/docs/compatibility.md, docs/docs/setup/expo-plugin.md
The plugin accepts omitted props and passes empty options to both platform plugins. The Google Pay mod skips manifest processing when enableGooglePay is omitted or null; integration tests cover omitted, true, and false values. Documentation describes these behaviors.
Apple Pay merchant identifiers
package/src/plugin/withApplePay.ts, package/src/plugin/__tests__/withApplePay.test.ts, CHANGELOG.md
The Apple Pay mod filters empty identifiers, passes the normalized list to its entitlement and Info.plist helpers, and warns for IDs without the merchant. prefix. Tests cover empty, invalid, and valid IDs.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: piotr-graczyk-dev

Merge Risk: Minimal · up to 4ef82

No merge-blocking issue is established; the plugin change is ready for normal merge checks.

Pre-merge checks: Passed 5 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 5 passed
Check name Status Explanation
Title check Passed The title uses the conventional type prefix "fix(plugin):" and describes the two changes in the PR: the plugin now runs without options, and an existing Google Pay manifest entry is kept when the opti…
Description check Passed The description is directly related to the changeset. It explains the crash fix in the plugin entrypoint, the three-state handling of enableGooglePay, the merchantIdentifier normalization and warning,…
Linked Issues check Passed Issue #23 requires bare-plugin prebuild support and preservation of an existing Google Pay manifest entry when enableGooglePay is omitted. The PR defaults omitted props, leaves the manifest unchange…
Out of Scope Changes check Passed The changed code, tests, documentation, changelog, and contract notes describe or verify the Expo plugin behavior required by issue #23. The Apple Pay normalization and warning support the same plugin…
Security Check Passed No medium, high, or critical vulnerability is introduced. The diff only changes Expo prebuild configuration: it normalizes local plugin options, writes a fixed Google Pay metadata name/value, and copi…
Full details: Title check

Explanation

The title uses the conventional type prefix "fix(plugin):" and describes the two changes in the PR: the plugin now runs without options, and an existing Google Pay manifest entry is kept when the option is omitted. Both match the changeset. The title is 79 characters, longer than the 50-character guideline, so it is not fully concise. The type prefix is present, so the title is not vague or unrelated.

Full details: Description check

Explanation

The description is directly related to the changeset. It explains the crash fix in the plugin entrypoint, the three-state handling of enableGooglePay, the merchantIdentifier normalization and warning, the docs and changelog updates, the test plan, and the behavior change risk.

Full details: Linked Issues check

Explanation

Issue #23 requires bare-plugin prebuild support and preservation of an existing Google Pay manifest entry when enableGooglePay is omitted. The PR defaults omitted props, leaves the manifest unchanged for omitted or null values, removes metadata only for explicit false, and adds integration and unit tests for undefined props, preservation, true, and false. The optional merchant-ID warning is also implemented and tested.

Full details: Out of Scope Changes check

Explanation

The changed code, tests, documentation, changelog, and contract notes describe or verify the Expo plugin behavior required by issue #23. The Apple Pay normalization and warning support the same plugin contract. No unrelated implementation change is established by the available whole-PR summary.

Full details: Security Check

Explanation

No medium, high, or critical vulnerability is introduced. The diff only changes Expo prebuild configuration: it normalizes local plugin options, writes a fixed Google Pay metadata name/value, and copies merchant identifiers into Expo plist/entitlement objects. It adds no network access, authentication logic, secrets, shell execution, deserialization, or dependency changes. Merchant identifiers are build-time configuration, and Expo config-plugin serializers handle the resulting structured values. The retained Google Pay entry and warning behavior are intentional configuration changes, not an attacker path. No prior security findings or unresolved security threads were supplied.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 8 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Comment @coderabbitai help to get the list of available commands.

@jkasprzyk17
jkasprzyk17 merged commit 34d08a3 into main Oct 27, 2026
7 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.

Expo plugin crashes without options and removes an existing Google Pay manifest entry

1 participant