This repository contains scenarios that can be run for UAT in Sandbox and E2E scenarios using DANA Client library with your choice of programming language (Python, Golang, PHP, Node). You can use it to:
- Automate running UAT scenarios in Sandbox with your credentials and the result can be downloaded in your Merchant Portal dashboard
- Find examples of E2E scenarios for each business solution
For documentation of each DANA Client library visit:
- Python: https://github.com/dana-id/dana-python
- Golang: https://github.com/dana-id/dana-go
- Node: https://github.com/dana-id/dana-node
- PHP: https://github.com/dana-id/dana-php
- Java: https://github.com/dana-id/dana-java
-
Set up your environment:
Clone this repo to your deployed sandbox system (can be in Kubernetes, VM, etc.)
git clone git@github.com:dana-id/uat-script.git cd uat-script -
Configure your credentials:
Change the
.env-examplefile name to.envand fill the data with your credentialscp .env-example .env
Edit the
.envfile with your credential information.Note:
- You can fill
PRIVATE_KEYandPRIVATE_KEY_PATHsimultaneously, but if you fill both and the key values are different, we will prioritize the key inPRIVATE_KEY_PATH. The same applied toDANA_PUBLIC_KEYandDANA_PUBLIC_KEY_PATH. TheCLIENT_SECRETenv is fordisbursementbusiness solution. - You can set
REDIRECT_URL_OAUTHto get auth code via url. - You can find your
EXTERNAL_SHOP_IDin your Merchant Portal account(Submerchant Menu).
- You can fill
-
Run the tests:
-
Run the command with your preferred programming language.
sh run-test.sh python
-
You can run the command with your specific business solution.
sh run-test.sh python payment_gateway
Note: You can find specific solution that you choose with this command
sh run-test.sh --list python
-
You can run the command with your specific API in business solution.
sh run-test.sh python payment_gateway create_order_test
Note: You can find specific API solution that you choose with this command. First, get your solution.
sh run-test.sh --list node
Copy paste solution to this command and delete slash
/, then continue like this example command.sh run-test.sh --list python payment_gateway
View the results in your terminal and in your Merchant Portal dashboard
-
Currently, the following programming languages are supported:
- Python
- Golang
- Node
- PHP
- Java
Additional language support will be added in future updates.
test/: Contains test scenarios for different business solutionsresource/: Contains request templates and fixtures
The test scenarios in this repository use a JSON-based approach for loading test data, which means the way API requests are made here may differ slightly from how you would use the libraries in your actual implementation (detailed in the library documentation):
Example in Python:
-
In this repository: Requests are loaded from JSON files and converted using
.from_dict()method# Test scenario approach json_dict = get_request(json_path_file, title_case, case_name) consult_pay_request_obj = ConsultPayRequest.from_dict(json_dict) api_instance.consult_pay(consult_pay_request_obj)
-
In your actual implementation: You would directly create request objects as shown in the library documentation
# Direct implementation approach request = ConsultPayRequest( merchant_id="YOUR_MERCHANT_ID", amount={"value": "10000.00", "currency": "IDR"}, additional_info={...} ) api_instance.consult_pay(request)