Enabled payment for Corporate along with increasing every single one of their students/teachers expiry date as well
This commit is contained in:
@@ -10,10 +10,11 @@ interface Props {
|
||||
price: number;
|
||||
duration: number;
|
||||
duration_unit: DurationUnit;
|
||||
setIsLoading: (isLoading: boolean) => void;
|
||||
onSuccess: (duration: number, duration_unit: DurationUnit) => void;
|
||||
}
|
||||
|
||||
export default function PayPalPayment({price, currency, duration, duration_unit, onSuccess}: Props) {
|
||||
export default function PayPalPayment({price, currency, duration, duration_unit, setIsLoading, onSuccess}: Props) {
|
||||
const [{options}, dispatch] = usePayPalScriptReducer();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -28,7 +29,7 @@ export default function PayPalPayment({price, currency, duration, duration_unit,
|
||||
}, [currency]);
|
||||
|
||||
const createOrder = async (data: CreateOrderData, actions: CreateOrderActions): Promise<string> => {
|
||||
console.log(data, actions);
|
||||
setIsLoading(true);
|
||||
|
||||
return axios
|
||||
.post<OrderResponseBody>("/api/paypal", {currencyCode: currency, price})
|
||||
@@ -49,13 +50,11 @@ export default function PayPalPayment({price, currency, duration, duration_unit,
|
||||
};
|
||||
|
||||
const onError = async (data: Record<string, unknown>) => {
|
||||
console.log(data);
|
||||
toast.error("ERROR!");
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
const onCancel = async (data: Record<string, unknown>, actions: OnCancelledActions) => {
|
||||
console.log(data, actions);
|
||||
toast.error("CANCEL!");
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user