https://github.com/endelwar/gestpayws
PHP implementation of GestPay (Banca Sella) Web Service
https://github.com/endelwar/gestpayws
bancasella gestpay payment payment-gateway php soap
Last synced: about 1 year ago
JSON representation
PHP implementation of GestPay (Banca Sella) Web Service
- Host: GitHub
- URL: https://github.com/endelwar/gestpayws
- Owner: endelwar
- License: mit
- Created: 2015-02-23T18:27:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-08-13T06:52:12.000Z (almost 6 years ago)
- Last Synced: 2025-02-28T19:21:11.391Z (over 1 year ago)
- Topics: bancasella, gestpay, payment, payment-gateway, php, soap
- Language: PHP
- Size: 313 KB
- Stars: 7
- Watchers: 3
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# GestPayWS
[](https://packagist.org/packages/endelwar/gestpayws)
[](https://packagist.org/packages/endelwar/gestpayws)
[](https://travis-ci.org/pepeverde/GestPayWS)
[](https://scrutinizer-ci.com/g/pepeverde/GestPayWS/?branch=master)
[](https://coveralls.io/github/pepeverde/GestPayWS?branch=master)
PHP implementation of GestPay (Banca Sella) Web Services
## Highlights
- Simple API
- Decoupled classes
- PHPUnit tested
- Framework agnostic
- Composer ready, [PSR-2][] and [PSR-4][] compliant
## System Requirements
You need **PHP >= 5.6** and the `soap` extension to use the library, but the latest stable version of PHP is recommended.
## Install
Install `EndelWar/GestPayWS` using Composer.
```
$ composer require endelwar/gestpayws
```
## Using
### Crypt
``` php
require __DIR__ . '/../vendor/autoload.php';
use EndelWar\GestPayWS\WSCryptDecryptSoapClient;
use EndelWar\GestPayWS\WSCryptDecrypt;
use EndelWar\GestPayWS\Parameter\EncryptParameter;
use EndelWar\GestPayWS\Data;
// enable or disable test environment
$enableTestEnv = true;
$soapClient = new WSCryptDecryptSoapClient($enableTestEnv);
try {
$gestpay = new WSCryptDecrypt($soapClient->getSoapClient());
} catch (\Exception $e) {
var_dump($e->getCode(), $e->getMessage());
}
// set mandatory info
$encryptParameter = new EncryptParameter();
$encryptParameter->shopLogin = 'GESPAY12345';
$encryptParameter->amount = '1.23';
$encryptParameter->shopTransactionId = '1';
$encryptParameter->uicCode = Data\Currency::EUR;
$encryptParameter->languageId = Data\Language::ITALIAN;
// set optional custom info as array
$customArray = array('STORE_ID' => '42', 'STORE_NAME' => 'Shop Abc123');
$encryptParameter->setCustomInfo($customArray);
// encrypt data
$encryptResult = $gestpay->encrypt($encryptParameter);
// get redirect link to Banca Sella
echo $encryptResult->getPaymentPageUrl($encryptParameter->shopLogin, $soapClient->wsdlEnvironment);
```
### Decrypt
``` php
require __DIR__ . '/../vendor/autoload.php';
use EndelWar\GestPayWS\Parameter\DecryptParameter;
use EndelWar\GestPayWS\WSCryptDecryptSoapClient;
use EndelWar\GestPayWS\WSCryptDecrypt;
// $_GET['a'] and $_GET['b'] are received from Banca Sella
$param = array(
'shopLogin' => $_GET['a'],
'CryptedString' => $_GET['b']
);
$decryptParam = new DecryptParameter($param);
// enable or disable test environment
$enableTestEnv = true;
$soapClient = new WSCryptDecryptSoapClient($enableTestEnv);
try {
$gestpay = new WSCryptDecrypt($soapClient->getSoapClient());
$decryptResult = $gestpay->decrypt($decryptParam);
echo $decryptResult->TransactionResult;
} catch (\Exception $e) {
var_dump($e->getCode(), $e->getMessage());
}
```
## Testing
`EndelWar/GestPayWS` has a [PHPUnit](https://phpunit.de) test suite. To run the tests, run the following command from the project folder.
``` bash
$ vendor/bin/phpunit
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Versioning
Semantic versioning ([semver](http://semver.org/)) is applied.
## License
This library is under the MIT license. For the full copyright and license information, please view the LICENSE file that
was distributed with this source code.
[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md