Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add external billing id on enterprises #12980

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

pacodelaluna
Copy link

@pacodelaluna pacodelaluna commented Nov 16, 2024

What? Why?

The objective is to improve the links between OFN enterprises and external billing tools, through the admin reports.

What should we test?

  • Check you can add an ID on an enterprise profile
  • This ID can be found on the revenue by hub report
  • This ID is available on v0 API / report section, as well as the enterprise database
  • Super admin can change the ID as many times as they want
  • Super admin can't add spaces to this ID
  • Several enterprises can have the same ID
  • Enterprise owner / managers don't see this field

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)

Add external billing id on enterprises

The title of the pull request will be included in the release notes.

Documentation updates

No. The tip section should explain the objective of the new field with enough details.

@pacodelaluna pacodelaluna marked this pull request as draft November 16, 2024 15:48
@pacodelaluna pacodelaluna removed their assignment Nov 16, 2024
@pacodelaluna pacodelaluna marked this pull request as ready for review November 28, 2024 21:25
@pacodelaluna
Copy link
Author

I think that I have completed the objective of the ticket.

You can add the External Billing Id information on the enterprise:
image

And it is displayed on the Revenues By Hub report:
image

Please tell me if I missed something.

@pacodelaluna pacodelaluna force-pushed the add-external-billing-id-on-enterprises branch 2 times, most recently from ccd284b to 193be72 Compare November 28, 2024 22:55
@pacodelaluna
Copy link
Author

Oops, it seems I have some failing specs, working on it asap.

@RachL
Copy link
Contributor

RachL commented Nov 29, 2024

LGTM! Many thanks @pacodelaluna ❤️

@pacodelaluna
Copy link
Author

pacodelaluna commented Dec 9, 2024

I have tried to update the specs in order to pass the tests, but I am facing issues setting up Cuprite on my local machine.
I am trying to run it on my local Docker env, and I am not able to find a way to run it properly...
Still having this issue:
image

It seems I am not able to force a specific port for Capybara, not sure why as I am updating the configuration to block the port.
image

Maybe I am not looking in the good direction.
Does anybody know if someone else got this error already?

@RachL RachL added pr-staged-fr staging.coopcircuits.fr and removed pr-staged-fr staging.coopcircuits.fr labels Dec 11, 2024
@RachL
Copy link
Contributor

RachL commented Dec 13, 2024

@pacodelaluna FYI the OFN docker image changed recently: #12905

@RachL
Copy link
Contributor

RachL commented Dec 13, 2024

@pacodelaluna sorry me again. Apologies I didn't pay a close attention to the screenshot the first time, and now that i'm playing with it I'm noticing that you've moved fields in the admin section that should remain accessible to enterprise managers/owners:

image

These two need to stay in "primary details tab'.

@RachL RachL added pr-staged-fr staging.coopcircuits.fr and removed pr-staged-fr staging.coopcircuits.fr labels Dec 16, 2024
@dacook
Copy link
Member

dacook commented Dec 17, 2024

Hi @pacodelaluna sorry that you're having issues with Cuprite. I don't have time to help until next year sorry, but you can try posting in Slack #dev channel in case someone else can help.

@RachL RachL added pr-staged-fr staging.coopcircuits.fr and removed pr-staged-fr staging.coopcircuits.fr labels Dec 18, 2024
@filipefurtad0
Copy link
Contributor

Apologies, I see I must have overridden you on the staging-FR server. I hope I did not cause too much trouble 🙏

@RachL
Copy link
Contributor

RachL commented Dec 18, 2024

no don't worry @filipefurtad0 and I see I've forgotten to remove the label 🤦‍♀️ please use it as much as you need on your timezone. FR team is developing a tool to automate invoices to OFN users, and this PR is needed for the tests, so I will stage it again in the next couples of days, but again feel free to use the staging during your time 💪

@RachL RachL removed the pr-staged-fr staging.coopcircuits.fr label Dec 18, 2024
@pacodelaluna pacodelaluna force-pushed the add-external-billing-id-on-enterprises branch from 193be72 to d90ca53 Compare December 22, 2024 11:41
@pacodelaluna pacodelaluna force-pushed the add-external-billing-id-on-enterprises branch from 737f40b to b40e8a1 Compare December 22, 2024 12:43
@pacodelaluna pacodelaluna force-pushed the add-external-billing-id-on-enterprises branch 3 times, most recently from 738bf85 to 3ddc08c Compare December 26, 2024 17:51
@pacodelaluna pacodelaluna force-pushed the add-external-billing-id-on-enterprises branch from 3ddc08c to 3230159 Compare December 26, 2024 19:52
@pacodelaluna
Copy link
Author

I have finally succeeded in fixing the specs!
Also, following the suggestion of @RachL , I put back the permalink-related form in the Primary Details form. The UX has then changed a bit, as you are now activating the permalink-related form from the Admin Only tab, so you will not notice directly that something has changed. Tell me if it is fine for you.
image
image

if params[:is_primary_producer].present?
@enterprise.is_primary_producer = params[:is_primary_producer]
end
@enterprise.sells = params[:enterprise_sells] if params[:enterprise_sells].present?
Copy link
Author

Choose a reason for hiding this comment

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

As the values can come from 2 different sides (Primary Details tab or Admin only tab), we need to control the presence of the value first.

@@ -15,8 +15,6 @@
%span.unavailable.hidden{data: { "permalink-target": "unavailable" }}
= t('js.unavailable')
%i.icon-remove-sign

- unless @enterprise.sells == 'none'
Copy link
Author

Choose a reason for hiding this comment

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

This control is already present on line 2.

@@ -0,0 +1,29 @@
import { Controller } from "stimulus";

export default class extends Controller {
Copy link
Author

Choose a reason for hiding this comment

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

We need to cut down the initial logic into a new JS controller handling the Admin Only tab.

@@ -0,0 +1,5 @@
class AddExternalBillingIdOnEnterprises < ActiveRecord::Migration[7.0]
def change
add_column :enterprises, :external_billing_id, :string, limit: 128
Copy link
Author

Choose a reason for hiding this comment

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

I put the limit at 128 chars as it seems enough, but it can be of course changed in case.

uncheck 'enterprise_is_primary_producer'
click_button 'Update'
Copy link
Author

Choose a reason for hiding this comment

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

We need now to save explicitly the data before switching the tabs.

@RachL
Copy link
Contributor

RachL commented Dec 27, 2024

@pacodelaluna I'm not sure I understand

as you are now activating the permalink-related form from the Admin Only tab, so you will not notice directly that something has changed.

Can you provide more detail?

Many thanks for the rest! The PR is now in code review

@RachL RachL added the pr-staged-fr staging.coopcircuits.fr label Dec 27, 2024
@RachL
Copy link
Contributor

RachL commented Dec 27, 2024

@pacodelaluna when saving it sometimes tells me the business address company can't be blank:

image

Yet business address company is in another tab, and it's often not the address that is missing but the company legal name.

image

In production, this info is mandatory but only if you edit the tab, if you are on another tab, the tab is not checking the value of other tabs. Is this something we are introducing here?

If yes, maybe we shouldn't try something new here and keep it simple / not add a new tab. I feel like we are spending a lot of time on this new tab, when we only need one new field 😅

Also FYI the PR needs a rebase.

@RachL RachL removed the pr-staged-fr staging.coopcircuits.fr label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress ⚙
Development

Successfully merging this pull request may close these issues.

As a super admin, I should see a field I can use to link enterprise with my invoicing software
4 participants