-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
071ea7f
commit d060378
Showing
1 changed file
with
26 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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); | ||
} | ||
|