定制 endelwar/gestpayws 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

endelwar/gestpayws

最新稳定版本:v1.4.0

Composer 安装命令:

composer require endelwar/gestpayws

包简介

PHP implementation of GestPay (Banca Sella) Web Services

README 文档

README

License Latest Stable Version Build Status Scrutinizer Code Quality Coverage Status

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

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

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 test suite. To run the tests, run the following command from the project folder.

$ 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) 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.

统计信息

  • 总下载量: 13.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-03