Skip to content

Commit b7d845b

Browse files
committed
Add button to go back to the request
1 parent a42af0d commit b7d845b

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/main/java/ch/wisv/chpay/customer/controller/PaymentController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public String depositSuccess(
157157
.findById(UUID.fromString(key))
158158
.orElseThrow(() -> new NotFoundException(key));
159159
model.addAttribute(MODEL_ATTR_TRANSACTION_ID, key);
160+
if (t.supportsRequest() && t.getRequest() != null) {
161+
model.addAttribute("paymentRequest", t.getRequest());
162+
}
160163
return switch (t.getStatus()) {
161164
case Transaction.TransactionStatus.PENDING -> "pending";
162165
case Transaction.TransactionStatus.SUCCESSFUL -> "successful";

src/main/resources/templates/successful.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,23 @@ <h1 class="text-3xl font-bold text-base-content mb-4">Payment Successful!</h1>
3737
</div>
3838
</div>
3939

40-
<!-- Action Button -->
41-
<div class="card-actions justify-center mb-6">
42-
<a th:if="${redirect} != null" th:href="@{/payment/transaction/{id}(id=${redirect})}" class="btn btn-primary btn-xl btn-block sm:btn-inline-block"
43-
>
40+
<!-- Action Buttons -->
41+
<div class="grid grid-rows-2 sm:grid-cols-2 sm:grid-rows-1 gap-4 w-full mb-6">
42+
<a th:if="${redirect} != null" th:href="@{/payment/transaction/{id}(id=${redirect})}" class="btn btn-primary btn-xl sm:btn-lg">
4443
<span class="icon-[tabler--credit-card] size-5"></span>
4544
Go back to payment
4645
</a>
47-
<a th:unless="${redirect} != null" href="/" class="btn btn-primary btn-xl btn-block sm:btn-inline-block">
46+
<a th:unless="${redirect} != null" href="/" class="btn btn-primary btn-xl sm:btn-lg">
4847
<span class="icon-[tabler--home] size-5"></span>
4948
Go to Homepage
5049
</a>
50+
51+
<a th:if="${redirect == null and paymentRequest != null and paymentRequest.multiUse}"
52+
th:href="@{/payment/request/{id}(id=${paymentRequest.request_id})}"
53+
class="btn btn-outline btn-m sm:btn-lg">
54+
<span class="icon-[tabler--repeat] size-5"></span>
55+
Return to Request
56+
</a>
5157
</div>
5258

5359
<!-- Transaction ID -->

0 commit comments

Comments
 (0)