From 784d28b763ed1b9ef4cf87404129fc13f019e906 Mon Sep 17 00:00:00 2001
From: victor mendoza
Date: Thu, 22 Aug 2024 14:20:48 -0300
Subject: [PATCH 01/28] feat: create error page
---
resources/views/error-page.blade.php | 44 ++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 resources/views/error-page.blade.php
diff --git a/resources/views/error-page.blade.php b/resources/views/error-page.blade.php
new file mode 100644
index 0000000..dc3f7f3
--- /dev/null
+++ b/resources/views/error-page.blade.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+ Transbank Developers
+ @vite(['resources/css/app.css', 'resources/js/app.js'])
+
+
+
+
+ @include('partials.header')
+
+
+
+
+ ¡Ha ocurrido un error!
+
+ Lo sentimos, pero se ha producido un error durante la integración con el SDK. El SDK
+ devuelve errores
+ de
+ tipo
+ "TransbankError". Si estás viendo otro tipo de error, es posible que el proyecto de ejemplo tenga
+ algún
+ problema.
+
+
+ Si este error persiste y crees que es necesario reportarlo, por favor, hazlo en nuestro
+ repositorio
+ de
+ GitHub.
+
+
+
+
+ Volver
+
+ @include('partials.footer')
+
+ @stack('scripts')
+
+
+
From 7d048031e222f13cbb2fbe67bfd58342290e6772 Mon Sep 17 00:00:00 2001
From: victor mendoza
Date: Thu, 22 Aug 2024 14:21:18 -0300
Subject: [PATCH 02/28] feat: create delete page for oneclick
---
.../views/oneclick-mall/delete.blade.php | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 resources/views/oneclick-mall/delete.blade.php
diff --git a/resources/views/oneclick-mall/delete.blade.php b/resources/views/oneclick-mall/delete.blade.php
new file mode 100644
index 0000000..0a1cb25
--- /dev/null
+++ b/resources/views/oneclick-mall/delete.blade.php
@@ -0,0 +1,39 @@
+@php
+ $navigation = ['delete' => 'Borrar usuario'];
+@endphp
+
+
+ Oneclick Mall - Borrar usuario
+
+ En este paso fundamental, procederemos a eliminar la inscripción del usuario y su medio de pago.
+
+
+ Paso 1: Petición
+
+ Para llevar a cabo la eliminación, necesitas el "userName" (Nombre de Usuario) y el "tbkUser". Realiza la
+ llamada a Oneclick.MallInscription utilizando el siguiente código:
+
+
+ $resp = $mallInscription->delete($tbkUser, $userName);
+
+
+ Paso 2: Respuesta
+
+ En caso de éxito, Transbank responderá con un status code 204 (No Content), y el SDK no retornará ninguna
+ respuesta adicional. La eliminación de la inscripción se ha realizado de manera exitosa.
+
+
+
+ En el caso de que no se encuentre el "userName" o el "tbkUser", Transbank responderá con un status code 404 (Not
+ Found), y el SDK retornará una excepción para informar sobre la situación.
+
+
+
+ Este proceso garantiza una eliminación segura y eficiente de la inscripción del usuario y su medio de pago
+ asociado. ¡Gracias por confiar en Transbank para tus operaciones seguras! Si tienes alguna pregunta, estamos
+ aquí para ayudarte
+
+
+
+
+
From 17aa158ed67eddbc17969f45845b4768dc8e7b8e Mon Sep 17 00:00:00 2001
From: victor mendoza
Date: Thu, 22 Aug 2024 16:58:28 -0300
Subject: [PATCH 03/28] feat: create oneclikmallcontroller
---
.../Controllers/OneclickMallController.php | 132 ++++++++++++++++++
1 file changed, 132 insertions(+)
create mode 100644 app/Http/Controllers/OneclickMallController.php
diff --git a/app/Http/Controllers/OneclickMallController.php b/app/Http/Controllers/OneclickMallController.php
new file mode 100644
index 0000000..0511271
--- /dev/null
+++ b/app/Http/Controllers/OneclickMallController.php
@@ -0,0 +1,132 @@
+mallInscription = new MallInscription($option);
+ $this->mallTransaction = new MallTransaction($option);
+ }
+
+ public function startInscription()
+ {
+ $startTx = [
+ "username" => "User-" . random_int(1, 10000),
+ "email" => "user." . random_int(1, 10000) . "@example.cl",
+ "response_url" => url("/") . "/oneclick-mall/finish"
+ ];
+
+ session(['username' => $startTx["username"]]);
+ $resp = $this->mallInscription->start($startTx["username"], $startTx["email"], $startTx["response_url"]);
+ return view('oneclick-mall.start', ["request" => $startTx, "resp" => $resp]);
+ }
+
+ public function finishInscription(Request $request)
+ {
+ try {
+ //flujo error
+ if ($request->exists("TBK_ORDEN_COMPRA")) {
+ return view('error-page');
+ }
+
+ $token = $request["TBK_TOKEN"];
+ $userName = session('username', '');
+ $resp = $this->mallInscription->finish($token);
+
+
+ if ($resp->responseCode == -1) {
+ return view('oneclick-mall.rejected', ["resp" => $resp, "token" => $token]);
+ }
+
+ if ($resp->responseCode == -96) {
+ return view('oneclick-mall.timeout', ["resp" => $resp]);
+ }
+
+ $table = [
+ "username" => $userName,
+ "tbk_user" => $resp->tbkUser,
+ ];
+ return view('oneclick-mall.finish', ["resp" => $resp, "token" => $token, "table" => $table]);
+ } catch (\Exception $e) {
+ $error = ["msg" => $e->getMessage(), "code" => $e->getCode()];
+ return view('error-page', ["error" => $error]);
+ }
+ }
+ public function deleteInscription(Request $request)
+ {
+ try {
+ $tbkUser = $request["tbkUser"];
+ $userName = $request["userName"];
+ $resp = $this->mallInscription->delete($tbkUser, $userName);
+ return view('oneclick-mall.delete', ["resp" => $resp]);
+ } catch (\Exception $e) {
+ $error = ["msg" => $e->getMessage(), "code" => $e->getCode()];
+ return view('error-page', ["error" => $error]);
+ }
+ }
+
+ public function authorizeMall(Request $request)
+ {
+ try {
+ $tbkUser = $request["tbkUser"];
+ $userName = $request["userName"];
+ $buyOrder = "O-" . random_int(1000, 9999);
+ $details = [
+ [
+ "commerce_code" => "597055555542",
+ "buy_order" => "O1-" . random_int(1000, 9999),
+ "amount" => 1693,
+ "installments_number" => 1
+ ],
+ [
+ "commerce_code" => "597055555543",
+ "buy_order" => "O2-" . random_int(1000, 9999),
+ "amount" => 1960,
+ "installments_number" => 1
+ ]
+ ];
+
+ $resp = $this->mallTransaction->authorize($userName, $tbkUser, $buyOrder, $details);
+ return view('oneclick-mall.authorize', ["resp" => $resp]);
+ } catch (\Exception $e) {
+ $error = ["msg" => $e->getMessage(), "code" => $e->getCode()];
+ return view('error-page', ["error" => $error]);
+ }
+ }
+
+ public function status(Request $request)
+ {
+ $buyOrder = $request["buyOrder"];
+
+ $resp = $this->mallTransaction->status($buyOrder);
+
+ return view('oneclick-mall.status', ["resp" => $resp]);
+ }
+
+ public function refund(Request $request)
+ {
+ $req = $request->except('_token');
+ $buyOrder = $req["buyOrder"];
+ $childCommerceCode = $req["childCommerceCode"];
+ $childBuyOrder = $req["childBuyOrder"];
+ $amount = $req["amount"];
+
+ $resp = $this->mallTransaction->refund($buyOrder, $childCommerceCode, $childBuyOrder, $amount);
+
+ return view('oneclick-mall.refund', ["resp" => $resp]);
+ }
+}
From 3d72d41bd73bfe6c57384efc5fa8d8f07860d8c9 Mon Sep 17 00:00:00 2001
From: victor mendoza
Date: Thu, 22 Aug 2024 16:59:03 -0300
Subject: [PATCH 04/28] feat: add css for multile line fields in card
---
resources/css/app.css | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/resources/css/app.css b/resources/css/app.css
index 6f0b0fb..7779d99 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -203,6 +203,9 @@ code {
.mb-32 {
margin-bottom: 32px;
}
+.mb-16 {
+ margin-bottom: 16px;
+}
.tbk-link {
color: var(--tbk-red);
@@ -658,12 +661,17 @@ code {
line-height: 24px;
letter-spacing: 0.25px;
}
+/* Error page */
+.layout-error {
+ margin: 80px 156px;
+}
/* homepage */
.layout-home {
display: grid;
grid-template-rows: auto 1fr auto;
+ height: 100vh;
}
.tbk-home-container {
@@ -757,6 +765,24 @@ code {
background-color: var(--tbk-grey-4);
}
}
+.card-multi-field {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 32px;
+}
+
+.divided-card {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 24px;
+}
+
+.card-right-container {
+ display: flex;
+ flex-direction: column;
+ align-items: end;
+ gap: 16px;
+}
@media (max-width: 1439.98px) {
.body-container {
@@ -767,6 +793,12 @@ code {
}
}
+@media (max-width: 1023.98px) {
+ .card-multi-field {
+ grid-template-columns: 1fr;
+ }
+}
+
@media (max-width: 576px) {
.tbk-table {
display: none;
From f6b550a44e7261d30af7f525ed34a90d5d2e1890 Mon Sep 17 00:00:00 2001
From: victor mendoza
Date: Thu, 22 Aug 2024 16:59:31 -0300
Subject: [PATCH 05/28] refactor: use correct url dor oneclick mall
---
resources/views/home.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
index 2d9e624..46d80ff 100644
--- a/resources/views/home.blade.php
+++ b/resources/views/home.blade.php
@@ -52,7 +52,7 @@ class="card-info-image" />
para el tarjetahabiente, una vez que este haya registrado su tarjeta en el comercio.
-
+
Ver ejemplos y modalidades
From 4c56233e7d044eb67d07bbe7e984ff2fbd05af22 Mon Sep 17 00:00:00 2001
From: victor mendoza
Date: Thu, 22 Aug 2024 17:00:40 -0300
Subject: [PATCH 06/28] refactor: use correct url for oneclick in menu
---
resources/views/components/menu.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/components/menu.blade.php b/resources/views/components/menu.blade.php
index 23cd535..0f6256f 100644
--- a/resources/views/components/menu.blade.php
+++ b/resources/views/components/menu.blade.php
@@ -16,7 +16,7 @@