Skip to content

Commit 97ffe4d

Browse files
VNEXT-68989 (#1290)
* initial changes to add mercadopago * mercadopago event tracking, improvement in rendering, placing dummy email * including changeset * run lint:fix * reverting gdp in example project * mercadopago form ouside the accordion, cleaning MercadoPagoProvider * setting correct button style * setting description for mercadopago with translations * payment method name i18n, merging form and button, getting rid of MPProvider * lint fix * changing path for mercadopago provider * localizations changeset, removing nextjs since it's not published * improve resource loading and fix re-render issues * reverting log line for example, remove tracking for MP. Already tracking by other events * unused imports * changeset update
1 parent 310ef78 commit 97ffe4d

File tree

37 files changed

+549
-46
lines changed

37 files changed

+549
-46
lines changed

.changeset/some-berries-teach.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@godaddy/react": patch
3+
"@godaddy/localizations": patch
4+
---
5+
6+
Implementation of mercadopago

examples/nextjs/app/checkout.tsx

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,52 @@ export function CheckoutPage({ session }: { session: CheckoutSession }) {
1414
<Checkout
1515
session={session}
1616
checkoutFormSchema={customSchema}
17-
squareConfig={{
18-
appId: process.env.NEXT_PUBLIC_SQUARE_APP_ID || '',
19-
locationId: process.env.NEXT_PUBLIC_SQUARE_LOCATION_ID || '',
20-
}}
21-
stripeConfig={{
22-
publishableKey: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || '',
23-
}}
24-
godaddyPaymentsConfig={{
25-
businessId: process.env.NEXT_PUBLIC_GODADDY_BUSINESS_ID || '',
26-
appId: process.env.NEXT_PUBLIC_GODADDY_APP_ID || '',
27-
}}
28-
paypalConfig={{
29-
clientId: process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID || '',
30-
}}
17+
squareConfig={
18+
process.env.NEXT_PUBLIC_SQUARE_APP_ID &&
19+
process.env.NEXT_PUBLIC_SQUARE_LOCATION_ID
20+
? {
21+
appId: process.env.NEXT_PUBLIC_SQUARE_APP_ID,
22+
locationId: process.env.NEXT_PUBLIC_SQUARE_LOCATION_ID,
23+
}
24+
: undefined
25+
}
26+
stripeConfig={
27+
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
28+
? {
29+
publishableKey: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
30+
}
31+
: undefined
32+
}
33+
mercadoPagoConfig={
34+
process.env.NEXT_PUBLIC_MERCADOPAGO_PUBLIC_KEY
35+
? {
36+
publicKey: process.env.NEXT_PUBLIC_MERCADOPAGO_PUBLIC_KEY,
37+
country:
38+
(process.env.NEXT_PUBLIC_MERCADOPAGO_COUNTRY as
39+
| 'AR'
40+
| 'BR'
41+
| 'CO'
42+
| 'CL'
43+
| 'PE'
44+
| 'MX') || 'AR',
45+
}
46+
: undefined
47+
}
48+
godaddyPaymentsConfig={
49+
process.env.NEXT_PUBLIC_GODADDY_APP_ID
50+
? {
51+
businessId: process.env.NEXT_PUBLIC_GODADDY_BUSINESS_ID || '',
52+
appId: process.env.NEXT_PUBLIC_GODADDY_APP_ID,
53+
}
54+
: undefined
55+
}
56+
paypalConfig={
57+
process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID
58+
? {
59+
clientId: process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID,
60+
}
61+
: undefined
62+
}
3163
/>
3264
);
3365
}

examples/nextjs/app/page.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,13 @@ export default async function Home() {
5858
processor: 'godaddy',
5959
checkoutTypes: ['standard'],
6060
},
61-
express: {
62-
processor: 'godaddy',
63-
checkoutTypes: ['express'],
61+
mercadopago: {
62+
processor: 'mercadopago',
63+
checkoutTypes: ['standard'],
6464
},
6565
paypal: {
6666
processor: 'paypal',
67-
checkoutTypes: ['standard'],
68-
},
69-
offline: {
70-
processor: 'offline',
71-
checkoutTypes: ['standard'],
67+
checkoutTypes: ['express', 'standard'],
7268
},
7369
},
7470
operatingHours: {

examples/nextjs/app/store/product/[productId]/product.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export default function Product({ productId }: { productId: string }) {
1717
<ArrowLeft className='h-4 w-4' />
1818
Back to Store
1919
</Link>
20-
<ProductDetails
21-
productId={productId}
22-
onAddToCartSuccess={openCart}
23-
/>
20+
<ProductDetails productId={productId} onAddToCartSuccess={openCart} />
2421
</div>
2522
);
2623
}

examples/nextjs/biome.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
3-
"extends": ["biome-config-godaddy/biome.json"],
4-
"css": {
5-
"parser": {
6-
"cssModules": true,
7-
"tailwindDirectives": true
8-
}
9-
},
10-
"files": {
11-
"includes": ["**/*", "!!**/src/globals.css"]
12-
},
13-
"linter": {
14-
"rules": {
15-
"correctness": {
16-
"useUniqueElementIds": "off"
17-
}
18-
}
19-
}
2+
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
3+
"extends": ["biome-config-godaddy/biome.json"],
4+
"css": {
5+
"parser": {
6+
"cssModules": true,
7+
"tailwindDirectives": true
8+
}
9+
},
10+
"files": {
11+
"includes": ["**/*", "!!**/src/globals.css"]
12+
},
13+
"linter": {
14+
"rules": {
15+
"correctness": {
16+
"useUniqueElementIds": "off"
17+
}
18+
}
19+
}
2020
}

examples/nextjs/env.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ NEXT_PUBLIC_GODADDY_APP_ID=
2121
NEXT_PUBLIC_SQUARE_APP_ID=
2222
NEXT_PUBLIC_SQUARE_LOCATION_ID=
2323
NEXT_PUBLIC_PAYPAL_CLIENT_ID=
24+
25+
# MercadoPago Credentials
26+
NEXT_PUBLIC_MERCADOPAGO_PUBLIC_KEY=
27+
NEXT_PUBLIC_MERCADOPAGO_COUNTRY=AR

packages/localizations/src/deDe.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const deDe = {
106106
googlePay: 'Google Pay',
107107
paze: 'Paze',
108108
offline: 'Offline-Zahlungen',
109+
mercadopago: 'Mercado Pago',
109110
},
110111
descriptions: {
111112
creditCard: '',
@@ -114,6 +115,8 @@ export const deDe = {
114115
googlePay: '',
115116
paze: '',
116117
offline: '',
118+
mercadopago:
119+
'Verwende das MercadoPago-Formular unten, um deinen Kauf sicher abzuschließen.',
117120
},
118121
noMethodsAvailable: 'Keine Zahlungsmethoden verfügbar',
119122
cardNumber: 'Kartennummer',

packages/localizations/src/enIe.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const enIe = {
106106
googlePay: 'Google Pay',
107107
paze: 'Paze',
108108
offline: 'Offline payments',
109+
mercadopago: 'Mercado Pago',
109110
},
110111
descriptions: {
111112
creditCard: '',
@@ -114,6 +115,8 @@ export const enIe = {
114115
googlePay: '',
115116
paze: '',
116117
offline: '',
118+
mercadopago:
119+
'Use the MercadoPago form below to complete your purchase securely.',
117120
},
118121
noMethodsAvailable: 'No payment methods available',
119122
cardNumber: 'Card number',

packages/localizations/src/enUs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const enUs = {
106106
googlePay: 'Google Pay',
107107
paze: 'Paze',
108108
offline: 'Offline payments',
109+
mercadopago: 'Mercado Pago',
109110
},
110111
descriptions: {
111112
creditCard: '',
@@ -114,6 +115,8 @@ export const enUs = {
114115
googlePay: '',
115116
paze: '',
116117
offline: '',
118+
mercadopago:
119+
'Use the MercadoPago form below to complete your purchase securely.',
117120
},
118121
noMethodsAvailable: 'No payment methods available',
119122
cardNumber: 'Card number',

packages/localizations/src/esAr.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export const esAr = {
107107
googlePay: 'Google Pay',
108108
paze: 'Paze',
109109
offline: 'Pagos en efectivo',
110+
mercadopago: 'Mercado Pago',
110111
},
111112
descriptions: {
112113
creditCard: '',
@@ -115,6 +116,8 @@ export const esAr = {
115116
googlePay: '',
116117
paze: '',
117118
offline: '',
119+
mercadopago:
120+
'Usa el formulario de MercadoPago a continuación para completar tu compra de forma segura.',
118121
},
119122
noMethodsAvailable: 'No hay métodos de pago disponibles',
120123
cardNumber: 'Número de tarjeta',

0 commit comments

Comments
 (0)