Skip to content

Commit

Permalink
Try debugging paytrail 401
Browse files Browse the repository at this point in the history
  • Loading branch information
lanttu1243 committed Jan 3, 2025
1 parent f4a4f33 commit b1a1194
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
4 changes: 1 addition & 3 deletions cms/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
db:
image: postgres:14.4
Expand All @@ -9,4 +7,4 @@ services:
ports:
- 5432:5432
networks:
- default
- default
4 changes: 3 additions & 1 deletion web/app/[locale]/checkout/[orderUid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const getOrderInformation = async (orderUid: string) => {
const order = await fetchAPI<Order>(`/orders/findByUid/${orderUid}`, {
cache: "no-store",
});
console.log("Managed to get here")
return order;
} catch (error) {
console.error(error);
Expand All @@ -44,7 +45,8 @@ const Checkout = async ({ params: { locale, orderUid } }: Props) => {
return null;
}
const hostname = headers().get("host");
const url = hostname ? `https://${hostname}` : "http://localhost:3000";
console.log("Got here to tell the tale", hostname)
const url = "http://localhost:3000" // hostname ? `https://${hostname}` : "http://localhost:3000";
const paymentResponse = await createPayment(order.id, url);
console.log(paymentResponse);
if (!paymentResponse) {
Expand Down
2 changes: 1 addition & 1 deletion web/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const Home = async ({ params: { locale } }: Props) => {
const bodyText = response?.attributes.bodyText || "";
const showSignups = response?.attributes.showSignups || false;
return (
<div className="container max-w-3xl bg-secondary-50 dark:bg-secondary-800 mx-auto rounded shadow-md mt-4 p-1 sm:p-8">
<div className="relative container max-w-3xl bg-secondary-50 dark:bg-secondary-800 mx-auto rounded shadow-md mt-4 p-1 sm:p-8">
<main className="container mx-auto px-4">

<ReactMarkdown
Expand Down
2 changes: 1 addition & 1 deletion web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const RootLayout = async ({ children }: PropType) => {
<Locale />
<Timer />
</Header>
<div className="max-w-7xl mx-auto">{children}</div>
<div className="relative max-w-7xl mx-auto">{children}</div>
</AppProvider>
<Footer />
</body>
Expand Down
1 change: 1 addition & 0 deletions web/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const createPayment = async (orderId: number, url: string) => {
(acc, item) => acc + item.price * item.quantity,
0,
);
console.log("\n\n\n\nTotal", total);
await updateOrderState(order.id, "pending");
if (total === 0) return paytrailService.createSkipPayment(order);
return paytrailService.createPayment(order, url);
Expand Down
2 changes: 1 addition & 1 deletion web/utils/paytrail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const PAYTRAIL_ENDPOINT = "https://services.paytrail.com";
const PAYTRAIL_MERCHANT_ID = process.env.PAYTRAIL_MERCHANT_ID || "";
const PAYTRAIL_SECRET_KEY = process.env.PAYTRAIL_SECRET_KEY || "";

const getRandomString = (length: number = 16) =>
const getRandomString = (length: number = 15) =>
crypto.randomBytes(length).toString("base64");

const calculateHmac = (
Expand Down

0 comments on commit b1a1194

Please sign in to comment.