-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from openpesa/develop
add main features
- Loading branch information
Showing
39 changed files
with
1,138 additions
and
61 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
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,5 +1,9 @@ | ||
build | ||
composer.lock | ||
docs | ||
|
||
vendor | ||
coverage | ||
coverage | ||
|
||
.idea | ||
/examples/http-client.private.env.json | ||
/examples/my-simple.php |
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,21 +1,42 @@ | ||
language: php | ||
|
||
php: | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
# - 7.1 | ||
# - 7.2 | ||
- 7.3 | ||
|
||
env: | ||
matrix: | ||
- COMPOSER_FLAGS="--prefer-lowest" | ||
- COMPOSER_FLAGS="" | ||
# env: | ||
# matrix: | ||
# - COMPOSER_FLAGS="--prefer-lowest" | ||
# - COMPOSER_FLAGS="" | ||
|
||
# cache: | ||
# directories: | ||
# - $HOME/.composer/cache | ||
|
||
before_install: | ||
- nvm install stable | ||
- nvm use stable | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source | ||
# - travis_retry composer self-update | ||
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source | ||
- cd docs && npm install && cd .. | ||
|
||
script: | ||
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover | ||
# - ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover | ||
- ./vendor/bin/phpunit --coverage-clover coverage.xml | ||
- cd docs && npm run build && cd .. | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
|
||
after_script: | ||
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover | ||
deploy: | ||
provider: pages | ||
strategy: git | ||
skip_cleanup: true | ||
local_dir: ./docs/src/.vuepress/dist | ||
token: $GITHUB_TOKEN | ||
keep_history: true | ||
on: | ||
branch: develop |
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 |
---|---|---|
@@ -1,66 +1,110 @@ | ||
# Pesa SDK | ||
# Pesa SDK for PHP | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/openpesa/pesa.svg?style=flat-square)](https://packagist.org/packages/openpesa/pesa) | ||
[![Build Status](https://img.shields.io/travis/openpesa/pesa/master.svg?style=flat-square)](https://travis-ci.org/openpesa/pesa) | ||
[![Quality Score](https://img.shields.io/scrutinizer/g/openpesa/pesa.svg?style=flat-square)](https://scrutinizer-ci.com/g/openpesa/pesa) | ||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/openpesa/pesa.svg?style=flat-square&?include_prereleases)](https://packagist.org/packages/openpesa/pesa) | ||
[![Build Status](https://img.shields.io/travis/openpesa/php-pesa/develop.svg?style=flat-square)](https://travis-ci.org/openpesa/php-pesa) | ||
[![codecov.io](https://codecov.io/github/openpesa/php-pesa/coverage.svg)](https://codecov.io/github/openpesa/php-pesa) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/openpesa/pesa.svg?style=flat-square)](https://packagist.org/packages/openpesa/pesa) | ||
|
||
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors. | ||
The **Pesa SDK for PHP** makes it easy for developers to access [OpenAPI](https://openapiportal.m-pesa.com/) in their PHP code, and build robust applications and software using services like Customber 2 Bussiness, Query etc. | ||
|
||
## Installation | ||
## Documentation | ||
|
||
You can install the package via composer: | ||
Take a look at the [API docs here](https://php-pesa.netlify.app/). | ||
|
||
## Getting Started | ||
|
||
1. **Sign up for OpenAPI Portal** – Before you begin, you need to | ||
sign up for an account and retrieve your credentials. | ||
|
||
1. **Minimum requirements** – To run the SDK, your system will need to meet the | ||
[minimum requirements](https://php-pesa.netlify.app/docs/requirements.html), including having **PHP >= 7.1**. | ||
<!-- We highly recommend having it compiled with the cURL extension and cURL | ||
7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL). --> | ||
1. **Install the SDK** – Using [Composer] is the recommended way to install the | ||
Pesa SDK for PHP. The SDK is available via [Packagist] under the | ||
[`openpesa/php-pesa`](https://packagist.org/packages/openpesa/pesa) package. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency: | ||
```sh | ||
composer require openpesa/pesa | ||
``` | ||
Please see the | ||
[Installation section of the User Guide](https://php-pesa.netlify.app/docs/installation.html) for more | ||
detailed information about installing the SDK through Composer and other | ||
means. | ||
1. **Using the SDK** – The best way to become familiar with how to use the SDK | ||
is to read the [User Guide](https://php-pesa.netlify.app/docs/guide.html). | ||
|
||
<!-- The [Getting Started Guide](#) will help you become familiar with | ||
the basic concepts. --> | ||
|
||
```bash | ||
composer require openpesa/pesa | ||
``` | ||
|
||
## Usage | ||
|
||
``` php | ||
use Openpesa\SDK\Pesa; | ||
### Quick Examples | ||
|
||
```php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use Openpesa\SDK\Forodha; | ||
|
||
// Set the consumer key and consumer secret as follows | ||
$username = 'YOUR_USERNAME'; // use 'sandbox' for development in the test environment | ||
$apiKey = 'YOUR_API_KEY'; // use your sandbox app API key for development in the test environment | ||
// Intiate with credntials | ||
$forodha = new Forodha([ | ||
'api_key' => 'YOUR_API_KEY', | ||
'public_key' => 'PUBLIC_KEY', | ||
'client_options' => [], | ||
]); | ||
|
||
// Get one of the services | ||
$pesa = new Pesa($public_key, $apiKey); | ||
// Setup the transaction | ||
$data = [ | ||
'input_Amount' => '10000', | ||
'input_Country' => 'TZN', | ||
'input_Currency' => 'TZS', | ||
'input_CustomerMSISDN' => '255766303775', | ||
'input_ServiceProviderCode' => '000000', | ||
'input_ThirdPartyConversationID' => 'rerekf', | ||
'input_TransactionReference' => rand(), | ||
'input_PurchasedItemsDesc' => 'Test Two Item' | ||
]; | ||
|
||
// Use the service | ||
$result = $pesa->c2b($invoice_id, $phone_number, $amount, $reference_id, $shortcode); | ||
// Execute | ||
$result = $forodha->transact('c2b', $data); | ||
|
||
// Print results | ||
var_dump($result); | ||
|
||
print_r($result); | ||
``` | ||
|
||
For more example check [pesa-demo-example](https://github.com/openpesa/php-pesa/tree/develop/examples). | ||
|
||
### Testing | ||
|
||
``` bash | ||
```bash | ||
composer test | ||
``` | ||
|
||
## Opening Issues | ||
|
||
If you have a feature requrest or you encounter a bug, please file an issue on [our issue tracker on GitHub](https://github.com/openpesa/php-pesa/issues). | ||
|
||
### Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
Please review our [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
|
||
### Security | ||
|
||
If you discover any security related issues, please email alphaolomi@gmail.com instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [Alpha Olomi](https://github.com/openpesa) | ||
- [Ley](https://github.com/leyluj) | ||
- [All Contributors](../../contributors) | ||
- [Alpha Olomi](https://github.com/openpesa) | ||
- [Ley](https://github.com/leyluj) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. | ||
|
||
## PHP Package Boilerplate | ||
|
||
This package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com). |
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,12 @@ | ||
pids | ||
logs | ||
node_modules | ||
npm-debug.log | ||
coverage/ | ||
run | ||
dist | ||
.DS_Store | ||
.nyc_output | ||
.basement | ||
config.local.js | ||
basement_dist |
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,18 @@ | ||
{ | ||
"name": "php-pesa-docs", | ||
"version": "0.0.1", | ||
"description": "Pesa SDK for PHP", | ||
"authors": { | ||
"name": "Alpha Olomi", | ||
"email": "alphaolomi@gmail.com" | ||
}, | ||
"repository": "https://github.com/openpesa/php-pesa", | ||
"scripts": { | ||
"dev": "vuepress dev src", | ||
"build": "vuepress build src" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"vuepress": "^1.5.3" | ||
} | ||
} |
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,15 @@ | ||
<template> | ||
<p class="demo"> | ||
{{ msg }} | ||
</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data () { | ||
return { | ||
msg: 'Hello this is <Foo-Bar>' | ||
} | ||
} | ||
} | ||
</script> |
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,3 @@ | ||
<template> | ||
<p class="demo">This is another component</p> | ||
</template> |
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,15 @@ | ||
<template> | ||
<p class="demo"> | ||
{{ msg }} | ||
</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return { | ||
msg: 'Hello this is <demo-component>' | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.