nmc9/nuvei-helper
Composer 安装命令:
composer require nmc9/nuvei-helper
包简介
Helpers to intergate with Nuvei
关键字:
README 文档
README
Based on this Library https://github.com/jqueguiner/PivotalPayment
Nuvei
PHP Library for Nuvei http://www.pivotalpayments.com/ca/fr/
Requirements
CURL (php_curl) XMLRPC (php_xmlrpc) Multibyte String PHP extension (php_mbstring)
Installation
Place the content of the github repo into the desired directory in your projet ($DIR) Create a transaction table if needed in your DB (SQL model file in located under:
- Data/dataModel.sql
Live Usage
//$DIR see section installation below
require_once($DIR.DIRECTORY_SEPARATOR.'Pivotal.php');
$paymentParams['ORDERID'] = $orderId;
$paymentParams['AMOUNT'] = $amount;
$paymentParams['CURRENCY'] = $currency;
$paymentParams['CARDNUMBER'] = $cardNumber;
$paymentParams['CARDHOLDERNAME'] = $cardHolderName;
//month two digits (09 for september)
$paymentParams['MONTH'] = $cardMonth;
//year two digits (16 for 2016)
$paymentParams['YEAR'] = $cardYear;
//CVV 3 or 4 Digits depending on vendor
$paymentParams['CVC'] = $cardCVC;
//'live' for live environment
//'test' for test environment
$pivotal = new Pivotal('live',$paymentParams);
//configure your db to autosave transactions
$pivotal->_dbConfig = array('server' => 'localhost', 'login' => 'root', 'password' => 'root', 'database' => 'myDb');
//transactions won't be saved in the DB
$response = $pivotal->sendPayment();
//transactions will be saved in the DB
//true option stands for transaction recording in the database (table is "transaction" see installation section")
$response = $pivotal->sendPayment(true);
Test Usage
Test cards are included in the library:
//$DIR see section installation below
require_once($DIR.DIRECTORY_SEPARATOR.'Pivotal.php');
$pivotal_config = new Pivotal_Config('test');
//get test card number for the selected vendor (Visa)
//get the holdername and CVV too
//all test variables are under the Data Directory (TestCards.json)
//live and Test URL are in Data Directory (MainConfig.json)
//live and Test terminals are in Data Directory (Terminals.json)
$card = $pivotal_config->readVendorTestCard('visa');
$paymentParams['ORDERID'] = rand(10,10000);
$paymentParams['AMOUNT'] = 1000;
$paymentParams['CURRENCY'] = 'CAD';
$paymentParams['CARDNUMBER'] = $card['CardNumber'];
$paymentParams['CARDHOLDERNAME'] = $card['CardHolderName'];
$paymentParams['MONTH'] = '09';
$paymentParams['YEAR'] = '16';
$paymentParams['CVC'] = $card['CVC'];
$pivotal = new Pivotal('test',$paymentParams);
$response = $pivotal->sendPayment();
Payment validation Output
//if success
array(
'UNIQUEREF' => 'GW5CWTXWIW',
'RESPONSECODE' => 'A',
'RESPONSETEXT' => 'APPROVAL',
'APPROVALCODE' => '475318',
'DATETIME' => '2014-11-10T17:25:58',
'AVSRESPONSE' => 'X',
'CVVRESPONSE' => 'M',
'HASH' => 'b035f8f72f4be9df404d6268b55c02b0',
'STATUS' => true
)
or
//if error
array(
'ERRORSTRING' => 'The error description',
'STATUS' => false
)
Building Payment Form
Payment form helper is included in the library and is based on https://github.com/jessepollak/card plugin
//$DIR see section installation below
require_once($DIR.DIRECTORY_SEPARATOR.'Helper'.DIRECTORY_SEPARATOR.'form.php');
//$action = formAction see http://www.w3schools.com/tags/att_form_action.asp for more info
$action = 'PaymentProcessURL.php';
$pivotal_form = new Pivotal_Form($action);
echo $pivotal_form->buildForm();
Extra
This Lib also provide Regex to detect card vendor (REGEX are located in Data/CardTypes.json) and you can read the vendor based on the Card Number
//$DIR see section installation below
require_once($DIR.DIRECTORY_SEPARATOR.'Pivotal.php');
$pivotal_config = new Pivotal_Config('test');
//this clean and compare the card number to regular expression config located under Data/CardTypes.json
//please feel free to add new credit card type but keep in mind the the order in the CardTypes.json is important and that last pattern found = output
//so be sure to have VISA, MASTERCARD before resellers (VISA DEBIT is part of VISA for instance which means that VISA should be before VISA DEBIT)
$vendor = $pivotal_config->getCardType('1234567890123456');
Credit Card Regex
Here are the credit card regex known so far, please feel free to contribute to make this lib even more accurate.
- Maestro
- JCB
- Diners
- American
- Express
- Visa
- MasterCard
- Debit MasterCard
- UK Domestic Maestro
- Solo
nmc9/nuvei-helper 适用场景与选型建议
nmc9/nuvei-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nuvei」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nmc9/nuvei-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nmc9/nuvei-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nmc9/nuvei-helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP client library for accessing Nuvei API
A PHP client library for accessing Nuvei API
Smart2Pay SDK - enable payments on your site easily 200+ methods, 80+ countries
A PHP wrapper for Nuvei's api.
A PHP wrapper for Nuvei's api.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-26