Skip to content

Commit

Permalink
Format expiry date nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwok-he-Chu committed Jan 5, 2024
1 parent 1fc8bad commit 430490d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public long getDaysUntilExpiry() {
return ChronoUnit.DAYS.between(bookingDate, expiryDate);
}

public String getFormattedExpiryDate() {
return expiryDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}

public String getMerchantReference() {
return merchantReference;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public ResponseEntity<PaymentCaptureResponse> capturePayment(@RequestBody Captur
paymentCaptureRequest.setAmount(amount);

var response = modificationsApi.captureAuthorisedPayment(payment.getPspReference(), paymentCaptureRequest);

log.info(response.toJson());

return ResponseEntity.ok(response);
} catch (Exception e) {
log.error(e.getMessage());
Expand Down Expand Up @@ -124,9 +122,7 @@ public ResponseEntity<PaymentAmountUpdateResponse> updatePaymentAmount(@RequestB
paymentAmountUpdateRequest.setAmount(a);

var response = modificationsApi.updateAuthorisedAmount(payment.getPspReference(), paymentAmountUpdateRequest);

log.info(response.toJson());

return ResponseEntity.ok(response);
} catch (Exception e) {
log.error(e.getMessage());
Expand All @@ -147,11 +143,8 @@ public ResponseEntity<PaymentReversalResponse> reversalPayment(@RequestBody Reve
paymentReversalRequest.setMerchantAccount(applicationProperty.getMerchantAccount());
paymentReversalRequest.setReference(payment.getMerchantReference());


var response = modificationsApi.refundOrCancelPayment(payment.getPspReference(), paymentReversalRequest);

log.info(response.toJson());

return ResponseEntity.ok(response);
} catch (Exception e) {
log.error(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1>ADMIN PANEL</h1>
<li><b>Amount: &nbsp;</b><span th:text="${payment.currency + ' ' + (payment.amount / 100d)}"></span>
</li>
<li><b>PaymentMethodBrand: &nbsp;</b><span th:text="${payment.paymentMethodBrand}"></span></li>
<li><b>Expiry Date: &nbsp;</b><span th:text="${payment.expiryDate}"></span>
<li><b>Expiry Date: &nbsp;</b><span th:text="${payment.getFormattedExpiryDate()}"></span>
&nbsp; (<span th:text="${payment.getDaysUntilExpiry()}"> </span> &nbsp; days until&nbsp;<a href="https://docs.adyen.com/online-payments/classic-integrations/modify-payments/adjust-authorisation#validity">expiry</a>)
</li>
<li>
Expand Down

0 comments on commit 430490d

Please sign in to comment.