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

refactor: billing endpoints #697

Merged
merged 9 commits into from
Apr 25, 2024
Merged

Conversation

ArmanNik
Copy link
Member

No description provided.

@ArmanNik ArmanNik self-assigned this Dec 29, 2023
Copy link

vercel bot commented Dec 29, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
console-cloud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2024 1:16pm
console-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2024 1:16pm
console-preview-cloud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2024 1:16pm

Copy link
Member

@lohanidamodar lohanidamodar left a comment

Choose a reason for hiding this comment

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

Left a query. Also where are the similar changes for billingAddresses?

@@ -211,7 +211,10 @@ export async function checkPaymentAuthorizationRequired(org: Organization) {

export async function paymentExpired(org: Organization) {
if (!org?.paymentMethodId) return;
const payment = await sdk.forConsole.billing.getPaymentMethod(org.paymentMethodId);
const payment = await sdk.forConsole.billing.getOrganizationPaymentMethod(
Copy link
Member

Choose a reason for hiding this comment

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

Where is this method used?

Copy link
Member Author

Choose a reason for hiding this comment

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

We use this on load to check if there are any expired payments

Copy link
Member

@lohanidamodar lohanidamodar left a comment

Choose a reason for hiding this comment

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

We need similar changes applied for billingAddress as well. I don't see those.

@ArmanNik ArmanNik marked this pull request as draft January 23, 2024 10:41
Copy link
Member

@lohanidamodar lohanidamodar left a comment

Choose a reason for hiding this comment

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

Hey while loading billing address in the organizations billing section, we should always use the endpoint from organization instead from account
image

I don't yet see that change?

@ArmanNik
Copy link
Member Author

@lohanidamodar there's no change because we only fetch all the addresses never only one.

If there's also a new endpoint for listing addresses, I wasn't informed and it's not mentioned in the linear task either 🤔

@lohanidamodar
Copy link
Member

@lohanidamodar there's no change because we only fetch all the addresses never only one.

If there's also a new endpoint for listing addresses, I wasn't informed and it's not mentioned in the linear task either 🤔

How do you display the Organization's assigned billing address? don't you need to fetch the billing address by ID when people are looking at the billing tab for the organization?

@TorstenDittmann TorstenDittmann marked this pull request as draft March 10, 2024 16:06
@ArmanNik
Copy link
Member Author

@lohanidamodar there's no change because we only fetch all the addresses never only one.
If there's also a new endpoint for listing addresses, I wasn't informed and it's not mentioned in the linear task either 🤔

How do you display the Organization's assigned billing address? don't you need to fetch the billing address by ID when people are looking at the billing tab for the organization?

We are already fetching the addressList when we load the page so I'm just finding it among them

$addressList?.billingAddresses?.find(
        (address) => address.$id === $organization?.billingAddressId
    );

@lohanidamodar
Copy link
Member

@lohanidamodar there's no change because we only fetch all the addresses never only one.
If there's also a new endpoint for listing addresses, I wasn't informed and it's not mentioned in the linear task either 🤔

How do you display the Organization's assigned billing address? don't you need to fetch the billing address by ID when people are looking at the billing tab for the organization?

We are already fetching the addressList when we load the page so I'm just finding it among them

$addressList?.billingAddresses?.find(
        (address) => address.$id === $organization?.billingAddressId
    );

As we discussed, lets use the new endpoint through /organizations/billing-addresses/:billingAddressId to fetch the organization's billing address.

Copy link
Member

@lohanidamodar lohanidamodar left a comment

Choose a reason for hiding this comment

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

Looks good. However I think this should target cloud branch.

@ArmanNik ArmanNik changed the base branch from main to cloud April 2, 2024 08:01
@ArmanNik ArmanNik marked this pull request as ready for review April 2, 2024 08:02
@lohanidamodar lohanidamodar merged commit 7179ee8 into cloud Apr 25, 2024
4 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.

2 participants