jdavidbakr / laravel-profitstars
通过Jack Henry的ProfitStars API处理ACH交易的服务
1.5
2020-09-04 14:33 UTC
Requires
- php: >=7.3.0
- guzzlehttp/guzzle: ~5.3|~6.0.1|~6.1|~7.0.1
- illuminate/support: ~5.1|6.*|7.*|8.*
Requires (Dev)
- phpunit/phpunit: ^8.5
- scrutinizer/ocular: ~1.1
README
Jack Henry ProfitStars提供了一个处理ACH交易的API。本包是Laravel/Lumen访问这些交易的包装器。
就API提供的功能而言,该包目前并不全面;我只实现了我需要的API部分。尽管如此,扩展这个包应该是相当简单的,如果你需要额外的部分,请随意修改并提交一个拉取请求。
安装
通过Composer
$ composer require jdavidbakr/laravel-profitstars
通过Composer安装后,添加服务提供者
jdavidbakr\ProfitStars\ProfitStarsServiceProvider::class
###Laravel 配置
发布配置文件
php artisan vendor:publish
这将在config目录中放置一个文件,该文件将管理你的连接凭证。
###Lumen 配置
将以下内容添加到你的.env文件中
PROFIT_STARS_STORE_ID=YOUR STORE ID
PROFIT_STARS_STORE_KEY=YOUR STORE KEY
PROFIT_STARS_ENTITY_ID=YOUR ENTITY ID
PROFIT_STARS_LOCATION_ID=YOUR LOCATION ID
使用 - 测试
$proc = new \jdavidbakr\ProfitStars\ProcessTransaction; // Test connection if($proc->TestConnection()) { // Success } // Test credentials if($proc->TestCredentials()) { // Success }
使用 - 处理交易
$proc = new \jdavidbakr\ProfitStars\ProcessTransaction; $trans = new \jdavidbakr\ProfitStars\WSTransaction; // AuthorizeTransaction $trans->RoutingNumber = 111000025; $trans->AccountNumber = 5637492437; $trans->TotalAmount = 9.95; $trans->TransactionNumber = 12334; $trans->NameOnAccount = 'Joe Smith'; $trans->EffectiveDate = '2015-11-04'; if($proc->AuthorizeTransaction($tras)) { // ReferenceNumber in $proc->ReferenceNumber } else { // Error message in $proc->ResponseMessage } // CaptureTransaction $proc->ReferenceNumber = 'reference number'; if($proc->CaptureTransaction(9.95)) { // Success } else { // Error message in $proc->ResponseMessage } // VoidTransaction $proc->ReferenceNumber = 'reference number'; if($proc->VoidTransaction()) { // Success; } else { // Error message in $proc->ResponseMessage } // RefundTransaction $proc->ReferenceNumber = 'reference number'; if($proc->RefundTransaction()) { // Success, refund info in $proc->ResponseMessage } else { // Error message in $proc->ResponseMessage }
使用 - 定期支付
$proc = new \jdavidbakr\ProfitStars\ProcessTransaction; $recur = new \jdavidbakr\ProfitStars\WSRecurr; $cust = new \jdavidbakr\ProfitStars\WSCustomer; $account = new \jdavidbakr\ProfitStars\WSAccount; // RegisterCustomer $cust->IsCompany = false; $cust->CustomerNumber = 12345; $cust->FirstName = 'Alex'; $cust->LastName = 'Ramirez'; $cust->Email = 'test@example.com'; $cust->Address1 = '1234 N Sunny Ln'; $cust->City = 'Tulsa'; $cust->StateRegion = 'OK'; $cust->PostalCode = '12345'; if($proc->RegisterCustomer($cust)) { // Success; } else { // Error message in $proc->ResponseMessage } // RegisterAccount $account->CustomerNumber = 12345; // Should match the RegisterCustomer value $account->NameOnAccount = 'Joe Smith'; $account->RoutingNumber = 111000025; $account->AccountNumber = 5637492437; $account->AccountReferenceID = 67890; // This must be unique and will be used to setup the recurring payment if($proc->RegisterAccount($account)) { // Success } else { // Error message in $proc->ResponseMessage } // SetupRecurringPayment $recur->CustomerNumber = 12345; // What you used in RegisterCustomer $recur->AccountReferenceID = 67890; // What you used in RegisterAccount $recur->Amount = 1.23; // The amount that will be charged each time $recur->InvoiceNumber = 09876; // Optional $recur->Frequency = 'Once_a_Month'; // Once_a_Month, Twice_a_Month, Once_a_Week, Every_2_Weeks, Once_a_Quarter, Twice_a_Year, Once_a_Year $recur->PaymentDay = 1; // See notes below $recur->NumPayments = 10; // Valid values are 1 - 100, or 999 for indefinite $recur->PaymentsToDate = 0; // Should be zero $recur->NextPaymentDate = '2015-11-04'; // Must not be before tomorrow $recur->RecurringReferenceID = 12345; // Must set a value here like you did in the customer and account calls if($proc->SetupRecurringPayment($recur)) { // Success } else { // Error message is $proc->ResponseMessage }
定期说明
对于定期支付,需要一个客户编号和账户参考ID。
频率和支付日定义了定期支付的日程。支付日定义为以下:
- Once_a_Month: 1 - 31,或32为月份的最后一天
- Once_a_Quarter: 与上述相同
- Twice_a_year: 与上述相同
- Once_a_Year: 与上述相同
- Twice_a_Month: 1 = 1号和15号,2 = 15号和最后一天
- Once_a_Week: 0 - Sun,1 = Mon,... 5 = Fri,6 = Sat
- Every_2_Weeks: 与Once_a_Week相同
使用 - 交易报告
$reporter = new \jdavidbakr\ProfitStars\TransactionReporting; // Retrieve a collection of \jdavidbakr\ProfitStars\CreditAndDebitReportsResponse $start_date = Carbon::now()->subDays(90); // Max 90 days from start to end $end_date = Carbon::now(); $batches = $reporter->CreditAndDebitReports($start_date, $end_date); // Retrieve a collection of \jdavidbakr\ProfitStars\WSSettlementBatch objects for a batch $batch = $batches->first(); $transactions = $reporter->CreditsAndDebitsTransactionDetailReport($batch->batchID);
贡献
有关详细信息,请参阅CONTRIBUTING和CONDUCT。
安全
如果你发现任何与安全相关的问题,请通过电子邮件me@jdavidbaker.com而不是使用问题跟踪器。
致谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。