Skip to content

Commit

Permalink
test: rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarlic committed Aug 20, 2024
1 parent cc942f0 commit e72aa33
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
22 changes: 10 additions & 12 deletions src/test/java/webpayplus/WebpayPlusDeferredTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ public void commit() throws IOException, TransactionCommitException {
String authorizationCode3 = "1213";
String paymentTypeCode3 = "VN";
byte responseCode3 = 0;
double installmentsAmount;
byte installmentsNumber = 0;
double balance;
byte installmentsNumber3 = 0;

Map<String, Object> mapResponse = generateCommitJsonResponse();
Gson gson = new GsonBuilder().create();
Expand All @@ -138,7 +136,7 @@ public void commit() throws IOException, TransactionCommitException {
assertEquals(paymentTypeCode3, response.getPaymentTypeCode());
assertEquals(responseCode3, response.getResponseCode());

assertEquals(installmentsNumber, response.getInstallmentsNumber());
assertEquals(installmentsNumber3, response.getInstallmentsNumber());
}


Expand All @@ -147,7 +145,7 @@ public void refund() throws IOException, TransactionRefundException {

String url = String.format("/%s/transactions/%s/refunds", apiUrl, testToken);

double amount = 1000d;
double amount3 = 1000d;
String type = "REVERSED";

Map<String, Object> mapResponse = new HashMap<String, Object>();
Expand All @@ -157,7 +155,7 @@ public void refund() throws IOException, TransactionRefundException {
String jsonResponse = gson.toJson(mapResponse);
setResponsePost(url, jsonResponse);

final WebpayPlusTransactionRefundResponse response = (new WebpayPlus.Transaction(option)).refund(testToken, amount);
final WebpayPlusTransactionRefundResponse response = (new WebpayPlus.Transaction(option)).refund(testToken, amount3);
assertEquals(response.getType(), type);

}
Expand Down Expand Up @@ -192,13 +190,13 @@ public void capture() throws IOException, TransactionCaptureException {

String url = String.format("/%s/transactions/%s/capture", apiUrl, testToken);

String authorizationCode = "1213";
String authorizationDate = "2021-08-01T03:17:42.785Z";
String authorizationCode3 = "1213";
String authorizationDate3 = "2021-08-01T03:17:42.785Z";
double capturedAmount = 1000.0;
byte responseCode = 0;
Map<String, Object> mapResponse = new HashMap<String, Object>();
mapResponse.put("authorization_code", authorizationCode);
mapResponse.put("authorization_date", authorizationDate);
mapResponse.put("authorization_code", authorizationCode3);
mapResponse.put("authorization_date", authorizationDate3);
mapResponse.put("captured_amount", capturedAmount);
mapResponse.put("response_code", responseCode);

Expand All @@ -211,8 +209,8 @@ public void capture() throws IOException, TransactionCaptureException {
double amount = 1000;

final WebpayPlusTransactionCaptureResponse response = (new WebpayPlus.Transaction(option)).capture(testToken, buyOrder, authorization, amount);
assertEquals(authorizationCode, response.getAuthorizationCode());
assertEquals(authorizationDate, response.getAuthorizationDate());
assertEquals(authorizationCode3, response.getAuthorizationCode());
assertEquals(authorizationDate3, response.getAuthorizationDate());
assertEquals(capturedAmount, response.getCapturedAmount());
assertEquals(responseCode, response.getResponseCode());
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/webpayplus/WebpayPlusMallTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public void create() throws IOException, TransactionCreateException {
setResponsePost(url, jsonResponse);
String returnUrl = "http://wwww.google.com";

String buyOrder = String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
String sessionId = String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
String buyOrder3 = String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
String sessionId3 = String.valueOf(new Random().nextInt(Integer.MAX_VALUE));

String buyOrderMallOne = String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
double amountMallOne = 1000;
Expand All @@ -102,7 +102,7 @@ public void create() throws IOException, TransactionCreateException {
.add(amountMallOne, mallOneCommerceCode, buyOrderMallOne)
.add(amountMallTwo, mallTwoCommerceCode, buyOrderMallTwo);

final WebpayPlusMallTransactionCreateResponse response = (new WebpayPlus.MallTransaction(option)).create(buyOrder, sessionId, returnUrl, mallDetails);
final WebpayPlusMallTransactionCreateResponse response = (new WebpayPlus.MallTransaction(option)).create(buyOrder3, sessionId3, returnUrl, mallDetails);
assertEquals(response.getToken(), testToken);
assertEquals(response.getUrl(), urlResponse);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/webpayplus/WebpayPlusTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void refund() throws IOException, TransactionRefundException {

String url = String.format("/%s/transactions/%s/refunds", apiUrl, testToken);

double amount = 1000d;
double amount3 = 1000d;
String type = "REVERSED";

Map<String, Object> mapResponse = new HashMap<String, Object>();
Expand All @@ -150,7 +150,7 @@ public void refund() throws IOException, TransactionRefundException {
String jsonResponse = gson.toJson(mapResponse);
setResponsePost(url, jsonResponse);

final WebpayPlusTransactionRefundResponse response = (new WebpayPlus.Transaction(option)).refund(testToken, amount);
final WebpayPlusTransactionRefundResponse response = (new WebpayPlus.Transaction(option)).refund(testToken, amount3);
assertEquals(type, response.getType());

}
Expand Down

0 comments on commit e72aa33

Please sign in to comment.