承接 granam/gpwebpay-flat 相关项目开发

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

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

granam/gpwebpay-flat

Composer 安装命令:

composer require granam/gpwebpay-flat

包简介

Parser of GP WepPay report in FLAT format

README 文档

README

Security first

NEVER download this library from an unknown source. Use ONLY packagist.org (therefore composer), or github.com/jaroslavtyc/granam-gpwebpay-flat.

You are going to work with financial data, which are ALWAYS sensitive. Think twice if a public library to process them is OK for your company inner politic.

This library is released under MIT licence, which means any harm caused to you by using it is your fight. But I will do my best to protect you from any data leakage or corruption.

Step-by-step

  • send a request to helpdesk@globalpayments.cz to get daily reports of transactions in FLAT format to an email of your choice
  • add this library to your project composer require granam/gpwebpay-flat
  • let it to parse FLAT report from an email (or from a file, or from a string content... it's up to you)
<?php
namespace Coolest\Fan;

use Granam\GpWebPay\Flat\FlatReportParser;
use Granam\Mail\Download\ImapEmailAttachmentFetcher;
use Granam\GpWebPay\Flat\CzechECommerceTransactionHeaderMapper;
use Granam\Mail\Download\ImapReadOnlyConnection;

$flatReportParser = new FlatReportParser();
$imapConnection = new ImapReadOnlyConnection('light.in.tunnel@example.com', 'Раѕѕword123', 'imap.example.com' );
$flatContentFromCzechEmail = $flatReportParser->createFlatContentFromCzechEmailAttachment(
    new ImapEmailAttachmentFetcher($imapConnection),
    $yesterday = new \DateTime('yesterday'), // search for FLAT file with yesterday report, but sent today
    new CzechECommerceTransactionHeaderMapper()
);
if($flatContentFromCzechEmail === null) {
    die('No email with FLAT file has been found for yesterday');
}
$eCommerceTransactions = $flatContentFromCzechEmail->getECommerceTransactions($yesterday /* have to filter them because more days can be covered by a single report */);
echo 'We got confirmed '.$eCommerceTransactions->count().' of yesterday purchases via GpWebPay gateway!';
  • verify that you have not missed a payment from a customer (what a shame!)
<?php
// ...
/** @var \Granam\GpWebPay\Flat\Sections\ECommerceTransactions $eCommerceTransactions */
$expectedIncome = require __DIR__ . '/expected_income_from_yesterday.php';
if ($expectedIncome !== $eCommerceTransactions->getPaidAmountWithoutFeesSummary()) {
    throw new \RuntimeException(
        "We have missing (or redundant) GpWebPay payments! Expected {$expectedIncome}, got ". $eCommerceTransactions->getPaidAmountWithoutFeesSummary()
    );
}

echo 'Our customers spent on yesterday '.$eCommerceTransactions->getPaidAmountWithoutFeesSummary().'.-, we paid '
.$eCommerceTransactions->getFeesInMerchantCurrencySummary().' to GpWebPay as fee'
.' and we got '.$eCommerceTransactions->getPaidAmountWithoutFeesSummary();
  • be happy! (or at least less sad)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固