Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Aug 5, 2021
2 parents 6f40887 + d9ef709 commit 58044a8
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 134 deletions.
35 changes: 23 additions & 12 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

coverage:
tests:
override:
- command: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
coverage:
file: build/logs/clover.xml
format: clover

environment:
php: 7.3.0
variables:
WP_TESTS_DB_NAME: 'wp_phpunit_tests'
WP_TESTS_DB_USER: 'root'
WP_TESTS_DB_PASS: ''
WP_TESTS_DB_HOST: 'localhost'
project_setup:
before:
- mysql -e "CREATE DATABASE wp_phpunit_tests"
WP_TESTS_DB_HOST: '127.0.0.1'

services:
mysql: 5.7

dependencies:
override:
- composer install --ignore-platform-reqs --no-interaction
nodes:
coverage:
tests:
override:
- command: ./vendor/bin/phpunit
coverage:
file: build/logs/clover.xml
format: clover

project_setup:
before:
- mysql -e "CREATE DATABASE wp_phpunit_tests"

filter:
excluded_paths:
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## [Unreleased][unreleased]
-

## [3.0.0] - 2021-08-05
- Simplified gateway registration.
- Added support for PayPal payment method.
- Updated to `pronamic/wp-pay-core` version `3.0.0`.
- Updated to `pronamic/wp-money` version `2.0.0`.
- Changed `TaxedMoney` to `Money`, no tax info.
- Switched to `pronamic/wp-coding-standards`.

## [2.2.3] - 2021-05-28
- Improve using default gateway configuration.

Expand Down Expand Up @@ -91,7 +99,8 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## 1.0.0 - 2015-11-05
- First release.

[unreleased]: https://github.com/wp-pay-extensions/charitable/compare/2.2.3...HEAD
[unreleased]: https://github.com/wp-pay-extensions/charitable/compare/3.0.0...HEAD
[3.0.0]: https://github.com/wp-pay-extensions/charitable/compare/2.2.3...3.0.0
[2.2.3]: https://github.com/wp-pay-extensions/charitable/compare/2.2.2...2.2.3
[2.2.2]: https://github.com/wp-pay-extensions/charitable/compare/2.2.1...2.2.2
[2.2.1]: https://github.com/wp-pay-extensions/charitable/compare/2.2.0...2.2.1
Expand Down
12 changes: 4 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,25 @@
],
"require": {
"php": ">=5.6.20",
"wp-pay/core": "^2.6"
"wp-pay/core": "^3.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
"charitable/charitable": "^1.6",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"php-coveralls/php-coveralls": "^2.4",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpmd/phpmd": "^2.9",
"phpunit/phpunit": "^5.7 || ^6.0",
"pronamic/wp-coding-standards": "^1.0",
"roots/wordpress": "^5.6",
"squizlabs/php_codesniffer": "^3.5",
"wp-coding-standards/wpcs": "^2.3",
"wp-phpunit/wp-phpunit": "^5.6"
},
"scripts": {
"coveralls": "vendor/bin/php-coveralls -v",
"phpcbf": "vendor/bin/phpcbf",
"phpcs": "vendor/bin/phpcs -s -v",
"phpcs": "XDEBUG_MODE=off vendor/bin/phpcs -s -v",
"phplint": "find src tests -name '*.php' | xargs -n 1 -P 4 php -l",
"phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php",
"phpstan": "vendor/bin/phpstan analyse",
"phpstan": "vendor/bin/phpstan analyse --memory-limit=-1",
"phpunit": "vendor/bin/phpunit",
"post-install-cmd": "echo 'Optionally run: composer bin all install'",
"post-update-cmd": "echo 'Optionally run: composer bin all update'",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "charitable",
"version": "2.2.3",
"version": "3.0.0",
"description": "Charitable driver for the WordPress payment processing library.",
"repository": {
"type": "git",
Expand Down
22 changes: 1 addition & 21 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
<?xml version="1.0"?>

<ruleset name="WordPress Pay Charitable rules">
<config name="minimum_supported_wp_version" value="4.7" />

<config name="testVersion" value="5.6-" />

<file>.</file>

<arg name="colors"/>
<arg name="extensions" value="php" />
<arg value="sp" />

<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
<exclude-pattern>tests/wp-config.php</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>wordpress/*</exclude-pattern>
<exclude-pattern type="relative">^wp-content/*</exclude-pattern>

<rule ref="PHPCompatibilityWP" />

<rule ref="WordPress">
<exclude name="Generic.CodeAnalysis.UselessOverridingMethod.Found" />
<exclude name="Generic.Files.LowercasedFilename.NotFound" />

<rule ref="PronamicWP">
<exclude name="Squiz.Commenting" />

<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
</rule>
</ruleset>
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

<php>
<env name="WP_PHPUNIT__TESTS_CONFIG" value="tests/wp-config.php"/>
</php>
Expand Down
16 changes: 4 additions & 12 deletions src/BancontactGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ class BancontactGateway extends Gateway {
const ID = 'pronamic_pay_mister_cash';

/**
* Constructs and initialize an iDEAL gateway
* Payment method.
*
* @var string
*/
public function __construct() {
parent::__construct();

$this->name = __( 'Bancontact', 'pronamic_ideal' );

$this->defaults = array(
'label' => __( 'Bancontact', 'pronamic_ideal' ),
);

$this->payment_method = PaymentMethods::BANCONTACT;
}
protected $payment_method = PaymentMethods::BANCONTACT;

/**
* Process donation.
Expand Down
16 changes: 4 additions & 12 deletions src/BankTransferGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ class BankTransferGateway extends Gateway {
const ID = 'pronamic_pay_bank_transfer';

/**
* Constructs and initialize an iDEAL gateway
* Payment method.
*
* @var string
*/
public function __construct() {
parent::__construct();

$this->name = __( 'Bank Transfer', 'pronamic_ideal' );

$this->defaults = array(
'label' => __( 'Bank Transfer', 'pronamic_ideal' ),
);

$this->payment_method = PaymentMethods::BANK_TRANSFER;
}
protected $payment_method = PaymentMethods::BANK_TRANSFER;

/**
* Process donation.
Expand Down
16 changes: 4 additions & 12 deletions src/CreditCardGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ class CreditCardGateway extends Gateway {
const ID = 'pronamic_pay_credit_card';

/**
* Constructs and initialize an iDEAL gateway
* Payment method.
*
* @var string
*/
public function __construct() {
parent::__construct();

$this->name = __( 'Credit Card', 'pronamic_ideal' );

$this->defaults = array(
'label' => __( 'Credit Card', 'pronamic_ideal' ),
);

$this->payment_method = PaymentMethods::CREDIT_CARD;
}
protected $payment_method = PaymentMethods::CREDIT_CARD;

/**
* Process donation.
Expand Down
16 changes: 4 additions & 12 deletions src/DirectDebitGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ class DirectDebitGateway extends Gateway {
const ID = 'pronamic_pay_direct_debit';

/**
* Constructs and initialize an iDEAL gateway
* Payment method.
*
* @var string
*/
public function __construct() {
parent::__construct();

$this->name = __( 'Direct Debit', 'pronamic_ideal' );

$this->defaults = array(
'label' => __( 'Direct Debit', 'pronamic_ideal' ),
);

$this->payment_method = PaymentMethods::DIRECT_DEBIT;
}
protected $payment_method = PaymentMethods::DIRECT_DEBIT;

/**
* Process donation.
Expand Down
4 changes: 4 additions & 0 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public function charitable_payment_gateways( $gateways ) {
'SofortGateway',
);

if ( PaymentMethods::is_active( PaymentMethods::PAYPAL ) ) {
$classes[] = 'PayPalGateway';
}

if ( PaymentMethods::is_active( PaymentMethods::GULDEN ) ) {
$classes[] = 'GuldenGateway';
}
Expand Down
16 changes: 13 additions & 3 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
use Charitable_Donation_Processor;
use Charitable_Gateway;
use Pronamic\WordPress\Money\Currency;
use Pronamic\WordPress\Money\TaxedMoney;
use Pronamic\WordPress\Money\Money;
use Pronamic\WordPress\Pay\Core\PaymentMethods;
use Pronamic\WordPress\Pay\Plugin;
use Pronamic\WordPress\Pay\Payments\Payment;

Expand Down Expand Up @@ -38,10 +39,19 @@ class Gateway extends Charitable_Gateway {
* Constructs and initialize an iDEAL gateway
*/
public function __construct() {
// Name.
$this->name = __( 'Pronamic', 'pronamic_ideal' );

if ( null !== $this->payment_method ) {
$this->name = \sprintf(
'%s - %s',
$this->name,
PaymentMethods::get_name( $this->payment_method )
);
}

$this->defaults = array(
'label' => __( 'Pronamic', 'pronamic_ideal' ),
'label' => PaymentMethods::get_name( $this->payment_method, \__( 'Pronamic', 'pronamic_ideal' ) ),
);

// @link https://github.com/Charitable/Charitable/blob/1.4.5/includes/gateways/class-charitable-gateway-paypal.php#L41-L44
Expand Down Expand Up @@ -160,7 +170,7 @@ public static function pronamic_process_donation( $return, $donation_id, Charita
$currency = Currency::get_instance( \charitable_get_currency() );

// Amount.
$payment->set_total_amount( new TaxedMoney( CharitableHelper::get_total_amount_value( $donation_id ), $currency ) );
$payment->set_total_amount( new Money( CharitableHelper::get_total_amount_value( $donation_id ), $currency ) );

// Method.
$payment->method = $payment_method;
Expand Down
16 changes: 4 additions & 12 deletions src/GuldenGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ class GuldenGateway extends Gateway {
const ID = 'pronamic_pay_gulden';

/**
* Constructs and initialize an Gulden gateway
* Payment method.
*
* @var string
*/
public function __construct() {
parent::__construct();

$this->name = PaymentMethods::get_name( PaymentMethods::GULDEN );

$this->defaults = array(
'label' => PaymentMethods::get_name( PaymentMethods::GULDEN ),
);

$this->payment_method = PaymentMethods::GULDEN;
}
protected $payment_method = PaymentMethods::GULDEN;

/**
* Process donation.
Expand Down
16 changes: 4 additions & 12 deletions src/IDealGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,11 @@ class IDealGateway extends Gateway {
const ID = 'pronamic_pay_ideal';

/**
* Constructs and initialize an iDEAL gateway
* Payment method.
*
* @var string
*/
public function __construct() {
parent::__construct();

$this->name = __( 'iDEAL', 'pronamic_ideal' );

$this->defaults = array(
'label' => __( 'iDEAL', 'pronamic_ideal' ),
);

$this->payment_method = PaymentMethods::IDEAL;
}
protected $payment_method = PaymentMethods::IDEAL;

/**
* Process donation.
Expand Down
Loading

0 comments on commit 58044a8

Please sign in to comment.