承接 ockle/gocardless-webhook 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ockle/gocardless-webhook

Composer 安装命令:

composer require ockle/gocardless-webhook

包简介

Process webhooks from GoCardless

README 文档

README

Build Status Coverage Status

A PHP library to aid is the processing of webhooks from GoCardless (see API documentation for more information).

Installation

Install the library using Composer. Add the following to your composer.json:

{
    "require": {
        "ockle/gocardless-webhook": "~1.0"
    }
}

and then run:

composer update ockle/gocardless-webhook

Usage

Instantaiate a new webhook service:

// $secret is the string entered in the GoCardless admin when setting up a webhook endpoint
$webhook = new \Ockle\GoCardlessWebhook\Service($secret, new \Symfony\Component\EventDispatcher\EventDispatcher);

Then attach event listeners, e.g.:

$webhook->onMandate(function (\Ockle\GoCardlessWebhook\Events\MandateEvent $event) use ($client) {
    // Do stuff when a mandate event occurs

    // You can check what the action is:
    if ($event->actionIs(\Ockle\GoCardlessWebhook\Events\MandateEvent::ACTION_CREATED)) {
        // Mandate has been created
    }
    
    // However, it is advised that you don't do any important business logic based off this, but
    // rather do an API call to get the current status of the mandate and act on that as the accurate
    // source of mandate information. This is due to the fact that events may be received in any order.
    
    // There are methods to get information about the event, e.g.:
    $mandateId = $event->getMandateId();
});

Next, process the webhook, which will trigger your event listeners as necessary:

$webhook->process($webhookSignatureFromHeaders, $rawPostBody);

Finally, return the correct HTTP status code is your response, which can be got by calling:

$webhook->getResponseStatus();

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固