Skip to content

Commit

Permalink
Update source test
Browse files Browse the repository at this point in the history
  • Loading branch information
AnasNaouchi committed Sep 5, 2024
1 parent 71e6d12 commit 28893b4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/java/co/omise/requests/SourceRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;

import co.omise.models.OmiseException;
import co.omise.models.Shipping;
import co.omise.models.Source;
import co.omise.models.SourceType;
import co.omise.testutils.TestSourceRequestBuilder;
Expand All @@ -15,13 +16,22 @@ public class SourceRequestTest extends RequestTest {

@Test
public void testCreate() throws IOException, OmiseException {

Shipping shipping = new Shipping();
shipping.country = "TH";
shipping.postalCode = "000000";
shipping.street1 = "Street";

Request<Source> request = new Source.CreateRequestBuilder()
.amount(100000)
.currency("thb")
.type(SourceType.Alipay)
.billing(shipping)
.promotionCode("code")
.build();

Source source = getTestRequester().sendRequest(request);
assertRequestBody("{\"amount\":100000,\"bank\":null,\"barcode\":null,\"currency\":\"thb\",\"email\":null,\"ip\":null,\"name\":null,\"type\":\"alipay\",\"shipping\":null,\"billing\":{\"street1\":\"Street\",\"street2\":null,\"city\":null,\"state\":null,\"country\":\"TH\",\"postal_code\":\"000000\"},\"installment_term\":0,\"mobile_number\":null,\"store_id\":null,\"store_name\":null,\"terminal_id\":null,\"zero_interest_installments\":false,\"platform_type\":null,\"phone_number\":null,\"items\":null,\"promotion_code\":\"code\"}");

assertRequested("POST", "/sources", 200);
assertEquals(100000L, source.getAmount());
Expand Down

0 comments on commit 28893b4

Please sign in to comment.