Skip to content

Commit

Permalink
Upgrade to Omnipay v3
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Mar 26, 2022
1 parent 8d684d5 commit 378615c
Show file tree
Hide file tree
Showing 36 changed files with 185 additions and 329 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests

on:
push:
pull_request:
schedule:
- cron: "0 9 * * 1"

jobs:
PHPUnit:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.4', '8.0', '8.1']
coverage-driver: [pcov]
name: PHP ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gmp
coverage: pcov
tools: composer:v2, infection

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Update composer
run: composer self-update

- name: Composer install
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install -n

- name: PHPUnit
run: vendor/bin/phpunit
env:
XDEBUG_MODE: coverage
9 changes: 0 additions & 9 deletions .scrutinizer.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

47 changes: 0 additions & 47 deletions CHANGELOG.md

This file was deleted.

16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
# PHP merchant library

**Generalization over Omnipay and Payum**
**Generalization over Omnipay**

[![GitHub Actions](https://github.com/hiqdev/php-merchant/workflows/Tests/badge.svg)](https://github.com/hiqdev/php-merchant/actions)
[![Latest Stable Version](https://poser.pugx.org/hiqdev/php-merchant/v/stable)](https://packagist.org/packages/hiqdev/php-merchant)
[![Total Downloads](https://poser.pugx.org/hiqdev/php-merchant/downloads)](https://packagist.org/packages/hiqdev/php-merchant)
[![Build Status](https://img.shields.io/travis/hiqdev/php-merchant.svg)](https://travis-ci.org/hiqdev/php-merchant)
[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/hiqdev/php-merchant.svg)](https://scrutinizer-ci.com/g/hiqdev/php-merchant/)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/hiqdev/php-merchant.svg)](https://scrutinizer-ci.com/g/hiqdev/php-merchant/)
[![Dependency Status](https://www.versioneye.com/php/hiqdev:php-merchant/dev-master/badge.svg)](https://www.versioneye.com/php/hiqdev:php-merchant/dev-master)

This package provides generalized interface for [Omnipay] and [Payum]:

- generalized `purse` and `secret` for gateways
- generalized `time` and `payer` for responses
- else?

[Omnipay] is a framework agnostic, multi-gateway payment processing library for PHP 5.3+.

[Payum] is payment processing framework for PHP 5.5+.
[Omnipay] is a framework agnostic, multi-gateway payment processing library for PHP 7.1+.

[Omnipay]: http://omnipay.thephpleague.com/
[Payum]: http://payum.org/
Expand All @@ -35,7 +29,7 @@ php composer.phar require "hiqdev/php-merchant"
or add

```json
"hiqdev/php-merchant": "*"
"hiqdev/php-merchant": "^2.0"
```

to the require section of your composer.json.
Expand All @@ -45,4 +39,4 @@ to the require section of your composer.json.
This project is released under the terms of the BSD-3-Clause [license](LICENSE).
Read more [here](http://choosealicense.com/licenses/bsd-3-clause).

Copyright © 2015-2018, HiQDev (http://hiqdev.com/)
Copyright © 2015-2022, HiQDev (http://hiqdev.com/)
52 changes: 34 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,41 @@
}
],
"require": {
"php": "^7.1 || ^8.0",
"moneyphp/money": "~3.1.0"
"php": "^7.1 | ^8.0",
"ext-json": "*",
"moneyphp/money": "^3.0 | ^4.0"
},
"require-dev": {
"hiqdev/omnipay-paypal": "2.0.x-dev",
"hiqdev/omnipay-paxum": "2.0.x-dev",
"hiqdev/omnipay-freekassa": "2.0.x-dev",
"hiqdev/omnipay-interkassa": "2.x-dev",
"hiqdev/omnipay-robokassa": "2.0.x-dev",
"hiqdev/omnipay-okpay": "2.0.x-dev",
"hiqdev/omnipay-epayservice": "2.0.x-dev",
"hiqdev/omnipay-bitpay": "2.0.x-dev",
"hiqdev/omnipay-yandexmoney": "2.0.x-dev",
"hiqdev/omnipay-epayments": "1.0",
"hiqdev/omnipay-ikajo": "2.0.x-dev",
"hiqdev/omnipay-coingate": "dev-master",
"hiqdev/omnipay-yandex-kassa": "2.0.x-dev",
"dercoder/omnipay-webmoney": "^2.0",
"collizo4sky/omnipay-2checkout": "^1.6",
"hiqdev/omnipay-paypal": "^3.0",
"hiqdev/omnipay-paxum": "^3.0",
"hiqdev/omnipay-freekassa": "^3.0",
"hiqdev/omnipay-interkassa": "^3.0",
"hiqdev/omnipay-robokassa": "^3.0",
"hiqdev/omnipay-okpay": "^3.0",
"hiqdev/omnipay-epayservice": "^3.0",
"hiqdev/omnipay-bitpay": "^3.1.0",
"hiqdev/omnipay-yandexmoney": "^3.0",
"hiqdev/omnipay-epayments": "^3.0",
"hiqdev/omnipay-ikajo": "^3.0",
"hiqdev/omnipay-yandex-kassa": "^3.0",
"dercoder/omnipay-webmoney": "dev-php81 as v4.0.0",
"hiqdev/hidev-php": "dev-master",
"hiqdev/hidev-hiqdev": "dev-master",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^9.0",
"dms/phpunit-arraysubset-asserts": "dev-master",
"bitpay/sdk-light": "dev-master as 2.2.3"
},
"minimum-stability": "dev",
"repositories": [
{
"type": "git",
"url": "https://github.com/SilverFire/omnipay-webmoney"
},
{
"type": "git",
"url": "https://github.com/SilverFire/php-bitpay-light-client"
}
],
"autoload": {
"psr-4": {
"hiqdev\\php\\merchant\\": "src"
Expand All @@ -80,5 +91,10 @@
"hiqdev\\php\\merchant\\tests\\unit\\": "tests/unit",
"hiqdev\\php\\merchant\\tests\\phpunit\\": "tests/phpunit"
}
},
"config": {
"allow-plugins": {
"yiisoft/composer-config-plugin": true
}
}
}
5 changes: 3 additions & 2 deletions src/merchants/bitpay/BitPayMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\BitPay\Gateway;

/**
Expand Down Expand Up @@ -78,8 +79,8 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setFee($this->moneyParser->parse($response->getFee(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setFee($this->moneyParser->parse($response->getFee(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
3 changes: 2 additions & 1 deletion src/merchants/epayments/EpaymentsMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\ePayments\Message\DetailsResponse;
use Omnipay\ePayments\Message\PurchaseResponse;

Expand Down Expand Up @@ -72,7 +73,7 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getTransactionReference())
Expand Down
3 changes: 2 additions & 1 deletion src/merchants/epayservice/EPayServiceMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;

/**
* Class EPayServiceMerchant.
Expand Down Expand Up @@ -73,7 +74,7 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getData()['EPS_ACCNUM'] ?? $response->getData()['us_client'])
Expand Down
3 changes: 2 additions & 1 deletion src/merchants/freekassa/FreeKassaMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\FreeKassa\Gateway;

/**
Expand Down Expand Up @@ -69,7 +70,7 @@ public function completePurchase($data)
return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
// TODO: !(>_<)! FreeKassa does not indicate currency.
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency() ?? 'RUB'))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency() ?? 'RUB')))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
3 changes: 2 additions & 1 deletion src/merchants/ikajo/IkajoMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\Ikajo\Gateway;

/**
Expand Down Expand Up @@ -61,7 +62,7 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
3 changes: 2 additions & 1 deletion src/merchants/interkassa/InterKassaMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\InterKassa\Gateway;

/**
Expand Down Expand Up @@ -71,7 +72,7 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
5 changes: 3 additions & 2 deletions src/merchants/okpay/OkpayMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;

/**
* Class OkpayMerchant.
Expand Down Expand Up @@ -70,8 +71,8 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setFee($this->moneyParser->parse($response->getFee(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setFee($this->moneyParser->parse($response->getFee(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
3 changes: 2 additions & 1 deletion src/merchants/paxum/PaxumMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\WebMoney\Gateway;

/**
Expand Down Expand Up @@ -70,7 +71,7 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
5 changes: 3 additions & 2 deletions src/merchants/paypal/PayPalExpressMerchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use hiqdev\php\merchant\merchants\HostedPaymentPageMerchantInterface;
use hiqdev\php\merchant\response\CompletePurchaseResponse;
use hiqdev\php\merchant\response\RedirectPurchaseResponse;
use Money\Currency;
use Omnipay\PayPal\Gateway;

/**
Expand Down Expand Up @@ -70,8 +71,8 @@ public function completePurchase($data)

return (new CompletePurchaseResponse())
->setIsSuccessful($response->isSuccessful())
->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
->setFee($this->moneyParser->parse($response->getFee(), $response->getCurrency()))
->setAmount($this->moneyParser->parse($response->getAmount(), new Currency($response->getCurrency())))
->setFee($this->moneyParser->parse($response->getFee(), new Currency($response->getCurrency())))
->setTransactionReference($response->getTransactionReference())
->setTransactionId($response->getTransactionId())
->setPayer($response->getPayer())
Expand Down
Loading

0 comments on commit 378615c

Please sign in to comment.