Skip to content

Commit

Permalink
fix: currency format
Browse files Browse the repository at this point in the history
define brl como padrao de moeda
  • Loading branch information
kweripx authored Jan 9, 2024
1 parent 609cedc commit 53b4227
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const createCheckoutSession = authenticatedProcedure
email: z.string(),
company: z.string(),
workspaceId: z.string(),
currency: z.enum(['usd', 'eur', 'brl']),
currency: z.enum(['brl']),
plan: z.enum([Plan.STARTER, Plan.PRO]),
returnUrl: z.string(),
vat: z
Expand Down Expand Up @@ -120,7 +120,7 @@ export const createCheckoutSession = authenticatedProcedure
type Props = {
customerId: string
workspaceId: string
currency: 'usd' | 'eur' | 'brl'
currency: 'brl'
plan: 'STARTER' | 'PRO'
returnUrl: string
userId: string
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/features/billing/api/getSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const getSubscription = authenticatedProcedure
status: subscriptionSchema.shape.status.parse(
currentSubscription.status
),
currency: currentSubscription.currency as 'usd' | 'eur' | 'brl',
currency: currentSubscription.currency as 'brl',
cancelDate: currentSubscription.cancel_at
? new Date(currentSubscription.cancel_at * 1000)
: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const updateSubscription = authenticatedProcedure
returnUrl: z.string(),
workspaceId: z.string(),
plan: z.enum([Plan.STARTER, Plan.PRO]),
currency: z.enum(['usd', 'eur', 'brl']),
currency: z.enum(['brl']),
})
)
.output(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type PreCheckoutModalProps = {
| {
plan: 'STARTER' | 'PRO'
workspaceId: string
currency: 'eur' | 'usd' | 'brl'
currency: 'brl'
}
| undefined
existingCompany?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { T, useTranslate } from '@tolgee/react'

type Props = {
currentPlan: Plan
currency?: 'usd' | 'eur' | 'brl'
currency?: 'brl'
isLoading: boolean
onPayClick: () => void
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { T, useTranslate } from '@tolgee/react'

type Props = {
currentPlan: Plan
currency?: 'eur' | 'usd' | 'brl'
currency?: 'brl'
isLoading?: boolean
onPayClick: () => void
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { FolderContent } from '@/features/folders/components/FolderContent'
import { TypebotDndProvider } from '@/features/folders/TypebotDndProvider'
import { ParentModalProvider } from '@/features/graph/providers/ParentModalProvider'
import { trpc } from '@/lib/trpc'
import { guessIfUserIsEuropean } from '@typebot.io/lib/billing/guessIfUserIsEuropean'
// import { guessIfUserIsEuropean } from '@typebot.io/lib/billing/guessIfUserIsEuropean'
import { useTranslate } from '@tolgee/react'

export const DashboardPage = () => {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const DashboardPage = () => {
setPreCheckoutPlan({
plan: subscribePlan as 'PRO' | 'STARTER',
workspaceId: workspace.id,
currency: guessIfUserIsEuropean() ? 'eur' : 'usd',
currency: 'brl',
})
}
}, [createCustomCheckoutSession, router.query, user, workspace])
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/test/utils/databaseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const addSubscriptionToWorkspace = async (
customer: stripeId,
items,
default_payment_method: paymentId,
currency: 'usd',
currency: 'brl',
})
await stripe.customers.update(stripeId, {
invoice_settings: { default_payment_method: paymentId },
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/billing/formatPrice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { guessIfUserIsEuropean } from './guessIfUserIsEuropean'

type FormatPriceParams = {
currency?: 'eur' | 'usd' | 'brl'
currency?: 'brl'
maxFractionDigits?: number
}

Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/features/billing/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const subscriptionSchema = z.object({
start: z.date(),
end: z.date(),
}),
currency: z.enum(['eur', 'usd', 'brl']),
currency: z.enum(['brl']),
cancelDate: z.date().optional(),
status: z.enum(['active', 'past_due']),
})
Expand Down

1 comment on commit 53b4227

@vercel
Copy link

@vercel vercel bot commented on 53b4227 Jan 9, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.