fix: Remove COD transaction creation to fix checkout errors
The transaction creation was failing due to HANDLE_PAYMENTS permission issues. Removed the code to get checkout working again. Will implement via order metadata or core-extensions webhook instead.
This commit is contained in:
@@ -13,7 +13,6 @@ import { saleorClient } from "@/lib/saleor/client";
|
|||||||
import { useAnalytics } from "@/lib/analytics";
|
import { useAnalytics } from "@/lib/analytics";
|
||||||
import {
|
import {
|
||||||
CHECKOUT_SHIPPING_ADDRESS_UPDATE,
|
CHECKOUT_SHIPPING_ADDRESS_UPDATE,
|
||||||
TRANSACTION_CREATE,
|
|
||||||
} from "@/lib/saleor/mutations/Checkout";
|
} from "@/lib/saleor/mutations/Checkout";
|
||||||
import { PaymentSection } from "./components/PaymentSection";
|
import { PaymentSection } from "./components/PaymentSection";
|
||||||
import { DEFAULT_PAYMENT_METHOD } from "@/lib/config/paymentMethods";
|
import { DEFAULT_PAYMENT_METHOD } from "@/lib/config/paymentMethods";
|
||||||
@@ -307,27 +306,6 @@ export default function CheckoutPage() {
|
|||||||
setOrderNumber(result.order.number);
|
setOrderNumber(result.order.number);
|
||||||
setOrderComplete(true);
|
setOrderComplete(true);
|
||||||
|
|
||||||
// If COD payment, create a transaction on the order
|
|
||||||
if (selectedPaymentMethod === 'cod' && result.order.id) {
|
|
||||||
try {
|
|
||||||
console.log("Creating COD transaction for order:", result.order.id);
|
|
||||||
await saleorClient.mutate({
|
|
||||||
mutation: TRANSACTION_CREATE,
|
|
||||||
variables: {
|
|
||||||
orderId: result.order.id,
|
|
||||||
transaction: {
|
|
||||||
name: "Cash on Delivery",
|
|
||||||
message: "COD - Payment pending on delivery"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
console.log("COD transaction created successfully");
|
|
||||||
} catch (txError) {
|
|
||||||
console.error("Failed to create COD transaction:", txError);
|
|
||||||
// Don't fail the checkout if transaction creation fails
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the checkout/cart from the store
|
// Clear the checkout/cart from the store
|
||||||
clearCheckout();
|
clearCheckout();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user