Skip to content

Commit

Permalink
Fix id typing
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkGL committed Mar 24, 2022
1 parent 3c49d4a commit 6db17a4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'pl.simpay'
version '1.0'
version '2.1'
sourceCompatibility = '17'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.time.LocalDateTime;

public record DirectBillingTransactionDetailsDTO(int id, TransactionStatus status, String phoneNumber, double value,
public record DirectBillingTransactionDetailsDTO(String id, TransactionStatus status, String phoneNumber, double value,
@Json(name = "value_netto") double netValue, Operator operator,
@Json(name = "notify") Notification notification,
@Json(name = "created_at") LocalDateTime createdAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import pl.simpay.api.model.request.RedirectURL;

public record DirectBillingTransactionNotificationDTO(
int id,
String id,
@Json(name = "service_id") int serviceId,
TransactionStatus status,
Values values,
RedirectURL returns,
String control,
String number,
@Json(name = "number_from") String numberFrom,
int provider,
String signature
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.time.LocalDateTime;

public record DirectBillingTransactionsDTO(
int id,
String id,
TransactionStatus status,
double value,
@Json(name = "value_netto") double netValue,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/pl/simpay/api/payments/DirectBilling.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public PaginatedResponse<Set<DirectBillingTransactionsDTO>> getTransactions(int
return (PaginatedResponse<Set<DirectBillingTransactionsDTO>>) restService.sendGetRequest(endpoint, parameterizedType);
}

public Response<DirectBillingTransactionDetailsDTO> getTransactionDetails(int serviceId, int transactionId) {
var endpoint = String.format("/directbilling/%d/transactions/%d", serviceId, transactionId);
public Response<DirectBillingTransactionDetailsDTO> getTransactionDetails(int serviceId, String transactionId) {
var endpoint = String.format("/directbilling/%d/transactions/%s", serviceId, transactionId);
var parameterizedType = Types.newParameterizedType(Response.class, DirectBillingTransactionDetailsDTO.class);
return (Response<DirectBillingTransactionDetailsDTO>) restService.sendGetRequest(endpoint, parameterizedType);
}
Expand All @@ -85,7 +85,7 @@ public boolean checkSignature(String key, String transactionJson) {

private String generateSignature(String key, DirectBillingTransactionNotificationDTO notification) {
var pipe = "|";
var fields = List.of(String.valueOf(notification.id()), notification.status().getStatusName(), String.valueOf(notification.values().net()), String.valueOf(notification.values().gross()), String.valueOf(notification.values().partner()), notification.returns().success(), notification.returns().failure(), notification.control(), notification.number(), String.valueOf(notification.provider()), notification.signature(), key);
var fields = List.of(String.valueOf(notification.id()), notification.status().getStatusName(), String.valueOf(notification.values().net()), String.valueOf(notification.values().gross()), String.valueOf(notification.values().partner()), notification.returns().success(), notification.returns().failure(), notification.control(), notification.numberFrom(), String.valueOf(notification.provider()), notification.signature(), key);
return Hashing.sha256().hashString(String.join(pipe, fields), StandardCharsets.UTF_8).toString();
}

Expand Down

0 comments on commit 6db17a4

Please sign in to comment.