forked from openMF/ph-ee-integration-test
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create test case for airtel-connector.
- Loading branch information
Showing
13 changed files
with
173 additions
and
22 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/java/org/mifos/integrationtest/config/AirtelConfig.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.mifos.integrationtest.config; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
@ConfigurationProperties(prefix = "airtel-connector.mock-airtel") | ||
@Component | ||
public class AirtelConfig { | ||
|
||
@Value("${airtel-connector.contactpoint}") | ||
public String airtelConnectorContactPoint; | ||
|
||
@Value("${callback_url}") | ||
public String callbackURL; | ||
} |
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
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
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
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
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
61 changes: 61 additions & 0 deletions
61
src/test/java/org/mifos/integrationtest/cucumber/stepdef/AirtelStepDef.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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.mifos.integrationtest.cucumber.stepdef; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import io.cucumber.java.en.And; | ||
import io.cucumber.java.en.Given; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
import org.mifos.integrationtest.common.CollectionHelper; | ||
import org.mifos.integrationtest.config.AirtelConfig; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
public class AirtelStepDef extends BaseStepDef { | ||
|
||
@Autowired | ||
AirtelConfig airtelConfig; | ||
|
||
@Given("I have MSISDN as {string}") | ||
public void iHaveMSISDNAs(String msisdn) { | ||
scenarioScopeState.msisdn = msisdn; | ||
assertThat(scenarioScopeState.msisdn).isNotEmpty(); | ||
} | ||
|
||
@Given("I have clientCorrelationId as {string}") | ||
public void iHaveClientCorrelationIdAs(String clientCorrelationId) { | ||
scenarioScopeState.clientCorrelationId = clientCorrelationId; | ||
assertThat(scenarioScopeState.clientCorrelationId).isNotEmpty(); | ||
} | ||
|
||
@Given("I have accountId as {string}") | ||
public void iHaveAccountId(String accountId) { | ||
scenarioScopeState.accountId = accountId; | ||
assertThat(scenarioScopeState.accountId).isNotEmpty(); | ||
} | ||
|
||
@And("I have transaction id as {string}") | ||
public void iHaveTransactionIdAs(String transactionId) { | ||
scenarioScopeState.transactionId = transactionId; | ||
assertThat(scenarioScopeState.transactionId).isNotEmpty(); | ||
} | ||
|
||
@And("I have amount as {string}") | ||
public void iHaveAmountAs(String amount) { | ||
scenarioScopeState.amount = amount; | ||
assertThat(scenarioScopeState.amount).isNotEmpty(); | ||
} | ||
|
||
@And("I have currency as {string}") | ||
public void iHaveCurrencyAs(String currency) { | ||
scenarioScopeState.currency = currency; | ||
assertThat(scenarioScopeState.currency).isNotEmpty(); | ||
} | ||
|
||
@And("I have the request body with payer ams identifiers using keys MSISDN and accountId, currency {string}, and amount {string}") | ||
public void iHaveRequestBody(String currency, String amount) throws JSONException { | ||
JSONObject collectionRequestBody = CollectionHelper.getCollectionRequestBody(amount, currency, scenarioScopeState.msisdn, | ||
scenarioScopeState.accountId); | ||
scenarioScopeState.requestBody = collectionRequestBody; | ||
logger.info(String.valueOf(scenarioScopeState.requestBody)); | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@airtel | ||
Feature: Airtel Test | ||
|
||
Scenario: AM-001 | ||
Given I can inject MockServer | ||
And I can start mock server | ||
Then I should be able to get instance of mock server | ||
And I can register the stub with "/airtelCallback" endpoint for "POST" request with status of 200 | ||
Then I will update the mock server and register stub as done | ||
Given I have tenant as "payerfsp" | ||
And I have clientCorrelationId as "123456" | ||
And I have MSISDN as "1580354289" | ||
And I have accountId as "L000000001" | ||
And I have amount as "100" | ||
And I have currency as "KES" | ||
And I have the request body with payer ams identifiers using keys MSISDN and accountId, currency "KES", and amount "100" | ||
When I call the channel collection API with client correlation id, country "kenya", callback "/airtelCallback", payment schema "airtel" and expected status of 200 | ||
Then I should get transaction id in response | ||
Then I should be able to verify that the "POST" method to "/airtelCallback" endpoint received 1 request | ||
When I call the get txn API in ops app with transactionId as parameter | ||
Then I should get transaction state as completed and externalId not null | ||
|
||
Scenario: AM-002 | ||
Given I can inject MockServer | ||
And I can start mock server | ||
And I can register the stub with "/callback" endpoint for "POST" request with status of 200 | ||
Then I will update the mock server and register stub as done | ||
Given I have tenant as "payerfsp" | ||
And I have clientCorrelationId as "123456" | ||
And I have MSISDN as "6729461912" | ||
And I have accountId as "L000000001" | ||
And I have amount as "100" | ||
And I have currency as "KES" | ||
And I have the request body with payer ams identifiers using keys MSISDN and accountId, currency "KES", and amount "100" | ||
When I call the channel collection API with client correlation id, country "kenya", callback "/airtelCallback", payment schema "airtel" and expected status of 200 | ||
Then I should get transaction id in response | ||
When I call the get txn API in ops app with transactionId as parameter | ||
Then I should get transaction state as completed and externalId not null |
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