-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathpage.tsx
More file actions
112 lines (108 loc) · 3.37 KB
/
page.tsx
File metadata and controls
112 lines (108 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { createCheckoutSession } from '@godaddy/react/server';
import { unstable_noStore } from 'next/cache';
import { notFound } from 'next/navigation';
import { CheckoutPage } from './checkout';
export const dynamic = 'force-dynamic';
export default async function Home() {
unstable_noStore();
const session = await createCheckoutSession(
{
returnUrl: 'https://godaddy.com',
successUrl: 'https://godaddy.com/success',
draftOrderId: process.env.NEXT_PUBLIC_GODADDY_DRAFT_ORDER_ID || '',
storeId: process.env.NEXT_PUBLIC_GODADDY_STORE_ID || '',
channelId: process.env.NEXT_PUBLIC_GODADDY_CHANNEL_ID || '',
enableLocalPickup: true,
enableShippingAddressCollection: true,
enableBillingAddressCollection: true,
enablePhoneCollection: true,
enableTaxCollection: true,
enableNotesCollection: true,
enablePromotionCodes: true,
shipping: {
fulfillmentLocationId: 'default-location',
originAddress: {
addressLine1: '1600 Pennsylvania Ave NW',
adminArea1: 'DC',
adminArea3: 'Washington',
countryCode: 'US',
postalCode: '20500',
},
},
taxes: {
originAddress: {
addressLine1: '1600 Pennsylvania Ave NW',
adminArea1: 'DC',
adminArea3: 'Washington',
countryCode: 'US',
postalCode: '20500',
},
},
locations: [
{
id: 'default-location',
isDefault: true,
address: {
addressLine1: '1600 Pennsylvania Ave NW',
adminArea1: 'DC',
adminArea3: 'Washington',
countryCode: 'US',
postalCode: '20500',
},
},
],
paymentMethods: {
card: {
processor: 'godaddy',
checkoutTypes: ['standard'],
},
ach: {
processor: 'godaddy',
checkoutTypes: ['standard'],
},
express: {
processor: 'godaddy',
checkoutTypes: ['express'],
},
mercadopago: {
processor: 'mercadopago',
checkoutTypes: ['standard'],
},
ccavenue: {
processor: 'ccavenue',
checkoutTypes: ['standard'],
},
paypal: {
processor: 'paypal',
checkoutTypes: ['standard'],
},
},
operatingHours: {
default: {
timeZone: 'America/New_York', // CDT timezone
leadTime: 60, // 60 minutes lead time
pickupWindowInDays: 7,
hours: {
monday: { enabled: true, openTime: '09:00', closeTime: '17:00' },
tuesday: { enabled: true, openTime: '09:00', closeTime: '17:00' },
wednesday: { enabled: false, openTime: null, closeTime: null },
thursday: { enabled: true, openTime: '09:00', closeTime: '17:00' },
friday: { enabled: true, openTime: '09:00', closeTime: '18:00' },
saturday: { enabled: true, openTime: '10:00', closeTime: '16:00' },
sunday: { enabled: true, openTime: '12:00', closeTime: '15:00' },
},
},
},
},
{
auth: {
clientId: process.env.NEXT_PUBLIC_GODADDY_CLIENT_ID || '',
clientSecret: process.env.GODADDY_CLIENT_SECRET || '',
},
}
);
if (!session) {
throw notFound();
}
return <CheckoutPage session={session} />;
}