-
Notifications
You must be signed in to change notification settings - Fork 52
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
8d715bf
commit e0acd0c
Showing
27 changed files
with
2,804 additions
and
2,115 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
141 changes: 71 additions & 70 deletions
141
...c/test/java/com/mastercard/openbanking/client/api/AccountValidationAssistanceApiTest.java
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 |
---|---|---|
@@ -1,85 +1,86 @@ | ||
/* | ||
* Open Banking | ||
* OpenAPI specification for Finicity APIs. Open Banking solutions in the US are provided by Finicity, a Mastercard company. | ||
* | ||
* The version of the OpenAPI document: 1.17.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
package com.mastercard.openbanking.client.api; | ||
|
||
import com.mastercard.openbanking.client.ApiException; | ||
import com.mastercard.openbanking.client.model.ErrorMessage; | ||
import com.mastercard.openbanking.client.model.InitiatedMicroDeposit; | ||
import com.mastercard.openbanking.client.model.MicroDepositDetails; | ||
import com.mastercard.openbanking.client.model.MicroDepositInitiation; | ||
import com.mastercard.openbanking.client.model.MicroDepositVerification; | ||
import com.mastercard.openbanking.client.test.BaseTest; | ||
import com.mastercard.openbanking.client.test.ModelFactory; | ||
import com.mastercard.openbanking.client.model.MicroDepositVerificationError; | ||
import com.mastercard.openbanking.client.model.VerifiedMicroDeposit; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
|
||
public class AccountValidationAssistanceApiTest extends BaseTest { | ||
|
||
private static final AccountValidationAssistanceApi api = new AccountValidationAssistanceApi(apiClient); | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* API tests for AccountValidationAssistanceApi | ||
*/ | ||
@Disabled | ||
public class AccountValidationAssistanceApiTest { | ||
|
||
private final AccountValidationAssistanceApi api = new AccountValidationAssistanceApi(); | ||
|
||
/** | ||
* Get Micro Entries Details | ||
* | ||
* Fetch the micro entries details. `customerId` and `accountId` are the identifiers of the customer and account receiving the micro entries. _Supported regions_: ![🇺🇸](https://flagcdn.com/20x15/us.png) | ||
* | ||
* @throws ApiException if the Api call fails | ||
*/ | ||
@Test | ||
public void initiateMicroAmountDepositsTest() { | ||
try { | ||
// GIVEN | ||
String customerId = createTestCustomer(); | ||
|
||
// WHEN | ||
var response = api.initiateMicroAmountDeposits(customerId, ModelFactory.newMicroDepositInitiation()); | ||
|
||
// THEN | ||
assertNotNull(response); | ||
assertNotNull(response.getAccountId()); | ||
} catch (ApiException e) { | ||
fail(e); | ||
} | ||
public void getMicroDepositsDetailsTest() throws ApiException { | ||
String customerId = null; | ||
String accountId = null; | ||
MicroDepositDetails response = api.getMicroDepositsDetails(customerId, accountId); | ||
// TODO: test validations | ||
} | ||
|
||
/** | ||
* Initiate Micro Entries | ||
* | ||
* Initiate the micro entries to customer's account. Two random micro amounts less than a dollar each will be deposited to provided customer's account. _Supported regions_: ![🇺🇸](https://flagcdn.com/20x15/us.png) | ||
* | ||
* @throws ApiException if the Api call fails | ||
*/ | ||
@Test | ||
public void getMicroDepositsDetailsTest() { | ||
try { | ||
// GIVEN | ||
String customerId = createTestCustomer(); | ||
var response = api.initiateMicroAmountDeposits(customerId, ModelFactory.newMicroDepositInitiation()); | ||
var accountId = response.getAccountId(); | ||
|
||
// WHEN | ||
var details = api.getMicroDepositsDetails(customerId, accountId); | ||
|
||
// THEN | ||
assertNotNull(details); | ||
assertNotNull(details.getStatus()); | ||
} catch (ApiException e) { | ||
fail(e); | ||
} | ||
public void initiateMicroAmountDepositsTest() throws ApiException { | ||
String customerId = null; | ||
MicroDepositInitiation microDepositInitiation = null; | ||
InitiatedMicroDeposit response = api.initiateMicroAmountDeposits(customerId, microDepositInitiation); | ||
// TODO: test validations | ||
} | ||
|
||
/** | ||
* Verify Micro Entries | ||
* | ||
* Verify the micro entries as received by customer in customer's account. Customer needs to verify the micro amounts received in customer's account. `customerId` and `accountId` are the identifiers of the customer and account receiving the micro entries. _Supported regions_: ![🇺🇸](https://flagcdn.com/20x15/us.png) | ||
* | ||
* @throws ApiException if the Api call fails | ||
*/ | ||
@Test | ||
public void verifyMicroAmountDepositsTest() { | ||
try { | ||
// GIVEN | ||
String customerId = createTestCustomer(); | ||
var response = api.initiateMicroAmountDeposits(customerId, ModelFactory.newMicroDepositInitiation()); | ||
var accountId = response.getAccountId(); | ||
String status; | ||
do { | ||
var details = api.getMicroDepositsDetails(customerId, accountId); | ||
status = details.getStatus(); | ||
} while (!"Completed".equals(status)); | ||
|
||
// WHEN | ||
var verification = new MicroDepositVerification().amounts(Arrays.asList(0.01F, 0.02F)); | ||
var verifyResponse = api.verifyMicroAmountDeposits(customerId, accountId, verification); | ||
|
||
// THEN | ||
assertNotNull(verifyResponse); | ||
assertNotNull(verifyResponse.getStatus()); | ||
} catch (ApiException e) { | ||
fail(e); | ||
} | ||
public void verifyMicroAmountDepositsTest() throws ApiException { | ||
String customerId = null; | ||
String accountId = null; | ||
MicroDepositVerification microDepositVerification = null; | ||
VerifiedMicroDeposit response = api.verifyMicroAmountDeposits(customerId, accountId, microDepositVerification); | ||
// TODO: test validations | ||
} | ||
|
||
private static String createTestCustomer() throws ApiException { | ||
var customer = customersApi.addTestingCustomer(ModelFactory.newCustomer()); | ||
var customerId = customer.getId(); | ||
createdCustomerIds.add(customerId); | ||
return customerId; | ||
} | ||
} | ||
} |
Oops, something went wrong.