Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enable stripe connect in invoice settings#396

Merged
apoorv-mishra merged 22 commits intodevelopfrom
invoice-settings
Jun 2, 2022
Merged

Enable stripe connect in invoice settings#396
apoorv-mishra merged 22 commits intodevelopfrom
invoice-settings

Conversation

@apoorv-mishra
Copy link
Contributor

Notion card

https://saeloun.notion.site/Setting-on-invoice-for-payment-Backend-8c6fc57d900f4110b4a971cc6364ed55

Summary

Preview

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • I have manually tested all workflows
  • I have performed a self-review of my own code
  • I have added automated tests for my code

@pr-triage pr-triage bot added the PR: draft label May 20, 2022
@github-actions
Copy link

github-actions bot commented May 20, 2022

Current Code Coverage Percent of this PR:

84.55 %

Files having coverage below 100%

Impacted Files Coverage
/app/controllers/subscriptions_controller.rb 66.67 %
/app/controllers/invoices_controller.rb 57.14 %
/app/models/invoice.rb 96.3 %
/app/policies/timezone_policy.rb 66.67 %
/app/policies/subscriptions_policy.rb 66.67 %
/app/policies/client_policy.rb 95.45 %
/app/policies/invoice_policy.rb 94.12 %
/app/controllers/invoices/payments_controller.rb 61.11 %
/app/services/report/filters.rb 87.88 %
/app/services/invoice_payment/checkout.rb 44.0 %
/app/services/invoice_payment/pdf_generation.rb 70.97 %
/app/controllers/internal_api/v1/timezones_controller.rb 37.5 %
/app/controllers/internal_api/v1/payment_settings_controller.rb 93.33 %
/app/controllers/internal_api/v1/clients_controller.rb 94.44 %
/app/controllers/internal_api/v1/invoices_controller.rb 94.87 %
/app/controllers/internal_api/v1/payments/providers_controller.rb 95.45 %
/lib/benchmarking/benchmarker.rb 0.0 %
/lib/countries_info.rb 0.0 %

@vipulnsward
Copy link
Contributor

@apoorv-mishra what is pending on this? Need this so we can accept client payments. Freshbooks costs us 600$ per month

@apoorv-mishra
Copy link
Contributor Author

apoorv-mishra commented May 24, 2022

Stripe connect and checkout is already integrated. We should already be able to receive payments. This PR is particularly for invoice settings to enable different payment methods for the customers. If you check stripe dashboard, receivables through card payments are auto enabled for connected accounts.

@apoorv-mishra apoorv-mishra force-pushed the invoice-settings branch 5 times, most recently from c7f4446 to 5da9900 Compare June 1, 2022 05:12
@apoorv-mishra apoorv-mishra marked this pull request as ready for review June 1, 2022 05:12
Copy link
Member

@akhilgkrishnan akhilgkrishnan left a comment

Choose a reason for hiding this comment

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

Added some suggestions


class InternalApi::V1::Payments::ProvidersController < ApplicationController
def create
authorize :create, policy_class: Payments::ProviderPolicy
Copy link
Member

Choose a reason for hiding this comment

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

why do we need to specify the action explicitly?

Copy link
Contributor Author

@apoorv-mishra apoorv-mishra Jun 2, 2022

Choose a reason for hiding this comment

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

Any alternate ways to make it work? Because it fails without specifying the action.

import React from "react";

const CustomToggle = ({ isChecked = false, setIsChecked, toggleCss, id }) => (
const CustomToggle = ({ isChecked = false, setIsChecked, toggleCss, id, onToggle = () => {}}) => ( // eslint-disable-line
Copy link
Member

Choose a reason for hiding this comment

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

can you add the type checking?

Copy link
Contributor Author

@apoorv-mishra apoorv-mishra Jun 2, 2022

Choose a reason for hiding this comment

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

Candidate for another PR. It's used in multiple places and may break existing flows. Keeping it as it is in this PR.

/* eslint-disable @typescript-eslint/no-var-requires */
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { setAuthHeaders, registerIntercepts } from "apis/axios";
Copy link
Member

Choose a reason for hiding this comment

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

we can move this to RouteConfig.tsx so we dont have to set this on each component inside the invoice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be better if you could suggest how as well in a way that it doesn't break existing functionality.

Copy link
Contributor Author

@apoorv-mishra apoorv-mishra Jun 2, 2022

Choose a reason for hiding this comment

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

The x-csrf-token is being set even after removing call to setAuthHeaders. Hence removing it altogether.

Copy link
Contributor

@rohitjoshixyz rohitjoshixyz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@apoorv1316 apoorv1316 left a comment

Choose a reason for hiding this comment

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

LGTM

@apoorv-mishra apoorv-mishra merged commit 15548ff into develop Jun 2, 2022
@apoorv-mishra apoorv-mishra deleted the invoice-settings branch June 2, 2022 11:07
vipulnsward pushed a commit that referenced this pull request Feb 15, 2026
* Enable stripe connect in invoice settings

* Remove option for ach bank transfer

* Add model PaymentsProvider and corresponding specs

* Add unique index on (name, company_id)

* Fix typo and associated specs

* Add routes

* Implement controller actions

* Add specs for GET /internal_api/v1/payments/providers

* Add specs for POST /internal_api/v1/payments/providers

* Add specs for PATCH /internal_api/v1/payments/providers/:id

* Fix db/schema.rb

* Integrate provider settings in FE

* Fix specs

* Fix spec as per pr-#431

* Save default stripe settings after connected account is successfully created

* Fix saving duplicate payment methods and prevent sending id in update call

* Save default stripe settings if not saved after fetching providers in invoice settings

* Remove save button, not required anymore

* Reorder controller actions

* Remove unused code

* Fix component name

* Remove unused auto-gen files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants