承接 andy-am/laravel-gopay-sdk 相关项目开发

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

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

andy-am/laravel-gopay-sdk

Composer 安装命令:

composer require andy-am/laravel-gopay-sdk

包简介

GoPay SDK integration with Laravel Framework

README 文档

README

Build Status Scrutinizer Latest Stable Version Total Downloads Packagist

Docs

Installation

Step 1: Install package

Add the package in your composer.json by executing the command.

composer require hazestudio/laravel-gopay-sdk

This will both update composer.json and install the package into the vendor/ directory.

Next, add the service provider and facade to config/app.php

Add the service provider to providers:

'providers' => [
    ...
    HazeStudio\LaravelGoPaySDK\GopayServiceProvider::class,
    ...
]

And add the facade to aliases:

'aliases' => [
    ...
    'GoPay' => HazeStudio\LaravelGoPaySDK\Facade::class,
    ...
]

Step 2: Configuration

First initialise the config file by running this command:

php artisan vendor:publish

With this command, initialize the configuration and modify the created file, located under config/gopay.php.

Configuration

return [
    'goid' => 'YOUR_GOID',
    'clientId' => 'YOUR_CLIENT_ID',
    'clientSecret' => 'YOUR_CLIENT_SECRET',
    'defaultScope' => 'ALL', //GoPay\Definition\TokenScope Constants
    'languages' => [
        'en' => 'ENGLISH',
        'sk' => 'SLOVAK',
        'cs' => 'CZECH'
    ], //Map Laravel languages to GoPay\Definition\Language Constants
    'timeout' => 30
];

Features

Languages

\GoPay::lang(GoPay\Definition\Languages::SLOVAK)
//or just
\GoPay::lang('sk')
//or
\GoPay::lang('SLOVAK')->createPayment(...);

Scopes

\GoPay::scope(GoPay\Definition\TokenScope::ALL) //Override default scope
//or
\GoPay::scope('ALL')->createPayment(...);

Events

Name Class
PaymentCreated HazeStudio\LaravelGoPaySDK\Events\PaymentCreated

Example:

Event::listen(\HazeStudio\LaravelGoPaySDK\Events\PaymentCreated::class, function ($event) {
    dd($event->payment);
});

Examples

Create standard payment

use GoPay;
use GoPay\Definition\Payment\Currency;
use GoPay\Definition\Payment\PaymentInstrument;
use GoPay\Definition\Payment\BankSwiftCode;

//This will log every http request to the GoPay api
GoPay::log(function($request, $response){
    \PC::gp_request($request); //PHP Console package
    \PC::gp_response($response); //PHP Console package
    //Or Laravel Log
    \Log::info("{$request->method} {$request->url} -> {$response->statusCode}");
});

$user = \Auth::user();
$response = GoPay::lang($user->locale)->scope('CREATE_PAYMENT')->createPayment([
    'payer' => [
        'default_payment_instrument' => PaymentInstrument::BANK_ACCOUNT,
        'allowed_payment_instruments' => [PaymentInstrument::BANK_ACCOUNT],
        'default_swift' => BankSwiftCode::FIO_BANKA,
        'allowed_swifts' => [BankSwiftCode::FIO_BANKA, BankSwiftCode::MBANK],
        'contact' => [
            'first_name' => 'Zbynek',
            'last_name' => 'Zak',
            'email' => 'test@test.cz',
            'phone_number' => '+420777456123',
            'city' => 'C.Budejovice',
            'street' => 'Plana 67',
            'postal_code' => '373 01',
            'country_code' => 'CZE',
        ],
    ],
    'amount' => 1000,
    'currency' => Currency::CZECH_CROWNS,
    'order_number' => '001',
    'order_description' => 'pojisteni01',
    'items' => [
        ['name' => 'item01', 'amount' => 50],
        ['name' => 'item02', 'amount' => 100],
    ],
    'additional_params' => [
        array('name' => 'invoicenumber', 'value' => '2015001003')
    ],
    'callback' => [
        'return_url' => 'http://www.your-url.tld/return',
        'notification_url' => 'http://www.your-url.tld/notify'
    ]
]);

if ($response->hasSucceed()) {
    $url = $response->json['gw_url'];
    echo $response;
}

andy-am/laravel-gopay-sdk 适用场景与选型建议

andy-am/laravel-gopay-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 andy-am/laravel-gopay-sdk 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-14