payum-tw/collect

Payum 扩展。统一客樂得黑貓宅急便金流

v1.0.8 2017-06-16 18:36 UTC

This package is auto-updated.

Last update: 2024-09-10 06:06:37 UTC


README

StyleCI Build Status Total Downloads Latest Stable Version Latest Unstable Version License Monthly Downloads Daily Downloads Scrutinizer Code Quality Code Coverage

Payum 扩展,用于快速构建新的扩展。

  1. 创建新项目
$ composer create-project payum-tw/collect
  1. 将所有 payum 出现的地方替换成你的供应商名称。现在我们假设你选择:collect
  2. 将所有 collect 出现的地方替换成支付网关名称。例如 Stripe,Paypal 等。现在我们假设你选择:collect
  3. 向 Payum 的构建器注册一个网关工厂并创建一个网关
<?php

use Payum\Core\PayumBuilder;
use Payum\Core\GatewayFactoryInterface;

$defaultConfig = [];

$payum = (new PayumBuilder)
    ->addGatewayFactory('collect', function(array $config, GatewayFactoryInterface $coreGatewayFactory) {
        return new \PayumTW\Collect\CollectGatewayFactory($config, $coreGatewayFactory);
    })

    ->addGateway('collect', [
        'factory' => 'collect',
        'link_id' => null,
        'hash_base' => null,
    ])

    ->getPayum();
  1. 在使用网关时,实现所有返回 Not implemented 异常的方法
<?php

use Payum\Core\Request\Capture;

$collect = $payum->getGateway('collect');

$model = new \ArrayObject([
  // ...
]);

$collect->execute(new Capture($model));

资源

许可证

骨架在 MIT 许可证 下发布。