@go-avro/avro-js 0.0.52 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/fees.d.ts +0 -9
- package/dist/billing/fees.js +0 -41
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/billing/fees.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
import { PaymentType } from '../types/api/PaymentType';
|
|
2
|
-
export interface PassOnFeeBreakdown {
|
|
3
|
-
stripeFee: number;
|
|
4
|
-
avroFee: number;
|
|
5
|
-
totalFee: number;
|
|
6
|
-
gross: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function computeStripeFee(grossCents: number, method: PaymentType): number;
|
|
9
|
-
export declare function computeAvroFee(grossCents: number): number;
|
|
10
|
-
export declare function computePassOnFee(subtotalCents: number, method: PaymentType): PassOnFeeBreakdown;
|
|
11
2
|
export declare function defaultPassOnFeeMethod(enabledPaymentMethods: PaymentType[] | null | undefined): PaymentType | null;
|
package/dist/billing/fees.js
CHANGED
|
@@ -1,45 +1,4 @@
|
|
|
1
1
|
import { PaymentType } from '../types/api/PaymentType';
|
|
2
|
-
const ZERO_FEE = {
|
|
3
|
-
stripeFee: 0,
|
|
4
|
-
avroFee: 0,
|
|
5
|
-
totalFee: 0,
|
|
6
|
-
gross: 0,
|
|
7
|
-
};
|
|
8
|
-
export function computeStripeFee(grossCents, method) {
|
|
9
|
-
if (grossCents <= 0)
|
|
10
|
-
return 0;
|
|
11
|
-
if (method === PaymentType.CARD) {
|
|
12
|
-
return Math.ceil(grossCents * 0.029) + 30;
|
|
13
|
-
}
|
|
14
|
-
return Math.min(Math.ceil(grossCents * 0.008), 500);
|
|
15
|
-
}
|
|
16
|
-
export function computeAvroFee(grossCents) {
|
|
17
|
-
if (grossCents <= 0)
|
|
18
|
-
return 0;
|
|
19
|
-
return Math.ceil(grossCents * 0.004);
|
|
20
|
-
}
|
|
21
|
-
export function computePassOnFee(subtotalCents, method) {
|
|
22
|
-
if (subtotalCents <= 0)
|
|
23
|
-
return { ...ZERO_FEE };
|
|
24
|
-
let gross;
|
|
25
|
-
if (method === PaymentType.CARD) {
|
|
26
|
-
gross = Math.ceil((1000 * subtotalCents + 32000) / 967);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
gross = Math.ceil((1000 * subtotalCents + 2000) / 988);
|
|
30
|
-
if (gross > 62500) {
|
|
31
|
-
gross = Math.ceil((1000 * (subtotalCents + 501)) / 996);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const stripeFee = computeStripeFee(gross, method);
|
|
35
|
-
const avroFee = computeAvroFee(gross);
|
|
36
|
-
return {
|
|
37
|
-
stripeFee,
|
|
38
|
-
avroFee,
|
|
39
|
-
totalFee: gross - subtotalCents,
|
|
40
|
-
gross,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
2
|
export function defaultPassOnFeeMethod(enabledPaymentMethods) {
|
|
44
3
|
if (!enabledPaymentMethods || enabledPaymentMethods.length === 0)
|
|
45
4
|
return null;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,7 @@ import './client/hooks/proposal';
|
|
|
32
32
|
import './client/hooks/timecards';
|
|
33
33
|
import './client/hooks/waivers';
|
|
34
34
|
import './client/hooks/email';
|
|
35
|
-
export {
|
|
36
|
-
export type { PassOnFeeBreakdown } from './billing/fees';
|
|
35
|
+
export { defaultPassOnFeeMethod } from './billing/fees';
|
|
37
36
|
export * from './types/api';
|
|
38
37
|
export * from './types/auth';
|
|
39
38
|
export * from './types/cache';
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import './client/hooks/proposal';
|
|
|
30
30
|
import './client/hooks/timecards';
|
|
31
31
|
import './client/hooks/waivers';
|
|
32
32
|
import './client/hooks/email';
|
|
33
|
-
export {
|
|
33
|
+
export { defaultPassOnFeeMethod } from './billing/fees';
|
|
34
34
|
export * from './types/api';
|
|
35
35
|
export * from './types/auth';
|
|
36
36
|
export * from './types/cache';
|