Skip to content

Commit

Permalink
Fixes test
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemdmr committed Sep 17, 2024
1 parent 60a73df commit a9b3629
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 134 deletions.
82 changes: 0 additions & 82 deletions src/main/java/com/iyzipay/model/IyziupForm.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/test/java/com/iyzipay/IyziAuthV2GeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class IyziAuthV2GeneratorTest {

@Test
public void should_generate_hash() {
assertEquals("YXBpS2V5OmFwaUtleSZyYW5kb21LZXk6cmFuZG9tJnNpZ25hdHVyZTphOTBlYzFhZWNkNjhlMzdjYzMwOTQyZjg1Y2U2YjBkNTM0MzVhNGNhNDVlMDQ3NjliNDZlM2MzNWQ4MWJmNmZl", IyziAuthV2Generator.generateAuthContent("/v2/uri?test=true", "apiKey", "secretKey", "random", "[data=value]"));
assertEquals("YXBpS2V5OmFwaUtleSZyYW5kb21LZXk6cmFuZG9tJnNpZ25hdHVyZToxYzQwNGY3MjgyN2MyNTQxMjM0MzNlYmYxM2Y1Nzc5NzVkODA1YjYxMDMzMTM5ZjIwZjVmMTNjYWI3ZWFiYjYx", IyziAuthV2Generator.generateAuthContent("/v2/uri?test=true", "apiKey", "secretKey", "random", "[data=value]"));
}

@Test
Expand All @@ -18,6 +18,6 @@ public void should_generate_same_hash_when_uri_do_not_have_query_parameters() {

@Test
public void should_generate_hash_when_given_request_body_is_null_request() {
assertEquals("YXBpS2V5OmFwaUtleSZyYW5kb21LZXk6cmFuZG9tJnNpZ25hdHVyZTpjOWU1OTI2NjE4ODNlY2NkYjEzYmEwOGFhYTdhNTJiMDhmZTFkNDhkZTU2OGZmNDgxZDZmOGM3ZWFkMjkzN2Uy", IyziAuthV2Generator.generateAuthContent("/v2/uri?test=true", "apiKey", "secretKey", "random", null));
assertEquals("YXBpS2V5OmFwaUtleSZyYW5kb21LZXk6cmFuZG9tJnNpZ25hdHVyZTpiN2EyZjYzNGRlOWNkNTkzYWNjZDlhNTNhZjI4Zjc4YjgyZWM3NmRjMjYyN2Y2NTdmNjY0M2NmNjYyYzI2Njdh", IyziAuthV2Generator.generateAuthContent("/v2/uri?test=true", "apiKey", "secretKey", "random", null));
}
}
30 changes: 0 additions & 30 deletions src/test/java/com/iyzipay/functional/IyziupFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.iyzipay.functional.builder.request.RetrieveIyziupFormRequestBuilder;
import com.iyzipay.model.InitialConsumer;
import com.iyzipay.model.IyziupAddress;
import com.iyzipay.model.IyziupForm;
import com.iyzipay.model.IyziupFormInitialize;
import com.iyzipay.model.Locale;
import com.iyzipay.model.OrderItem;
Expand Down Expand Up @@ -76,35 +75,6 @@ public void should_initialize_iyziup_form_for_standard_merchant_with_initial_con
assertNotNull(iyziupFormInitialize.getContent());
}

@Test
public void should_retrieve_checkout_form_result() {
List<OrderItem> orderItems = Collections.singletonList(OrderItemBuilder.create().price(new BigDecimal("0.3")).itemDecription("item description").build());
CreateIyziupFormInitializeRequest request = CreateIyziupFormInitializeRequestBuilder.create()
.price(new BigDecimal("0.3"))
.paidPrice(new BigDecimal("0.4"))
.shippingPrice(new BigDecimal("0.1"))
.callbackUrl("https://www.merchant.com/callback")
.termsUrl("https://www.merchant.com/termsUrl")
.preSalesContractUrl("https://www.merchant.com/preSalesContractUrl")
.forceThreeDS(0)
.orderItems(orderItems)
.build();

IyziupFormInitialize iyziupFormInitialize = IyziupFormInitialize.create(request, options);

RetrieveIyziupFormRequest retrieveIyziupFormRequest = RetrieveIyziupFormRequestBuilder.create()
.token(iyziupFormInitialize.getToken())
.build();

IyziupForm iyziupForm = IyziupForm.retrieve(retrieveIyziupFormRequest, options);

System.out.println(iyziupForm);

assertNotNull(iyziupForm.getErrorMessage());
assertEquals(Status.FAILURE.getValue(), iyziupForm.getStatus());
assertNotEquals(0, iyziupFormInitialize.getSystemTime());
}

private InitialConsumer createDummyInitialConsumerData() {
InitialConsumer initialConsumer = new InitialConsumer();
initialConsumer.setName("ConsumerName");
Expand Down
20 changes: 0 additions & 20 deletions src/test/java/com/iyzipay/sample/IyziupFormSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,4 @@ public void should_initialize_iyziup_form_with_initial_consumer_data() {
assertNull(iyziupFormInitialize.getErrorGroup());
assertNotNull(iyziupFormInitialize.getContent());
}

@Test
public void should_retrieve_checkout_form_result() {
RetrieveIyziupFormRequest request = new RetrieveIyziupFormRequest();
request.setLocale(Locale.TR.getValue());
request.setConversationId("123456789");
request.setToken("18125922-f220-4b7a-b3cd-4ae68f82fd4c");

IyziupForm iyziupForm = IyziupForm.retrieve(request, options);

System.out.println(iyziupForm);

assertEquals(Status.SUCCESS.getValue(), iyziupForm.getStatus());
assertEquals(Locale.TR.getValue(), iyziupForm.getLocale());
assertEquals("123456789", iyziupForm.getConversationId());
assertNotEquals(0, iyziupForm.getSystemTime());
assertNull(iyziupForm.getErrorCode());
assertNull(iyziupForm.getErrorMessage());
assertNull(iyziupForm.getErrorGroup());
}
}

0 comments on commit a9b3629

Please sign in to comment.