3a555e3b24
Deploy Polska Lokalnie / deploy (push) Successful in 11s
- ITN: XML w base64 (pole transactions), bezpieczny parser (bez XXE), podpis ze stalej listy pol, zgodnosc ServiceID, kwoty i waluty, idempotencja, podpisana odpowiedz XML CONFIRMED/NOTCONFIRMED. - Start transakcji podpisanym formularzem POST ze strony /platnosc/:orderId zamiast linku GET z podpisem w adresie; tytul przelewu w ASCII. - Losowy OrderID (UUID) zamiast Math.random. - Adres ITN do wpisania w panelu AutoPay widoczny w panelu admina. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
36 lines
1.5 KiB
Java
36 lines
1.5 KiB
Java
package pl.polskalokalnie.promotion;
|
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* Publiczny endpoint powiadomien AutoPay (ITN - Instant Transaction Notification).
|
|
*
|
|
* Bramka nie ma tokenu JWT - uwierzytelnienie nadawcy opiera sie wylacznie na podpisie liczonym
|
|
* kluczem konfiguracyjnym, weryfikowanym w {@link AutoPayItnService}. Adres ITN ustawia sie w panelu
|
|
* AutoPay: Ustawienia serwisu -> Konfiguracja techniczna serwisu -> Edytuj -> "Adres ITN"
|
|
* (pole widac dopiero w formularzu edycji): https://polskalokalnie.pl/api/payments/autopay/itn
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api/payments/autopay")
|
|
public class AutoPayItnController {
|
|
|
|
private final AutoPayItnService itnService;
|
|
|
|
public AutoPayItnController(AutoPayItnService itnService) {
|
|
this.itnService = itnService;
|
|
}
|
|
|
|
/** Notyfikacja o statusie transakcji. Odpowiedz: podpisany XML z CONFIRMED/NOTCONFIRMED. */
|
|
@PostMapping(value = "/itn", produces = MediaType.APPLICATION_XML_VALUE)
|
|
public ResponseEntity<String> itn(@RequestParam("transactions") String transactions) {
|
|
return ResponseEntity.ok()
|
|
.contentType(MediaType.APPLICATION_XML)
|
|
.body(itnService.handle(transactions));
|
|
}
|
|
}
|