incraigulous/php-profitstars

一个通过Jack Henry的ProfitStars API处理ACH交易的服务

2.1 2016-06-20 19:20 UTC

This package is auto-updated.

Last update: 2024-09-10 04:17:49 UTC


README

Latest Version on Packagist Software License Total Downloads

Jack Henry ProfitStars提供了处理ACH交易的API。本包是访问这些交易的包装器。

就API提供的内容而言,该包目前并不全面;我只实现了我需要的API的一部分。尽管如此,扩展这个包应该是相当简单的,如果你需要额外的部分,请随时修改并提交一个拉取请求。

安装

通过Composer

$ composer require incraigulous/php-profitstars

用法

$credentials = [
    'store-id'=>"YOUR_STORE_ID",
    'store-key'=>"YOUR_STORE_KEY",
    'entity-id'=>"YOUR_ENTITY_ID",
    'location-id'=>"YOUR_LOCATION_ID",
];
$proc = new \jdavidbakr\ProfitStars\ProcessTransaction($credentials);

// Test connection
if($proc->TestConnection()) {
	// Success
}

// Test credentials
if($proc->TestCredentials()) {
	// Success
}

用法 - 处理交易

$credentials = [
    'store-id'=>"YOUR_STORE_ID",
    'store-key'=>"YOUR_STORE_KEY",
    'entity-id'=>"YOUR_ENTITY_ID",
    'location-id'=>"YOUR_LOCATION_ID",
];
$proc = new \jdavidbakr\ProfitStars\ProcessTransaction($credentials);
$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
}

用法 - 定期付款

$credentials = [
    'store-id'=>"YOUR_STORE_ID",
    'store-key'=>"YOUR_STORE_KEY",
    'entity-id'=>"YOUR_ENTITY_ID",
    'location-id'=>"YOUR_LOCATION_ID",
];
$proc = new \jdavidbakr\ProfitStars\PaymentVault($credentials);
$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。

频率和付款日定义了定期付款的日程。付款日定义如下

  • 每月一次:1 - 31,或者32为月份的最后一天
  • 每季度一次:与上述相同
  • 每年两次:与上述相同
  • 每年一次:与上述相同
  • 每月两次:1 = 1号和15号,2 = 15号和最后一天
  • 每周一次:0 - Sun,1 = Mon,... 5 = Fri,6 = Sat
  • 每两周一次:与每周一次相同

贡献

请参阅CONTRIBUTINGCONDUCT以获取详细信息。

测试

可以直接从包文件夹中运行PhpUnit。您需要包含一个.env文件以提供您的沙箱连接凭据。提供了一个示例.env文件(.env.example)。

安全

如果您发现任何与安全相关的问题,请通过电子邮件me@jdavidbaker.com联系,而不是使用问题跟踪器。

致谢

此包是从@jdavidbakers的针对Laravel的特定Profit Stars SDK分叉而来的。

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件