Skip to content
Merged
2 changes: 1 addition & 1 deletion src/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function loadEnv(): Partial<ContribkitConfig> {
afdian: {
userId: process.env.CONTRIBKIT_AFDIAN_USER_ID || process.env.AFDIAN_USER_ID,
token: process.env.CONTRIBKIT_AFDIAN_TOKEN || process.env.AFDIAN_TOKEN,
exechangeRate: Number.parseFloat(process.env.CONTRIBKIT_AFDIAN_EXECHANGERATE || process.env.AFDIAN_EXECHANGERATE || '0') || undefined,
exchangeRate: Number.parseFloat(process.env.CONTRIBKIT_AFDIAN_EXCHANGE_RATE || process.env.AFDIAN_EXCHANGE_RATE || '0') || undefined,
},
polar: {
token: process.env.CONTRIBKIT_POLAR_TOKEN || process.env.POLAR_TOKEN,
Expand Down
4 changes: 2 additions & 2 deletions src/providers/afdian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function fetchAfdianSponsors(options: ContribkitConfig['afdian'] =
const {
userId,
token,
exechangeRate = 6.5,
exchangeRate = 6.5,
includePurchases = true,
purchaseEffectivity = 30,
} = options
Expand Down Expand Up @@ -88,7 +88,7 @@ export async function fetchAfdianSponsors(options: ContribkitConfig['afdian'] =
// all_sum_amount is based on cny
monthlyDollars: isExpired
? -1
: Number.parseFloat(raw.all_sum_amount) / exechangeRate,
: Number.parseFloat(raw.current_plan.show_price) / exchangeRate,
privacyLevel: 'PUBLIC',
tierName: 'Afdian',
createdAt: new Date(raw.first_pay_time * 1000).toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export interface ProvidersConfig {
*
* @default 6.5
*/
exechangeRate?: number
exchangeRate?: number
/**
* Include one-time purchases
* @default true
Expand Down