Skip to content

feat: Razorpay support#2037

Open
RohitKushvaha01 wants to merge 15 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:fetch_plugin_api
Open

feat: Razorpay support#2037
RohitKushvaha01 wants to merge 15 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:fetch_plugin_api

Conversation

@RohitKushvaha01
Copy link
Copy Markdown
Member

@RohitKushvaha01 RohitKushvaha01 commented Apr 16, 2026

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 16, 2026

Greptile Summary

This PR wires up Razorpay as a second payment path for paid plugins. On the native side it adds PluginRetriever.java (downloadPlugin + fetchJsonArray) with proper finally-disconnect handling, and routes all authenticated plugin fetches through the Authenticator Cordova plugin. On the JS side it refactors getOwned to run IAP and Razorpay fetches in sequence, migrates retrieveFilteredPlugins to the new auth-token-aware fetch, and adds the remotePlugin.owned fallback for non-Play-Store environments.

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 style/cleanup suggestions that do not affect correctness.

The major issues flagged in previous review rounds (connection leak, filterState pagination not returned to JS, IAP failure swallowing Razorpay path, remotePlugin.owned not checked without an IAP product) are all addressed in this revision. The only new findings are a hardcoded temp filename (concurrent-install edge case) and inconsistent indentation — both P2 and non-blocking.

src/lib/installPlugin.js (temp file race condition), src/pages/plugins/plugins.js (indentation inconsistency)

Important Files Changed

Filename Overview
src/lib/installPlugin.js Replaces cordova.plugin.http with a native Authenticator.downloadPlugin exec; reads the result from a hardcoded temp file that is never deleted and could be clobbered by concurrent installs.
src/pages/plugin/plugin.js Adds an else if (remotePlugin.owned) fallback so Razorpay-purchased plugins are recognised when the IAP product object is absent (e.g. non-Play-Store environments).
src/pages/plugins/plugins.js Adds fetchPlugins Cordova bridge helper, rewrites getOwned to query Razorpay-owned plugins after IAP, and migrates retrieveFilteredPlugins to use the auth-token-aware native fetch; fetchPlugins/retrieveFilteredPlugins/getOwned are inconsistently un-indented relative to the rest of the PluginsInclude body.
src/plugins/auth/plugin.xml Registers PluginRetriever.java with the Cordova build so the new class is compiled and available at runtime.
src/plugins/auth/src/android/Authenticator.java Adds downloadPlugin and fetchPlugins action handlers that delegate to PluginRetriever on a thread-pool thread; cleans up inline comments and imports JSONObject.
src/plugins/auth/src/android/PluginRetriever.java New file providing downloadPlugin (with proper finally-disconnect fix) and fetchJsonArray; both correctly scope the x-auth-token header to acode.app hosts only.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[getOwned called] --> B[IAP path: iap.getPurchases]
    B -->|success| C[Fetch each SKU from API]
    B -->|failure| D[Log warning, continue]
    C --> E[Add to owned list]
    D --> F[Razorpay path: fetchPlugins owned=true]
    E --> F
    F -->|success| G[Merge with addedIds dedup]
    F -->|failure| H[Log error]
    G --> I[Render owned tab]
    H --> I

    J[installPlugin called] --> K{URL type?}
    K -->|Acode registry or local| L[fsOperation.readFile directly]
    K -->|Third-party URL| M[cordova.exec downloadPlugin]
    M --> N[PluginRetriever writes ZIP to cache]
    N --> O[fsOperation.readFile from cache file]
    L --> P[JSZip.loadAsync]
    O --> P
Loading

Reviews (7): Last reviewed commit: "fix: bug" | Re-trigger Greptile

Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
Comment thread src/plugins/auth/src/android/PluginRetriever.java
Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
@RohitKushvaha01 RohitKushvaha01 changed the title Native API for retrieving plugins feat: Razorpay support Apr 17, 2026
Comment thread src/plugins/auth/src/android/PluginRetriever.java
Comment thread src/pages/plugin/plugin.js
Comment thread src/pages/plugins/plugins.js Outdated
Copy link
Copy Markdown
Member

@UnschooledGamer UnschooledGamer left a comment

Choose a reason for hiding this comment

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

LGTM

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