定制 orkestra/transactor 二次开发

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

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

orkestra/transactor

Composer 安装命令:

composer require orkestra/transactor

包简介

Offers support for interacting with different financial transaction processing platforms

README 文档

README

Build Status

The Transactor provides payment processing functionality to any PHP 5.4+, 7.0+ project. This library contains dependencies on Symfony and supports both Symfony 2.3+ and 3.0+.

HHVM is loosely supported, but it has not been extensively tested. Please Report an Issue if you have any problems.

Supported payment processors:

  • Network Merchants credit card, ACH, and swiped transactions.
  • Authorize.Net credit card and ACH support.
  • Cash and check transactions for brick and mortar stores.
  • Points, useful as a means to keep track of account credit.

Installation

Install this project using Composer.

Add orkestra-transactor to your project by running composer require orkestra/transactor:~1.2, or by adding it to your composer.json file:

{
    "require": {
        "orkestra/transactor": "~1.2"
    }
}

Then run composer install or composer update.

Usage

Overview

  1. Create Credentials
  2. Create Account
  3. Create Transaction
  4. Process Transaction

1. Create Credentials

Credentials are used by a Transactor to authenticate with the remote system. Each transactor has specific fields that are necessary to allow processing of transactions.

You can use a given Transactor to create a default set of Credentials by calling $transactor->createCredentials().

<?php

use Orkestra\Transactor\Entity\Credentials;
use Orkestra\Transactor\Transactor\Generic\GenericTransactor;

$transactor = new GenericTransactor();

$creds = $transactor->createCredentials();
foreach ($creds->getCredentials() as $k => $v) {
    // Enumerate the default fields required by the transactor.
}

// Update credentials as necessary
$creds->setCredential('username', 'myuser');
$creds->setCredential('password', 'mypass');

Tip: You can inspect a Credentials entity and get its Transactor type, then pass that to the TransactorFactory to dynamically load the appropriate Transactor for a given Transaction.

2. Create Account

An Account is essentially a container of customer information. There are multiple types of Account entities, basically one type per Network type. Different Transactors support different networks. A Network is the method by which to process a transaction, such as Credt Card, ACH, or Cash.

<?php

use Orkestra\Transactor\Entity\Account;

// A credit card
$card = new Account\CardAccount();
$card->setAccountNumber('4111111111111111');

// A bank account (used for ACH processing)
$account = new Account\BankAccount();
$account->setAccountNumber('12345777');
$account->setRoutingNumber('5556713355');

3. Create Transaction

A Transaction must provide the Transactor a proper Account and Credentials to allow the Transactor to process.

<?php

use Orkestra\Transactor\Entity\Transaction;

$transaction = new Transaction();
$transaction->setAccount($account);
$transaction->setCredentials($creds);
$transaction->setNetwork(new Transaction\NetworkType(Transaction\NetworkType::CASH));
$transaction->setType(new Transaction\TransactionType(Transaction\TransactionType::SALE));

4. Transact

Use the Transactor to actually process the Transaction.

<?php

$result = $transactor->transact($transaction);

orkestra/transactor 适用场景与选型建议

orkestra/transactor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 522 次下载、GitHub Stars 达 2, 最近一次更新时间为 2013 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 orkestra/transactor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 orkestra/transactor 我们能提供哪些服务?
定制开发 / 二次开发

基于 orkestra/transactor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 522
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 22
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-11