-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
91 changed files
with
9,452 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: SDK CI Matrix Build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- 'lib/**' | ||
- 'tests/**' | ||
pull_request: | ||
branches: [ master ] | ||
paths: | ||
- 'lib/**' | ||
- 'tests/**' | ||
|
||
jobs: | ||
run: | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest, macos-latest] | ||
php-versions: ['7.3', '7.4', '8.0'] | ||
fail-fast: false | ||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, intl, dom, fileinfo, curl | ||
ini-values: post_max_size=256M | ||
coverage: none | ||
tools: phpunit | ||
|
||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --no-dev --no-suggest --prefer-dist --optimize-autoloader | ||
|
||
- name: Run PHP Unit | ||
run: phpunit |
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,60 @@ | ||
name: PHP Quicktest | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- 'lib/**' | ||
- 'tests/**' | ||
pull_request: | ||
branches: [ master ] | ||
types: [ opened, synchronize ] | ||
paths: | ||
- 'lib/**' | ||
- 'tests/**' | ||
|
||
jobs: | ||
quicktest: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, intl, dom, fileinfo, curl | ||
ini-values: post_max_size=256M | ||
coverage: xdebug | ||
tools: composer | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --no-suggest --prefer-dist --optimize-autoloader | ||
|
||
- name: Setup problem matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Run PHP Unit | ||
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml |
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,51 @@ | ||
name: PHP PSR Enforcer | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- 'lib/**' | ||
- 'tests/**' | ||
pull_request: | ||
branches: [ master ] | ||
types: [ opened, synchronize ] | ||
paths: | ||
- 'lib/**' | ||
- 'tests/**' | ||
|
||
jobs: | ||
phpcs: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, intl, curl | ||
ini-values: post_max_size=256M | ||
coverage: xdebug | ||
tools: composer | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist | ||
|
||
- name: Run PHPCS | ||
run: ./vendor/bin/phpcs |
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,24 @@ | ||
name: Release Creation Trigger | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '.github/**' | ||
- 'README.md' | ||
|
||
jobs: | ||
build: | ||
name: Triggered Release Creation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
fetch-depth: '0' | ||
- name: Bump version and push tag | ||
uses: anothrNick/github-tag-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
|
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 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: SDK Release | ||
|
||
jobs: | ||
build: | ||
name: SDK Release Creation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
- name: Get version | ||
id: vars | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | ||
- name: changelog | ||
uses: scottbrenner/generate-changelog-action@master | ||
id: Changelog | ||
env: | ||
REPO: ${{ github.repository }} | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag }} | ||
release_name: Release ${{ steps.vars.outputs.tag }} | ||
body: | | ||
${{ steps.Changelog.outputs.changelog }} | ||
draft: false | ||
prerelease: false |
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,4 @@ | ||
./vendor/** | ||
coverage.xml | ||
phpunit.xml | ||
zotapay-php-sdk-*.zip |
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,80 @@ | ||
[![codecov](https://codecov.io/gh/zotapay/php-sdk/branch/master/graph/badge.svg?token=6M6BPB0HYP)](https://codecov.io/gh/zotapay/php-sdk) | ||
[![action](https://github.com/zotapay/php-sdk/workflows/PHP%20Quicktest/badge.svg?branch=master)](https://github.com/zotapay/php-sdk/actions) | ||
[![action](https://github.com/zotapay/php-sdk/workflows/SDK%20CI%20Matrix%20Build/badge.svg?branch=master)](https://github.com/zotapay/php-sdk/actions) | ||
[![action](https://github.com/zotapay/php-sdk/workflows/PHP%20PSR%20Enforcer/badge.svg?branch=master)](https://github.com/zotapay/php-sdk/actions) | ||
|
||
# Official Zotapay PHP SDK | ||
|
||
This is the official page of the [Zotapay](https://www.zotapay.com) PHP SDK. It is intended to be used by developers who run modern PHP applications and would like to integrate our next generation payments platform. | ||
|
||
## Introduction | ||
PHP SDK provides all the neccessary methods for integrating the Zotapay Merchant API. This SDK is used by clients, as well as all the related eCommerce plugins for mainstream PHP applications. | ||
|
||
## Requirements | ||
- A functioning Zotapay Sandbox or Production account and related credentials | ||
- PHP version 7.2.0 or greater | ||
- Client URL Library (cURL) version 7.34.0 or greater | ||
- JSON extension enabled | ||
|
||
## Usage | ||
|
||
### Main configuration | ||
After all the files are loaded configuration is needed. This can be done with the static methods provided in Zotapay class. Configuration includes: | ||
- Credentials | ||
- API url - test or production environment | ||
- Endpoint | ||
- Logging threshold and location | ||
|
||
### API requests | ||
After everything is setup all requests to the API are made with the corresponding classes: | ||
* Deposit | ||
* DepositCC (deposit with Credit card data) | ||
* Payout | ||
* OrderStatus | ||
* OrdersReport | ||
|
||
Every request class consist of public request method with data object parameter. There are also private methods for preparation of the data and the signature. | ||
|
||
### Making the request | ||
First the data object has to be created and all the needed data setup with the setters (ex. DepositOrder). | ||
|
||
After that the request class (ex. Deposit) is created and the request method is called with the data object as parameter. | ||
|
||
### Retrieving the response | ||
Every request method returns response object with available getters. In every response object are included getters providing the code, the message and the data as they are received from the API. Also in every response object are included getters for the body of the response, the HTTP code and the JSON. All other getters are request specific and are available for easier usage of the response further. | ||
|
||
### Callback and Merchant redirect handlers | ||
Classes for callbacks and redirects handling are available with the corresponding getters: | ||
- `ApiCallback` | ||
- `MerchantRedirect` | ||
|
||
### Additional resources | ||
In addition DefaultLogger class is available for logging. The DefaultLogger includes eight methods for writing logs to the eight RFC 5424 levels (debug, info, notice, warning, error, critical, alert, emergency). | ||
|
||
## Examples | ||
Examples are available in `examples` folder. | ||
|
||
Loading and configuration: | ||
- `autoload.php` loads all the needed files as bootstrap. | ||
- `config.php` includes main configuration. | ||
* If needed differnet endpoint can be set for different requests. | ||
|
||
Requests: | ||
- `deposit.php` - Deposit request | ||
- `deposit-cc.php` - Deposit request with Credit card details | ||
- `payout.php` - Payout request | ||
- `order-status.php` - Order status request | ||
- `orders-report.php` - Orders report request | ||
|
||
Order Handlers: | ||
- `callback.php` - API Callback | ||
- `merchant-redirect.php` - API Merchant redirect | ||
|
||
Logging: | ||
- `logger.php` - DefaultLogger usage | ||
|
||
## Resources | ||
The Zotapay API guide can be found on the official API Documentation pages for [deposit](https://doc.zotapay.com/deposit/1.0/) and [payout](https://doc.zotapay.com/payout/1.0/) operations. | ||
|
||
## Support | ||
This SDK is supported by Zotapay. For sign-up and sales inquiries, please contact [email protected]. For Support, please use [email protected] and include customer identifiable information, along with a description of the issue. |
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,27 @@ | ||
{ | ||
"name": "zotapay/php-sdk", | ||
"description": "Zotapay PHP SDK", | ||
"type": "library", | ||
"authors": [ | ||
{ | ||
"name": "Zota Technology Ltd.", | ||
"email": "[email protected]", | ||
"homepage": "https://www.zotapay.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Zotapay\\": "lib/" | ||
} | ||
}, | ||
"require": {}, | ||
"require-dev": { | ||
"squizlabs/php_codesniffer": "3.5.5", | ||
"phpunit/phpunit": "^9.2" | ||
}, | ||
"support": { | ||
"email": "[email protected]", | ||
"homepage" : "https://www.zotapay.com" | ||
}, | ||
"license": "APACHE-2.0" | ||
} |
Oops, something went wrong.