feat: implement tax calculations for subscription and SMS wallet payments

- Updated SubscriptionPeriod interface to include tax-related fields: tax_percent, tax_rials, and payable_rials.
- Modified payment API documentation to reflect changes in tax handling for subscriptions and SMS wallet charges.
- Adjusted PaymentController to calculate payment amounts based on subscription period details instead of client input.
- Enhanced PaymentManager to handle net amounts for SMS wallet charges, ensuring tax is not credited to the wallet.
- Created PaymentTaxCalculator and SubscriptionTaxCalculator services to manage tax calculations consistently across payment types.
- Added tests for tax calculations in both subscription and SMS wallet contexts, ensuring correct behavior with and without tax enabled.
- Updated frontend components to display tax information appropriately during payment processes.
This commit is contained in:
hamed
2026-08-09 16:51:22 +03:30
parent 2471c90cbb
commit 7716b40f6a
18 changed files with 762 additions and 45 deletions
+3
View File
@@ -11,6 +11,8 @@ interface PaymentConfig {
test_mode: boolean;
appointment_fee_rials: number;
gateways: PaymentGatewayInfo[];
/** نرخ مالیات اشتراک و شارژ کیف پول؛ صفر یعنی خاموش. */
tax_percent: number;
}
export function usePaymentConfig() {
@@ -22,5 +24,6 @@ export function usePaymentConfig() {
return {
isTestMode: data?.data?.test_mode ?? false,
gateways: data?.data?.gateways ?? [],
taxPercent: data?.data?.tax_percent ?? 0,
};
}