From a9b3629cd6f52670781b472a5ebd0eab7b9b9621 Mon Sep 17 00:00:00 2001 From: Erdem Demir Date: Tue, 17 Sep 2024 10:32:29 +0300 Subject: [PATCH] Fixes test --- .../java/com/iyzipay/model/IyziupForm.java | 82 ------------------- .../com/iyzipay/IyziAuthV2GeneratorTest.java | 4 +- .../iyzipay/functional/IyziupFormTest.java | 30 ------- .../com/iyzipay/sample/IyziupFormSample.java | 20 ----- 4 files changed, 2 insertions(+), 134 deletions(-) delete mode 100644 src/main/java/com/iyzipay/model/IyziupForm.java diff --git a/src/main/java/com/iyzipay/model/IyziupForm.java b/src/main/java/com/iyzipay/model/IyziupForm.java deleted file mode 100644 index 80d57018..00000000 --- a/src/main/java/com/iyzipay/model/IyziupForm.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.iyzipay.model; - -import com.iyzipay.HttpClient; -import com.iyzipay.IyzipayResource; -import com.iyzipay.Options; -import com.iyzipay.request.RetrieveIyziupFormRequest; - -public class IyziupForm extends IyzipayResource { - - private String orderResponseStatus; - private String token; - private String callbackUrl; - private Consumer consumer; - private Address shippingAddress; - private Address billingAddress; - private IyziupPayment paymentDetail; - - public static IyziupForm retrieve(RetrieveIyziupFormRequest request, Options options) { - String path = "/v1/iyziup/form/order/retrieve"; - return HttpClient.create().post(options.getBaseUrl() + path, - getHttpProxy(options), - getHttpHeadersV2(path, request, options), - request, - IyziupForm.class); - } - - public String getOrderResponseStatus() { - return orderResponseStatus; - } - - public void setOrderResponseStatus(String orderResponseStatus) { - this.orderResponseStatus = orderResponseStatus; - } - - public Consumer getConsumer() { - return consumer; - } - - public void setConsumer(Consumer consumer) { - this.consumer = consumer; - } - - public Address getShippingAddress() { - return shippingAddress; - } - - public void setShippingAddress(Address shippingAddress) { - this.shippingAddress = shippingAddress; - } - - public Address getBillingAddress() { - return billingAddress; - } - - public void setBillingAddress(Address billingAddress) { - this.billingAddress = billingAddress; - } - - public IyziupPayment getPaymentDetail() { - return paymentDetail; - } - - public void setPaymentDetail(IyziupPayment paymentDetail) { - this.paymentDetail = paymentDetail; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } -} diff --git a/src/test/java/com/iyzipay/IyziAuthV2GeneratorTest.java b/src/test/java/com/iyzipay/IyziAuthV2GeneratorTest.java index 36529a04..11f306ba 100644 --- a/src/test/java/com/iyzipay/IyziAuthV2GeneratorTest.java +++ b/src/test/java/com/iyzipay/IyziAuthV2GeneratorTest.java @@ -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 @@ -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)); } } \ No newline at end of file diff --git a/src/test/java/com/iyzipay/functional/IyziupFormTest.java b/src/test/java/com/iyzipay/functional/IyziupFormTest.java index 86d7a0df..5f552101 100644 --- a/src/test/java/com/iyzipay/functional/IyziupFormTest.java +++ b/src/test/java/com/iyzipay/functional/IyziupFormTest.java @@ -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; @@ -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 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"); diff --git a/src/test/java/com/iyzipay/sample/IyziupFormSample.java b/src/test/java/com/iyzipay/sample/IyziupFormSample.java index afadc70a..89c01aa2 100644 --- a/src/test/java/com/iyzipay/sample/IyziupFormSample.java +++ b/src/test/java/com/iyzipay/sample/IyziupFormSample.java @@ -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()); - } }