@bigbinary/neeto-payments-frontend 6.4.1 → 6.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +121 -190
  2. package/dist/cjs/v2/AccountsDashboard.js +19 -23
  3. package/dist/cjs/v2/AccountsDashboard.js.map +1 -1
  4. package/dist/cjs/v2/PaymentsDashboard.js +15 -19
  5. package/dist/cjs/v2/PaymentsDashboard.js.map +1 -1
  6. package/dist/cjs/v2/PayoutsDashboard.js +19 -23
  7. package/dist/cjs/v2/PayoutsDashboard.js.map +1 -1
  8. package/dist/cjs/v2/RefundsDashboard.js +14 -18
  9. package/dist/cjs/v2/RefundsDashboard.js.map +1 -1
  10. package/dist/cjs/v2/SplitTransfersDashboard.js +17 -21
  11. package/dist/cjs/v2/SplitTransfersDashboard.js.map +1 -1
  12. package/dist/cjs/v2/StripeConnect.js +1 -0
  13. package/dist/cjs/v2/StripeConnect.js.map +1 -1
  14. package/dist/cjs/v2/TaxesDashboard.js +20 -15
  15. package/dist/cjs/v2/TaxesDashboard.js.map +1 -1
  16. package/dist/cjs/v2/index.js +0 -1
  17. package/dist/cjs/v2/index.js.map +1 -1
  18. package/dist/v2/AccountsDashboard.js +19 -23
  19. package/dist/v2/AccountsDashboard.js.map +1 -1
  20. package/dist/v2/PaymentsDashboard.js +15 -19
  21. package/dist/v2/PaymentsDashboard.js.map +1 -1
  22. package/dist/v2/PayoutsDashboard.js +19 -23
  23. package/dist/v2/PayoutsDashboard.js.map +1 -1
  24. package/dist/v2/RefundsDashboard.js +14 -18
  25. package/dist/v2/RefundsDashboard.js.map +1 -1
  26. package/dist/v2/SplitTransfersDashboard.js +17 -21
  27. package/dist/v2/SplitTransfersDashboard.js.map +1 -1
  28. package/dist/v2/StripeConnect.js +1 -0
  29. package/dist/v2/StripeConnect.js.map +1 -1
  30. package/dist/v2/TaxesDashboard.js +21 -16
  31. package/dist/v2/TaxesDashboard.js.map +1 -1
  32. package/dist/v2/index.js +0 -1
  33. package/dist/v2/index.js.map +1 -1
  34. package/package.json +15 -15
package/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # NeetoPaymentsNano
2
2
 
3
- The `neeto-payments-nano` is a comprehensive payment processing solution
4
- designed for the Neeto ecosystem. Implemented as a Ruby on Rails engine with
5
- associated React frontend components (`@bigbinary/neeto-payments-frontend`), it
6
- provides a unified interface for managing payments across different providers,
7
- abstracting away provider-specific complexities.
3
+ The `neeto-payments-nano` is a comprehensive payment processing solution designed for the Neeto ecosystem. Implemented
4
+ as a Ruby on Rails engine with associated React frontend components (`@bigbinary/neeto-payments-frontend`), it provides
5
+ a unified interface for managing payments across different providers, abstracting away provider-specific complexities.
8
6
 
9
7
  This engine enables host applications to:
10
8
 
@@ -14,8 +12,7 @@ This engine enables host applications to:
14
12
  - Manage refunds.
15
13
  - Store and reuse payment methods securely (optional).
16
14
  - Configure fee structures and apply taxes/discounts.
17
- - Provide administrative dashboards for monitoring transactions, refunds,
18
- payouts, and accounts.
15
+ - Provide administrative dashboards for monitoring transactions, refunds, payouts, and accounts.
19
16
 
20
17
  # Table of Contents
21
18
 
@@ -60,8 +57,7 @@ This engine enables host applications to:
60
57
 
61
58
  ## Installation (Backend Engine)
62
59
 
63
- Follow these steps to integrate the `neeto-payments-engine` into your host Rails
64
- application:
60
+ Follow these steps to integrate the `neeto-payments-engine` into your host Rails application:
65
61
 
66
62
  ### 1. Add the Gem
67
63
 
@@ -84,8 +80,7 @@ bundle install
84
80
 
85
81
  ### 3. Install Migrations
86
82
 
87
- Copy the engine's database migrations into your host application. **This step is
88
- crucial.**
83
+ Copy the engine's database migrations into your host application. **This step is crucial.**
89
84
 
90
85
  ```bash
91
86
  bundle exec rails neeto_payments_engine:install:migrations
@@ -110,16 +105,14 @@ mount NeetoPaymentsEngine::Engine, at: "/payments" # Or your preferred mount poi
110
105
 
111
106
  This makes the engine's API endpoints available, by default under `/payments`.
112
107
 
113
- Once the installation is done, we have to do some configuration for the engine
114
- to work as intended. Please go through the whole README to complete the process
115
- of setting up `neeto-payments-nano` in your host app.
108
+ Once the installation is done, we have to do some configuration for the engine to work as intended. Please go through
109
+ the whole README to complete the process of setting up `neeto-payments-nano` in your host app.
116
110
 
117
111
  ## Configuration (Backend Engine)
118
112
 
119
113
  ### 1. Initializer
120
114
 
121
- Create an initializer file `config/initializers/neeto_payments_engine.rb` to
122
- configure the engine:
115
+ Create an initializer file `config/initializers/neeto_payments_engine.rb` to configure the engine:
123
116
 
124
117
  ```ruby
125
118
  # config/initializers/neeto_payments_engine.rb
@@ -136,22 +129,18 @@ NeetoPaymentsEngine.providers_holdable_class = {
136
129
  }
137
130
  ```
138
131
 
139
- - **`providers_holdable_class`:** This hash maps each payment provider type
140
- supported by the engine to the class name (as a String) of the model in your
141
- host application that will "hold" or own the integration for that provider.
142
- The engine uses polymorphic associations (`holdable_type`, `holdable_id`)
143
- based on this setting to link payment provider accounts (like
144
- `Stripe::Account`, `Integrations::Razorpay`) to your application's models.
145
- Failing to configure this correctly will result in errors when the engine
146
- attempts to find or create payment provider integrations. Example: In NeetoCal
147
- each `User` can connect their own `stripe_standard` account, but in NeetoPay,
148
- only one `stripe_standard` account can exist in an `Organization`.
132
+ - **`providers_holdable_class`:** This hash maps each payment provider type supported by the engine to the class name
133
+ (as a String) of the model in your host application that will "hold" or own the integration for that provider. The
134
+ engine uses polymorphic associations (`holdable_type`, `holdable_id`) based on this setting to link payment provider
135
+ accounts (like `Stripe::Account`, `Integrations::Razorpay`) to your application's models. Failing to configure this
136
+ correctly will result in errors when the engine attempts to find or create payment provider integrations. Example: In
137
+ NeetoCal each `User` can connect their own `stripe_standard` account, but in NeetoPay, only one `stripe_standard`
138
+ account can exist in an `Organization`.
149
139
 
150
140
  ### 2. Model Associations
151
141
 
152
- Ensure the models specified in `providers_holdable_class` have the correct
153
- `has_one` or `has_many` associations defined to link to the engine's integration
154
- models. Adapt the following examples based on your configuration:
142
+ Ensure the models specified in `providers_holdable_class` have the correct `has_one` or `has_many` associations defined
143
+ to link to the engine's integration models. Adapt the following examples based on your configuration:
155
144
 
156
145
  ```ruby
157
146
  # app/models/organization.rb (Example if Organization is a holdable)
@@ -187,9 +176,8 @@ class User < ApplicationRecord
187
176
  end
188
177
  ```
189
178
 
190
- Add associations to your **Payable** models (e.g., `Invoice`, `Booking`,
191
- `Meeting` - the item being paid for) - you don't need to add this until you
192
- create your `Payable` models in your host app:
179
+ Add associations to your **Payable** models (e.g., `Invoice`, `Booking`, `Meeting` - the item being paid for) - you
180
+ don't need to add this until you create your `Payable` models in your host app:
193
181
 
194
182
  ```ruby
195
183
  # app/models/invoice.rb (Example Payable Model)
@@ -204,13 +192,12 @@ end
204
192
 
205
193
  ### 3. Secrets and Credentials
206
194
 
207
- Configure API keys and secrets securely using environment variables and secrets
208
- file.
195
+ Configure API keys and secrets securely using environment variables and secrets file.
209
196
 
210
197
  **Essential ENV variables for `neeto-payments-engine`:**
211
198
 
212
- - **`.env.development` (Commit this file):** Contains non-sensitive defaults,
213
- placeholders, or development-specific configurations.
199
+ - **`.env.development` (Commit this file):** Contains non-sensitive defaults, placeholders, or development-specific
200
+ configurations.
214
201
 
215
202
  ```dotenv
216
203
  # .env.development
@@ -229,9 +216,8 @@ file.
229
216
  RAZORPAY_CALLBACK_BASE_URL="https://connect.tunnelto.dev" # Or your tunnel URL
230
217
  ```
231
218
 
232
- - **`.env.local` (Add this file to `.gitignore` - DO NOT COMMIT):** Contains
233
- sensitive API keys, secrets, and private keys. This file overrides values in
234
- `.env.development`.
219
+ - **`.env.local` (Add this file to `.gitignore` - DO NOT COMMIT):** Contains sensitive API keys, secrets, and private
220
+ keys. This file overrides values in `.env.development`.
235
221
 
236
222
  ```dotenv
237
223
  # .env.local (DO NOT COMMIT THIS FILE)
@@ -265,8 +251,8 @@ file.
265
251
  # OPEN_EXCHANGE_RATE_API_KEY="your_actual_key" # Sensitive API key
266
252
  ```
267
253
 
268
- **Loading Secrets:** Ensure these secrets are loaded into
269
- `Rails.application.vault`. An example `config/secrets.yml` structure:
254
+ **Loading Secrets:** Ensure these secrets are loaded into `Rails.application.vault`. An example `config/secrets.yml`
255
+ structure:
270
256
 
271
257
  ```yaml
272
258
  # config/secrets.yml
@@ -309,37 +295,32 @@ file.
309
295
  - **Development:** Use `.env.local` (which is typically gitignored) to store
310
296
  sensitive keys locally.
311
297
  - **Staging/Production:** Use environment variables managed by your deployment
312
- platform (e.g., NeetoDeploy, Heroku Config Vars) or Rails encrypted
298
+ platform (e.g., NeetoDeploy) or Rails encrypted
313
299
  credentials. **Do not commit secrets directly into your repository.**
314
300
 
315
301
  ### 4. Stripe Connect Signup
316
302
 
317
- You **must** sign up for Stripe Connect via the Stripe dashboard, even if you
318
- only intend to use a Stripe Platform account. This registration enables the
319
- necessary APIs for account management and OAuth flows used by the engine.
303
+ You **must** sign up for Stripe Connect via the Stripe dashboard, even if you only intend to use a Stripe Platform
304
+ account. This registration enables the necessary APIs for account management and OAuth flows used by the engine.
320
305
 
321
306
  ### 5. OAuth Callback URI Registration
322
307
 
323
- Register the following callback URIs in your respective payment provider
324
- dashboards:
308
+ Register the following callback URIs in your respective payment provider dashboards:
325
309
 
326
- - **Stripe:**
327
- `https://<your_connect_subdomain_or_app_domain>/payments/api/v1/public/stripe/oauth/callback`
310
+ - **Stripe:** `https://<your_connect_subdomain_or_app_domain>/payments/api/v1/public/stripe/oauth/callback`
328
311
  - `<your_connect_subdomain_or_app_domain>`: This should be the publicly
329
312
  accessible URL that routes to your Rails app. In development, this is
330
313
  typically your `tunnelto` URL using the `connect` subdomain (e.g.,
331
314
  `https://connect.tunnelto.dev`). In production, it might be your main
332
315
  application domain or a dedicated subdomain.
333
- - **Razorpay:**
334
- `https://<your_razorpay_oauth_base_url>/payments/api/v1/public/razorpay/oauth/callback`
316
+ - **Razorpay:** `https://<your_razorpay_oauth_base_url>/payments/api/v1/public/razorpay/oauth/callback`
335
317
  - `<your_razorpay_oauth_base_url>`: This must match the value you configured
336
318
  for `RAZORPAY_OAUTH_CALLBACK_BASE_URL`. Use the `connect` subdomain via
337
319
  `tunnelto` in development.
338
320
 
339
321
  ## Frontend Integration
340
322
 
341
- Integrate the React components provided by the
342
- `@bigbinary/neeto-payments-frontend` package.
323
+ Integrate the React components provided by the `@bigbinary/neeto-payments-frontend` package.
343
324
 
344
325
  ### 1. Install Frontend Package
345
326
 
@@ -349,9 +330,8 @@ yarn add @bigbinary/neeto-payments-frontend
349
330
 
350
331
  ### 2. Install Peer Dependencies
351
332
 
352
- If the host app already includes all of the following peer deps, then you don't
353
- have to install anything explicitly. Use the latest version of each of these
354
- peer dependencies if you need to install:
333
+ If the host app already includes all of the following peer deps, then you don't have to install anything explicitly. Use
334
+ the latest version of each of these peer dependencies if you need to install:
355
335
 
356
336
  ```bash
357
337
  # DO NOT INSTALL THE VERSIONS MENTIONED BELOW AS IT MIGHT BE OUTDATED.
@@ -647,8 +627,7 @@ Import components into your React application as needed.
647
627
  1. `useStripePromise`
648
628
  ([source code](https://github.com/bigbinary/neeto-payments-nano/blob/main/app/javascript/src/hooks/useStripePromise.js))
649
629
 
650
- This hook can used to provide the value for the `stripe` prop of the Stripe
651
- `Element` component.
630
+ This hook can used to provide the value for the `stripe` prop of the Stripe `Element` component.
652
631
 
653
632
  **Usage**
654
633
 
@@ -674,9 +653,8 @@ Import components into your React application as needed.
674
653
  2. `useRazorpayPayment`
675
654
  ([source code](https://github.com/bigbinary/neeto-payments-nano/blob/main/app/javascript/src/hooks/useRazorpayPayment.js))
676
655
 
677
- This hook returns a function that can be used to initiate a Razorpay payment.
678
- Use it only if you want to trigger the payment flow through a custom button
679
- in the host application.
656
+ This hook returns a function that can be used to initiate a Razorpay payment. Use it only if you want to trigger the
657
+ payment flow through a custom button in the host application.
680
658
 
681
659
  **Usage**
682
660
 
@@ -699,16 +677,15 @@ Import components into your React application as needed.
699
677
 
700
678
  1. CURRENCY_OPTIONS
701
679
 
702
- A list of supported currencies in `{ value, label }` format. This can be used
703
- as options for the NeetoUI `Select` component.
680
+ A list of supported currencies in `{ value, label }` format. This can be used as options for the NeetoUI `Select`
681
+ component.
704
682
 
705
683
  ### 6. utils
706
684
 
707
685
  1. `getFormattedAmount({ amount, taxes=[], isTaxEnabled = false})`
708
686
 
709
- Returns the final amount as a **string**, truncated to **2 decimal places**,
710
- after applying taxes if `isTaxEnabled` is set to `true` and taxes are
711
- present.
687
+ Returns the final amount as a **string**, truncated to **2 decimal places**, after applying taxes if `isTaxEnabled`
688
+ is set to `true` and taxes are present.
712
689
 
713
690
  #### Parameter keys
714
691
 
@@ -730,8 +707,7 @@ Import components into your React application as needed.
730
707
 
731
708
  1. `getFormattedTaxAmount({ amount, taxes=[]})`
732
709
 
733
- Returns the total tax amount as a **string**, truncated to **2 decimal
734
- places**
710
+ Returns the total tax amount as a **string**, truncated to **2 decimal places**
735
711
 
736
712
  #### Parameter keys
737
713
 
@@ -849,11 +825,9 @@ export default PaymentSettingsPage;
849
825
 
850
826
  ### 4. API Calls - Specify Providers
851
827
 
852
- When calling the `/api/v1/integrations` endpoint (or other APIs that might
853
- implicitly check integrations), **you must pass the `providers` parameter**
854
- listing only the providers your application uses. Omitting this or including
855
- unused providers can lead to errors if the engine tries to load configurations
856
- or associations that don't exist for your setup.
828
+ When calling the `/api/v1/integrations` endpoint (or other APIs that might implicitly check integrations), **you must
829
+ pass the `providers` parameter** listing only the providers your application uses. Omitting this or including unused
830
+ providers can lead to errors if the engine tries to load configurations or associations that don't exist for your setup.
857
831
 
858
832
  ```javascript
859
833
  // Correct: Fetching only Stripe Standard integration status
@@ -867,19 +841,15 @@ axios.get("/payments/api/v1/integrations", {
867
841
 
868
842
  ## Core Concepts
869
843
 
870
- - **Polymorphic Associations:** `payable` (what's being paid for), `accountable`
871
- (the payment account, e.g., `Stripe::Account`), and `holdable` (owner of the
872
- integration, e.g., `Organization`) link the engine to host app models
844
+ - **Polymorphic Associations:** `payable` (what's being paid for), `accountable` (the payment account, e.g.,
845
+ `Stripe::Account`), and `holdable` (owner of the integration, e.g., `Organization`) link the engine to host app models
873
846
  dynamically based on configuration.
874
- - **Single Table Inheritance (STI):** Used for provider-specific models like
875
- `Payments::Stripe`, `Payments::Razorpay`, `Integrations::Razorpay`.
876
- - **Service Objects:** Encapsulate business logic (e.g.,
877
- `Stripe::Payments::CreateService`).
878
- - **Callbacks:** Host applications implement methods in
879
- `NeetoPaymentsEngine::Callbacks` to customize behavior. See the
847
+ - **Single Table Inheritance (STI):** Used for provider-specific models like `Payments::Stripe`, `Payments::Razorpay`,
848
+ `Integrations::Razorpay`.
849
+ - **Service Objects:** Encapsulate business logic (e.g., `Stripe::Payments::CreateService`).
850
+ - **Callbacks:** Host applications implement methods in `NeetoPaymentsEngine::Callbacks` to customize behavior. See the
880
851
  [Callbacks](#callbacks) section.
881
- - **Webhooks:** Asynchronous events from providers update payment statuses. See
882
- [Webhook Handling](#webhook-handling).
852
+ - **Webhooks:** Asynchronous events from providers update payment statuses. See [Webhook Handling](#webhook-handling).
883
853
  - **JWT Authentication:** Secures OAuth callback flows using RSA keys.
884
854
 
885
855
  ## Webhook Handling
@@ -892,13 +862,10 @@ axios.get("/payments/api/v1/integrations", {
892
862
 
893
863
  #### 1. Tunneling
894
864
 
895
- Use a tool like `ngrok` or `tunnelto` to expose your local development server to
896
- the internet. The `connect` subdomain is reserved within Neeto for receiving
897
- callbacks from third-party services. Refer to
898
- [Using Tunnelto](https://neeto-engineering.neetokb.com/articles/using-tunnelto)
899
- and
900
- [Exposing Tunnelto Locally](https://neeto-engineering.neetokb.com/articles/writing-payment-tests)
901
- for more details.
865
+ Use a tool like `ngrok` or `tunnelto` to expose your local development server to the internet. The `connect` subdomain
866
+ is reserved within Neeto for receiving callbacks from third-party services. Refer to
867
+ [Using Tunnelto](https://neeto-engineering.neetokb.com/articles/using-tunnelto) and
868
+ [Exposing Tunnelto Locally](https://neeto-engineering.neetokb.com/articles/writing-payment-tests) for more details.
902
869
 
903
870
  ```bash
904
871
  # Example using tunnelto
@@ -910,22 +877,17 @@ tunnelto --subdomain connect --port <YOUR_RAILS_APP_PORT>
910
877
 
911
878
  - Go to your **Stripe Test Dashboard** > Developers > Webhooks.
912
879
  - Click "Add endpoint".
913
- - Endpoint URL:
914
- `https://connect.tunnelto.dev/payments/api/v1/public/stripe/webhooks` (replace
915
- with your actual tunnel URL).
916
- - Select events to listen to. Refer to `config/stripe/webhooks.yml` in the
917
- engine for the required list (e.g., `payment_intent.succeeded`,
918
- `charge.refunded`, `account.updated`).
880
+ - Endpoint URL: `https://connect.tunnelto.dev/payments/api/v1/public/stripe/webhooks` (replace with your actual tunnel
881
+ URL).
882
+ - Select events to listen to. Refer to `config/stripe/webhooks.yml` in the engine for the required list (e.g.,
883
+ `payment_intent.succeeded`, `charge.refunded`, `account.updated`).
919
884
  - Click "Add endpoint".
920
885
  - After creation, find the **Signing secret** (starts with `whsec_...`).
921
- - **Copy this secret** and set it as the `STRIPE_WEBHOOK_SECRET` in your local
922
- `.env.local` or development credentials.
923
- - **Note:** The `neeto_payments_engine:stripe:webhooks:subscribe` rake task is
924
- **not recommended** for development setup as it doesn't create the endpoint
925
- and might show outdated secrets. Manual setup provides better control and
926
- ensures you have the correct, current secret. Refer to the
927
- [Official Stripe Webhook Documentation](https://docs.stripe.com/webhooks) for
928
- more details.
886
+ - **Copy this secret** and set it as the `STRIPE_WEBHOOK_SECRET` in your local `.env.local` or development credentials.
887
+ - **Note:** The `neeto_payments_engine:stripe:webhooks:subscribe` rake task is **not recommended** for development setup
888
+ as it doesn't create the endpoint and might show outdated secrets. Manual setup provides better control and ensures
889
+ you have the correct, current secret. Refer to the
890
+ [Official Stripe Webhook Documentation](https://docs.stripe.com/webhooks) for more details.
929
891
 
930
892
  #### 3. Razorpay Webhook Setup (Manual)
931
893
 
@@ -933,32 +895,24 @@ tunnelto --subdomain connect --port <YOUR_RAILS_APP_PORT>
933
895
  - Go to Applications
934
896
  - Create a new application or open the existing application
935
897
  - Add test webhook
936
- - Webhook URL:
937
- `https://connect.tunnelto.dev/payments/api/v1/public/razorpay/webhooks`
938
- (replace with your tunnel URL).
898
+ - Webhook URL: `https://connect.tunnelto.dev/payments/api/v1/public/razorpay/webhooks` (replace with your tunnel URL).
939
899
  - Set a **Secret** (create a strong random string).
940
- - Select Active Events (e.g., `payment.authorized`, `payment.captured`,
941
- `payment.failed`, `refund.processed`, `refund.failed`).
900
+ - Select Active Events (e.g., `payment.authorized`, `payment.captured`, `payment.failed`, `refund.processed`,
901
+ `refund.failed`).
942
902
  - Save the webhook.
943
- - **Copy the Secret you set** and configure it as `RAZORPAY_WEBHOOK_SECRET` in
944
- your local development environment.
903
+ - **Copy the Secret you set** and configure it as `RAZORPAY_WEBHOOK_SECRET` in your local development environment.
945
904
 
946
905
  ## Authentication (JWT for OAuth)
947
906
 
948
907
  - Secures the OAuth callback flow for connecting Stripe/Razorpay accounts.
949
- - Uses RSA public/private keys (`CONNECT_PUBLIC_KEY`, `CONNECT_PRIVATE_KEY`)
950
- configured in your secrets.
951
- - The `ConnectLinkService` creates a short-lived JWT containing user context
952
- when initiating the OAuth flow.
953
- - The `JwtService` verifies the token signature using the public key upon
954
- callback.
908
+ - Uses RSA public/private keys (`CONNECT_PUBLIC_KEY`, `CONNECT_PRIVATE_KEY`) configured in your secrets.
909
+ - The `ConnectLinkService` creates a short-lived JWT containing user context when initiating the OAuth flow.
910
+ - The `JwtService` verifies the token signature using the public key upon callback.
955
911
 
956
912
  ## Callbacks
957
913
 
958
- Host applications **must** implement specific methods within a
959
- `NeetoPaymentsEngine::Callbacks` module (e.g., in
960
- `app/lib/neeto_payments_engine/callbacks.rb`) to tailor the engine's behavior to
961
- their domain logic.
914
+ Host applications **must** implement specific methods within a `NeetoPaymentsEngine::Callbacks` module (e.g., in
915
+ `app/lib/neeto_payments_engine/callbacks.rb`) to tailor the engine's behavior to their domain logic.
962
916
 
963
917
  ### Mandatory Callbacks
964
918
 
@@ -1150,22 +1104,18 @@ end
1150
1104
 
1151
1105
  ## Exposed Entities
1152
1106
 
1153
- The engine exposes various models, services, jobs, and tasks for integration and
1154
- extension:
1155
-
1156
- - **Models:** `Payment`, `Fee`, `Refund`, `Split`, `Payments::Split`,
1157
- `Stripe::Account`, `Stripe::PlatformAccount`, `Integration`, `Customer`,
1158
- `PaymentMethod`, `Payout`, `WebhookEvent`, etc. Host apps primarily interact
1159
- with these through ActiveRecord associations defined on their own models.
1160
- - **Services:** Encapsulate core logic (e.g., `Stripe::Payments::CreateService`,
1161
- `Razorpay::Accounts::CreateService`, `SplitTransfersFilterService`,
1162
- `ExportCsvService`). While mostly used internally, filter and export services
1163
- might be invoked directly or indirectly via controllers.
1164
- - **Jobs:** Handle background tasks (`Stripe::WebhooksJob`,
1165
- `StripePlatform::CreatePaymentSplitsJob`, `ExportCsvJob`,
1107
+ The engine exposes various models, services, jobs, and tasks for integration and extension:
1108
+
1109
+ - **Models:** `Payment`, `Fee`, `Refund`, `Split`, `Payments::Split`, `Stripe::Account`, `Stripe::PlatformAccount`,
1110
+ `Integration`, `Customer`, `PaymentMethod`, `Payout`, `WebhookEvent`, etc. Host apps primarily interact with these
1111
+ through ActiveRecord associations defined on their own models.
1112
+ - **Services:** Encapsulate core logic (e.g., `Stripe::Payments::CreateService`, `Razorpay::Accounts::CreateService`,
1113
+ `SplitTransfersFilterService`, `ExportCsvService`). While mostly used internally, filter and export services might be
1114
+ invoked directly or indirectly via controllers.
1115
+ - **Jobs:** Handle background tasks (`Stripe::WebhooksJob`, `StripePlatform::CreatePaymentSplitsJob`, `ExportCsvJob`,
1166
1116
  `CreatePaymentMethodDomainJob`). These are queued and processed by Sidekiq.
1167
- - **Concerns:** Reusable modules (`Amountable`, `PaymentProcessable`, `Taxable`,
1168
- `Stripe::Accountable`, `Refundable`). Mostly for internal engine use.
1117
+ - **Concerns:** Reusable modules (`Amountable`, `PaymentProcessable`, `Taxable`, `Stripe::Accountable`, `Refundable`).
1118
+ Mostly for internal engine use.
1169
1119
  - **Rake Tasks:**
1170
1120
  - `neeto_payments_engine:stripe:account:integrate`: Seeds a sample Stripe
1171
1121
  connected account. **Development/Testing only.**
@@ -1175,8 +1125,7 @@ extension:
1175
1125
 
1176
1126
  ## API Endpoints
1177
1127
 
1178
- The engine exposes several API endpoints under the configured mount path
1179
- (default `/payments`). Here are some key ones:
1128
+ The engine exposes several API endpoints under the configured mount path (default `/payments`). Here are some key ones:
1180
1129
 
1181
1130
  | Method | Path | Description | Authentication |
1182
1131
  | :----- | :------------------------------------------------ | :----------------------------------------------------------------------- | :------------- |
@@ -1223,17 +1172,14 @@ The engine exposes several API endpoints under the configured mount path
1223
1172
  | POST | `/api/v1/public/razorpay/webhooks` | Razorpay webhook receiver endpoint. | Razorpay Sig. |
1224
1173
  | POST | `/api/v1/public/stripe_platform/webhooks` | Stripe Platform webhook receiver endpoint. | Stripe Sig. |
1225
1174
 
1226
- _Note: "Host App Auth" means the endpoint relies on the host application's
1227
- authentication (e.g., `authenticate_user!`). "JWT" means authentication relies
1228
- on the JWT generated during the OAuth flow. "Open" means no authentication.
1229
- "Stripe Sig." / "Razorpay Sig." means verification is done via webhook
1230
- signatures._
1175
+ _Note: "Host App Auth" means the endpoint relies on the host application's authentication (e.g., `authenticate_user!`).
1176
+ "JWT" means authentication relies on the JWT generated during the OAuth flow. "Open" means no authentication. "Stripe
1177
+ Sig." / "Razorpay Sig." means verification is done via webhook signatures._
1231
1178
 
1232
1179
  ## Incineration Concern
1233
1180
 
1234
- If your host application uses `neeto-org-incineration-engine`, you need to
1235
- integrate `NeetoPaymentsEngine` models correctly. The `NeetoPaymentsEngine::Fee`
1236
- model often requires special handling as it might be associated with host
1181
+ If your host application uses `neeto-org-incineration-engine`, you need to integrate `NeetoPaymentsEngine` models
1182
+ correctly. The `NeetoPaymentsEngine::Fee` model often requires special handling as it might be associated with host
1237
1183
  application models (`feeable`).
1238
1184
 
1239
1185
  1. **Initial Setup:** When first adding `neeto-payments-engine`, add
@@ -1283,8 +1229,7 @@ application models (`feeable`).
1283
1229
 
1284
1230
  ## Deprecated Patterns
1285
1231
 
1286
- Please be aware of the following deprecations and use the recommended
1287
- alternatives:
1232
+ Please be aware of the following deprecations and use the recommended alternatives:
1288
1233
 
1289
1234
  1. **Configuration `holdable_class`:**
1290
1235
 
@@ -1317,8 +1262,7 @@ alternatives:
1317
1262
 
1318
1263
  ## Development Environment Setup
1319
1264
 
1320
- To run the engine locally integrated with a host application, ensure the
1321
- following processes are running:
1265
+ To run the engine locally integrated with a host application, ensure the following processes are running:
1322
1266
 
1323
1267
  1. **Rails Server:** Starts the main web application.
1324
1268
  ```bash
@@ -1354,9 +1298,8 @@ worker: bundle exec sidekiq -e development -C config/sidekiq.yml
1354
1298
 
1355
1299
  ## Helper methods
1356
1300
 
1357
- - `currency_format_with_symbol` This helper method converts a currency code
1358
- (like "INR" or "USD") into its corresponding symbol and returns the formatted
1359
- amount with the symbol. Example $10.00.
1301
+ - `currency_format_with_symbol` This helper method converts a currency code (like "INR" or "USD") into its corresponding
1302
+ symbol and returns the formatted amount with the symbol. Example $10.00.
1360
1303
 
1361
1304
  Usage in host application:
1362
1305
 
@@ -1392,11 +1335,9 @@ worker: bundle exec sidekiq -e development -C config/sidekiq.yml
1392
1335
 
1393
1336
  ## Testing & Debugging
1394
1337
 
1395
- - **Dummy App:** Use the `test/dummy` app within the engine's repository for
1396
- isolated testing.
1397
- - **Test Helpers:** Utilize `NeetoPaymentsEngine::TestHelpers` (includes
1398
- `HttpRequestHelpers`) for stubbing API calls to Stripe/Razorpay
1399
- (`test/helpers/http_request_helpers/`).
1338
+ - **Dummy App:** Use the `test/dummy` app within the engine's repository for isolated testing.
1339
+ - **Test Helpers:** Utilize `NeetoPaymentsEngine::TestHelpers` (includes `HttpRequestHelpers`) for stubbing API calls to
1340
+ Stripe/Razorpay (`test/helpers/http_request_helpers/`).
1400
1341
  - **Stripe Test Cards:**
1401
1342
  - Valid Card: `4242 4242 4242 4242`
1402
1343
  - Declined Card: `4000 0000 0000 0002`
@@ -1406,41 +1347,31 @@ worker: bundle exec sidekiq -e development -C config/sidekiq.yml
1406
1347
  - [More Stripe Test Cards](https://docs.stripe.com/testing)
1407
1348
  - **Razorpay Test Cards/UPI:** Refer to
1408
1349
  [Razorpay Testing Docs](https://razorpay.com/docs/payments/payments/test-card-details/).
1409
- - **Logging:** Check Rails logs (`log/development.log`) for detailed output from
1410
- the engine's `LogActivityHelper`.
1411
- - **Provider Dashboards:** Use the Stripe and Razorpay **Test Mode** dashboards
1412
- to view API logs, payment details, webhook attempts, and specific error
1413
- messages.
1414
- - **JWT Debugging:** Use tools like [jwt.io](https://jwt.io) to decode JWTs
1415
- generated during OAuth flows. Paste the token and the **public key**
1416
- (`CONNECT_PUBLIC_KEY`) to verify the signature and inspect the payload (check
1417
- `exp` claim for expiry).
1350
+ - **Logging:** Check Rails logs (`log/development.log`) for detailed output from the engine's `LogActivityHelper`.
1351
+ - **Provider Dashboards:** Use the Stripe and Razorpay **Test Mode** dashboards to view API logs, payment details,
1352
+ webhook attempts, and specific error messages.
1353
+ - **JWT Debugging:** Use tools like [jwt.io](https://jwt.io) to decode JWTs generated during OAuth flows. Paste the
1354
+ token and the **public key** (`CONNECT_PUBLIC_KEY`) to verify the signature and inspect the payload (check `exp` claim
1355
+ for expiry).
1418
1356
 
1419
1357
  ## Gotchas & Tips
1420
1358
 
1421
- - **`providers_holdable_class` is Mandatory:** Forgetting to configure this in
1422
- the initializer will lead to errors when the engine tries to find associated
1423
- accounts.
1424
- - **Specify `providers` in API Calls:** When calling `/api/v1/integrations`,
1425
- always pass the `providers` param listing only the providers you actually use
1426
- in your host app (e.g., `params: { providers: ["stripe_standard"] }`). Failing
1427
- to do so might cause errors if the engine tries to load an unconfigured
1428
- provider (like UPI).
1429
- - **Stripe Connect Signup:** You _must_ complete the Stripe Connect signup
1430
- process in your Stripe account, even for platform-only usage.
1431
- - **Webhook Secrets in Dev:** Manually created webhook endpoint secrets from
1432
- Stripe/Razorpay dashboards are the source of truth for development, not
1433
- necessarily what rake tasks might print.
1434
- - **JWT Key Security:** Treat your JWT private key with the same security as
1435
- your API secret keys.
1436
- - **Migration Order:** Always run
1437
- `bundle exec rails neeto_payments_engine:install:migrations` _before_
1438
- `db:migrate` when setting up or upgrading. We also need to run this rake task
1439
- and migration after we run `./bin/setup` in the host app.
1359
+ - **`providers_holdable_class` is Mandatory:** Forgetting to configure this in the initializer will lead to errors when
1360
+ the engine tries to find associated accounts.
1361
+ - **Specify `providers` in API Calls:** When calling `/api/v1/integrations`, always pass the `providers` param listing
1362
+ only the providers you actually use in your host app (e.g., `params: { providers: ["stripe_standard"] }`). Failing to
1363
+ do so might cause errors if the engine tries to load an unconfigured provider (like UPI).
1364
+ - **Stripe Connect Signup:** You _must_ complete the Stripe Connect signup process in your Stripe account, even for
1365
+ platform-only usage.
1366
+ - **Webhook Secrets in Dev:** Manually created webhook endpoint secrets from Stripe/Razorpay dashboards are the source
1367
+ of truth for development, not necessarily what rake tasks might print.
1368
+ - **JWT Key Security:** Treat your JWT private key with the same security as your API secret keys.
1369
+ - **Migration Order:** Always run `bundle exec rails neeto_payments_engine:install:migrations` _before_ `db:migrate`
1370
+ when setting up or upgrading. We also need to run this rake task and migration after we run `./bin/setup` in the host
1371
+ app.
1440
1372
 
1441
1373
  ## Publishing
1442
1374
 
1443
- For instructions on building and releasing the
1444
- `@bigbinary/neeto-payments-frontend` NPM package and the `neeto-payments-engine`
1445
- Ruby gem, please refer to the internal guide:
1375
+ For instructions on building and releasing the `@bigbinary/neeto-payments-frontend` NPM package and the
1376
+ `neeto-payments-engine` Ruby gem, please refer to the internal guide:
1446
1377
  [Building and Releasing Packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages).
@@ -22,7 +22,6 @@ var renderFunctions = require('../renderFunctions-DJ3I4O4j.js');
22
22
  var CopyButtonWrapper = require('../CopyButtonWrapper-CXzqqYIp.js');
23
23
  var constants$1 = require('neetocommons/constants');
24
24
  var Columns = require('@bigbinary/neeto-molecules/v2/Columns');
25
- var TableWrapper = require('@bigbinary/neeto-molecules/v2/TableWrapper');
26
25
  var useAccountsApi = require('../useAccountsApi-DWA5G-if.js');
27
26
  require('@tanstack/react-query');
28
27
  require('@tanstack/react-query-devtools');
@@ -348,28 +347,25 @@ const List = ({
348
347
  })
349
348
  });
350
349
  }
351
- return /*#__PURE__*/jsxRuntime.jsx(TableWrapper, {
352
- hasPagination: dataSize > pageProperties[tab]?.pageSize,
353
- children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DataTable, {
354
- allowRowClick: false,
355
- columns: customizedColumns,
356
- currentPage: pageProperties[tab]?.page,
357
- data: dashboard.buildRowData({
358
- data: accounts,
359
- pageProperties,
360
- tab
361
- }),
362
- enableURLPagination: false,
363
- enableURLSort: false,
364
- loading: isFetching || isTableConfigurationLoading,
365
- totalCount: dataSize,
366
- onColumnHide: id => hideColumn(id),
367
- onPageChange: page => handleTablePagination(page, pageProperties[tab]?.pageSize),
368
- onSort: sort => sort ? setSortProperties({
369
- sortBy: neetocist.camelToSnakeCase(sort.field),
370
- orderBy: sort.order === "ascend" ? "ASC" : "DESC"
371
- }) : setSortProperties(constants.DEFAULT_SORT_PROPERTIES)
372
- })
350
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DataTable, {
351
+ allowRowClick: false,
352
+ columns: customizedColumns,
353
+ currentPage: pageProperties[tab]?.page,
354
+ data: dashboard.buildRowData({
355
+ data: accounts,
356
+ pageProperties,
357
+ tab
358
+ }),
359
+ enableURLPagination: false,
360
+ enableURLSort: false,
361
+ loading: isFetching || isTableConfigurationLoading,
362
+ totalCount: dataSize,
363
+ onColumnHide: id => hideColumn(id),
364
+ onPageChange: page => handleTablePagination(page, pageProperties[tab]?.pageSize),
365
+ onSort: sort => sort ? setSortProperties({
366
+ sortBy: neetocist.camelToSnakeCase(sort.field),
367
+ orderBy: sort.order === "ascend" ? "ASC" : "DESC"
368
+ }) : setSortProperties(constants.DEFAULT_SORT_PROPERTIES)
373
369
  });
374
370
  };
375
371