Skip to content

Commit

Permalink
Fix handwritten test
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiechayes committed Nov 1, 2023
1 parent 071ea7f commit d060378
Showing 1 changed file with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.konfigthis.splitit.client.ApiClient;
import com.konfigthis.splitit.client.ApiException;
import com.konfigthis.splitit.client.Configuration;
import com.konfigthis.splitit.client.Splitit;
import com.konfigthis.splitit.client.auth.OAuth;
import com.konfigthis.splitit.client.model.*;
import org.junit.jupiter.api.Test;
Expand All @@ -17,31 +19,30 @@ public class SimpleInstallmentPlanApiTest {
*/
@Test
public void createInstallmentPlanTest() throws ApiException {
// String clientId = System.getenv("SPLITIT_CLIENT_ID");
// String secretId = System.getenv("SPLITIT_CLIENT_SECRET");
ApiClient defaultClient = new ApiClient();
defaultClient.setBasePath("http://127.0.0.1:4010");
OAuth auth = (OAuth) defaultClient.getAuthentication("oauth");
auth.setAccessToken("dummy_token");
InstallmentPlanApi api = new InstallmentPlanApi(defaultClient);
InitiatePlanResponse result = api
.post(true, new Date().toString(), new Date().toString())
.attempt3dSecure(true)
.planData(new PlanDataModel()
.totalAmount(10)
.numberOfInstallments(10)
.currency("USD")
.purchaseMethod(PurchaseMethod.INSTORE))
.shopper(new ShopperData()
.email("[email protected]"))
.billingAddress(new AddressDataModel()
.addressLine1("144 Union St")
.city("Brooklyn")
.state("North Dakota")
.zip("11231")
.country("United States"))
.redirectUrls(new InitiateRedirectionEndpointsModel())
.execute();
Configuration configuration = new Configuration();
configuration.clientId = System.getenv("SPLITIT_CLIENT_ID");
configuration.clientSecret = System.getenv("SPLITIT_CLIENT_SECRET");
configuration.host = "https://web-api-v3.sandbox.splitit.com";
configuration.tokenUrl = "https://id.sandbox.splitit.com/connect/token";
Splitit splitit = new Splitit(configuration);
InitiatePlanResponse result = splitit.installmentPlan
.post(true, new Date().toString(), new Date().toString())
.attempt3dSecure(true)
.planData(new PlanDataModel()
.totalAmount(10)
.numberOfInstallments(10)
.currency("USD")
.purchaseMethod(PurchaseMethod.INSTORE))
.shopper(new ShopperData()
.email("[email protected]"))
.billingAddress(new AddressDataModel()
.addressLine1("144 Union St")
.city("Brooklyn")
.state("North Dakota")
.zip("11231")
.country("United States"))
.redirectUrls(new InitiateRedirectionEndpointsModel())
.execute();
System.out.println(result);
assertNotNull("Received null response", result);
}
Expand Down

0 comments on commit d060378

Please sign in to comment.