mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use stripe connect for payments
This commit is contained in:
parent
cdd893ca6f
commit
a8ba053447
17 changed files with 835 additions and 364 deletions
|
|
@ -20,9 +20,9 @@ export async function checkPaidAccess(courseId: number, orgId: number, access_to
|
|||
return res;
|
||||
}
|
||||
|
||||
export async function createPaymentConfig(orgId: number, data: any, access_token: string) {
|
||||
export async function initializePaymentConfig(orgId: number, data: any, provider: string, access_token: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/config`,
|
||||
`${getAPIUrl()}payments/${orgId}/config?provider=${provider}`,
|
||||
RequestBodyWithAuthHeader('POST', data, null, access_token)
|
||||
);
|
||||
const res = await errorHandling(result);
|
||||
|
|
@ -38,6 +38,24 @@ export async function updatePaymentConfig(orgId: number, id: string, data: any,
|
|||
return res;
|
||||
}
|
||||
|
||||
export async function updateStripeAccountID(orgId: number, data: any, access_token: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/stripe/account?stripe_account_id=${data.stripe_account_id}`,
|
||||
RequestBodyWithAuthHeader('PUT', data, null, access_token)
|
||||
);
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getStripeOnboardingLink(orgId: number, access_token: string, redirect_uri: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/stripe/connect/link?redirect_uri=${redirect_uri}`,
|
||||
RequestBodyWithAuthHeader('POST', null, null, access_token)
|
||||
);
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function deletePaymentConfig(orgId: number, id: string, access_token: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/config?id=${id}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue