Save currency to db (#3086)

* Save currency to db

* Add missing translation

* Get currency from user credentials server side

* Adds stripe data schema

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-06-20 19:09:22 +00:00
1 parent 89ef6c3f13
commit b339736a6f
3 files changed
+40 -4

No files matched your search

+16 -3
View File
@@ -1,13 +1,26 @@
import Stripe from "stripe";
import { z } from "zod";
export type PaymentData = Stripe.Response<Stripe.PaymentIntent> & {
stripe_publishable_key: string;
stripeAccount: string;
};
export type StripeData = Stripe.OAuthToken & {
default_currency: string;
};
export const stripeOAuthTokenSchema = z.object({
access_token: z.string().optional(),
scope: z.string().optional(),
livemode: z.boolean().optional(),
token_type: z.literal("bearer").optional(),
refresh_token: z.string().optional(),
stripe_user_id: z.string().optional(),
stripe_publishable_key: z.string().optional(),
});
export const stripeDataSchema = stripeOAuthTokenSchema.extend({
default_currency: z.string(),
});
export type StripeData = z.infer<typeof stripeDataSchema>;
const stripePrivateKey = process.env.STRIPE_PRIVATE_KEY!;