定制 iodigital/peachpayment 二次开发

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

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

iodigital/peachpayment

Composer 安装命令:

composer require iodigital/peachpayment

包简介

A library to help integrate Peach Payments

README 文档

README

This is a work in progress.

Installation

Via Composer

$ composer require iodigital/peachpayment

This package uses auto discovery but can be added to your config/app.php providers by adding \IoDigital\PeachPayment\PeachPaymentServiceProvider::class,

You can publish the assets with the following: php artisan vendor:publish --tag=peachpayment-config php artisan vendor:publish --tag=peachpayment-migrations

Config file

The configuration file provides you with the ability of adding your production and test Peach Payment credentials. The package does a check against your app environment.

The variables that can be used are:

  • PEACH_PAYMENTS_USER_ID
  • PEACH_PAYMENTS_PASSWORD
  • PEACH_PAYMENTS_AUTHORIZATION_HEADER
  • PEACH_PAYMENTS_ENTITY_ID_ONCE_OFF
  • PEACH_PAYMENTS_ENTITY_ID_RECURRING
  • PEACH_PAYMENTS_TEST_MODE
  • PEACH_PAYMENTS_NOTIFICATION_URL
  • PEACH_PAYMENTS_WEBHOOK_SECRET_KEY

Migrations

payment_cards

This table can be used in conjunction with Server to Server functionality.

payment_results

This table can be used to store the results of transactions.

payment_events

This table can be used to store the event data received from webhooks.

Usage

This package provides the ability of using Server to Server and COPYandPay. Fairly simple to get either one going:

$client = (new PeachPayment())->initServerToServer();
// or
$client = (new PeachPayment())->initCopyAndPay();

As explained further below, you can also override your Peach Payment credentials on the fly:

$client = (new PeachPayment())->initServerToServer($settings);

Where $settings is a fluent class.

Methods available to Server to Server:

registerCard(CardBuilder $card);
registerCardDuringPayment(CardBuilder $card);
repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT);
oneClickPayment(PaymentCard $card, int $amount);
paymentStatus(string $paymentId);
deleteCard(string $registrationId);

// Available options for $type in repeatedPayment()
PaymentScheme::INITIAL_PAYMENT;
PaymentScheme::REPEATED_PAYMENT;

Methods available to COPYandPAY:

prepareCheckout(int $amount);
getCheckoutRegistrationResult($checkoutId);
registerCard();
registerCardDuringPayment(int $amount);
repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT);
paymentStatus(string $checkoutId);

To determine the result of a transaction with Peach Payment, you can use the Response class:

$response = new \IoDigital\PeachPayment\Api\Response();
$response->isSuccessfulResponse($resultCode); // true|false
$response->isValidationError($resultCode); // true|false

Saving the response is also available: $response->save($result, $paymentCard);

Webhooks

The following change needs to be made in your app/Http/Middleware/VerifyCsrfToken.php file:

protected $except = [
        config('peachpayment.webhook_url')
    ];

Helpers

Setting.php

This class allows you to inject or modify your Peach Payment credentials on a per usage basis. By default, it uses the variables given in the config file and you only have to override the variables needed.

Usage is fairly straightforward:

$settings = new Setting();
$settings->setUser('lorem')
         ->setPassword('ipsum')
         ->setEntityIdOnceOff('dolor');

$pay = (PeachPayment())->initServerToServer($settings);

This should provide flexibility in certain edge cases.

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

  • [author name][link-author]
  • [All Contributors][link-contributors]

License

license. Please see the license file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固