Skip to content

Commit

Permalink
Merge branch 'release/4.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Sep 26, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents ec50efc + 3832f23 commit f1352b5
Showing 16 changed files with 217 additions and 430 deletions.
11 changes: 11 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"core": null,
"plugins": [
".",
"../../../",
"https://downloads.wordpress.org/plugin/charitable.1.6.60.zip"
],
"config": {
"PRONAMIC_PAY_DEBUG": true
}
}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,9 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## [Unreleased][unreleased]
-

## [4.2.0] - 2022-09-26
- Updated for new payment methods and fields registration.

## [4.1.0] - 2022-04-11
- No longer need to check for gateway error, will use exceptions only.

@@ -108,7 +111,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/4.1.0...HEAD
[unreleased]: https://github.com/wp-pay-extensions/charitable/compare/4.2.0...HEAD
[4.2.0]: https://github.com/pronamic/wp-pronamic-pay-charitable/compare/4.1.0...4.2.0
[4.1.0]: https://github.com/wp-pay-extensions/charitable/compare/4.0.0...4.1.0
[4.0.0]: https://github.com/wp-pay-extensions/charitable/compare/3.0.1...4.0.0
[3.0.1]: https://github.com/wp-pay-extensions/charitable/compare/3.0.0...3.0.1
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -29,7 +29,13 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"roots/wordpress-core-installer": true,
"bamarni/composer-bin-plugin": true
}
},
"repositories": [
{
@@ -54,7 +60,7 @@
},
"scripts": {
"coveralls": "vendor/bin/php-coveralls -v",
"phpcbf": "vendor/bin/phpcbf",
"phpcbf": "XDEBUG_MODE=off vendor/bin/phpcbf",
"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",
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "charitable",
"version": "4.1.0",
"version": "4.2.0",
"description": "Charitable driver for the WordPress payment processing library.",
"repository": {
"type": "git",
@@ -32,8 +32,9 @@
},
"homepage": "http://www.wp-pay.org/extensions/charitable/",
"devDependencies": {
"grunt": "^1.0.4",
"grunt-contrib-jshint": "^2.1.0",
"@wordpress/env": "^5.2.0",
"grunt": "^1.5.3",
"grunt-contrib-jshint": "^3.2.0",
"grunt-phpcs": "^0.4.0",
"grunt-phplint": "0.1.0",
"grunt-phpmd": "^0.1.1",
41 changes: 41 additions & 0 deletions pronamic-pay-charitable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Plugin Name: Pronamic Pay Charitable Add-On
* Plugin URI: https://www.pronamic.eu/plugins/pronamic-pay-charitable/
* Description: Extend the Pronamic Pay plugin with Charitable support to receive payments through a variety of payment providers.
*
* Version: 4.1.0
* Requires at least: 4.7
*
* Author: Pronamic
* Author URI: https://www.pronamic.eu/
*
* Text Domain: pronamic-pay-charitable
* Domain Path: /languages/
*
* License: GPL-3.0-or-later
*
* Depends: wp-pay/core
*
* GitHub URI: https://github.com/pronamic/wp-pronamic-pay-charitable
*
* @author Pronamic <[email protected]>
* @copyright 2005-2022 Pronamic
* @license GPL-3.0-or-later
* @package Pronamic\WordPress\Pay\Extensions\RestrictContentPro
*/

add_filter(
'pronamic_pay_plugin_integrations',
function ( $integrations ) {
foreach ( $integrations as $integration ) {
if ( $integration instanceof \Pronamic\WordPress\Pay\Extensions\Charitable\Extension ) {
return $integrations;
}
}

$integrations[] = new \Pronamic\WordPress\Pay\Extensions\Charitable\Extension();

return $integrations;
}
);
27 changes: 0 additions & 27 deletions src/BancontactGateway.php
Original file line number Diff line number Diff line change
@@ -37,31 +37,4 @@ class BancontactGateway extends Gateway {
* @var string
*/
protected $payment_method = PaymentMethods::BANCONTACT;

/**
* Process donation.
*
* @since 1.0.2
*
* @param bool|array $return Return.
* @param int $donation_id Donation ID.
* @param Charitable_Donation_Processor $processor Charitable donation processor.
*
* @return bool|array
*/
public static function process_donation( $return, $donation_id, $processor ) {
return self::pronamic_process_donation( $return, $donation_id, $processor, new self() );
}

/**
* Returns the current gateway's ID.
*
* @return string
* @access public
* @static
* @since 1.0.3
*/
public static function get_gateway_id() {
return self::ID;
}
}
29 changes: 1 addition & 28 deletions src/BankTransferGateway.php
Original file line number Diff line number Diff line change
@@ -36,32 +36,5 @@ class BankTransferGateway extends Gateway {
*
* @var string
*/
protected $payment_method = PaymentMethods::BANK_TRANSFER;

/**
* Process donation.
*
* @since 1.0.2
*
* @param bool|array $return Return.
* @param int $donation_id Donation ID.
* @param Charitable_Donation_Processor $processor Charitable donation processor.
*
* @return bool|array
*/
public static function process_donation( $return, $donation_id, $processor ) {
return self::pronamic_process_donation( $return, $donation_id, $processor, new self() );
}

/**
* Returns the current gateway's ID.
*
* @return string
* @access public
* @static
* @since 1.0.3
*/
public static function get_gateway_id() {
return self::ID;
}
public $payment_method = PaymentMethods::BANK_TRANSFER;
}
16 changes: 8 additions & 8 deletions src/CharitableHelper.php
Original file line number Diff line number Diff line change
@@ -55,11 +55,11 @@ public static function get_description( $gateway, $donation_id ) {
// Replacements.
$campaigns = $donation->get_campaigns();

$replacements = array(
$replacements = [
'{donation_id}' => $donation_id,
'{first_campaign_name}' => reset( $campaigns ),
'{campaign_name}' => implode( ', ', $campaigns ),
);
];

return \strtr( $description, $replacements );
}
@@ -100,12 +100,12 @@ public static function get_value_from_user_data( $user_data, $key ) {
*/
public static function get_customer_from_user_data( $user_data ) {
return CustomerHelper::from_array(
array(
[
'name' => self::get_name_from_user_data( $user_data ),
'email' => self::get_value_from_user_data( $user_data, 'email' ),
'phone' => self::get_value_from_user_data( $user_data, 'phone' ),
'user_id' => null,
)
]
);
}

@@ -117,10 +117,10 @@ public static function get_customer_from_user_data( $user_data ) {
*/
public static function get_name_from_user_data( $user_data ) {
return ContactNameHelper::from_array(
array(
[
'first_name' => self::get_value_from_user_data( $user_data, 'first_name' ),
'last_name' => self::get_value_from_user_data( $user_data, 'last_name' ),
)
]
);
}

@@ -132,7 +132,7 @@ public static function get_name_from_user_data( $user_data ) {
*/
public static function get_address_from_user_data( $user_data ) {
return AddressHelper::from_array(
array(
[
'name' => self::get_name_from_user_data( $user_data ),
'line_1' => self::get_value_from_user_data( $user_data, 'address' ),
'line_2' => self::get_value_from_user_data( $user_data, 'address_2' ),
@@ -142,7 +142,7 @@ public static function get_address_from_user_data( $user_data ) {
'country_code' => self::get_value_from_user_data( $user_data, 'country' ),
'email' => self::get_value_from_user_data( $user_data, 'email' ),
'phone' => self::get_value_from_user_data( $user_data, 'phone' ),
)
]
);
}
}
27 changes: 0 additions & 27 deletions src/CreditCardGateway.php
Original file line number Diff line number Diff line change
@@ -37,31 +37,4 @@ class CreditCardGateway extends Gateway {
* @var string
*/
protected $payment_method = PaymentMethods::CREDIT_CARD;

/**
* Process donation.
*
* @since 1.0.2
*
* @param bool|array $return Return.
* @param int $donation_id Donation ID.
* @param Charitable_Donation_Processor $processor Charitable donation processor.
*
* @return bool|array
*/
public static function process_donation( $return, $donation_id, $processor ) {
return self::pronamic_process_donation( $return, $donation_id, $processor, new self() );
}

/**
* Returns the current gateway's ID.
*
* @return string
* @access public
* @static
* @since 1.0.3
*/
public static function get_gateway_id() {
return self::ID;
}
}
27 changes: 0 additions & 27 deletions src/DirectDebitGateway.php
Original file line number Diff line number Diff line change
@@ -37,31 +37,4 @@ class DirectDebitGateway extends Gateway {
* @var string
*/
protected $payment_method = PaymentMethods::DIRECT_DEBIT;

/**
* Process donation.
*
* @since 1.0.2
*
* @param bool|array $return Return.
* @param int $donation_id Donation ID.
* @param Charitable_Donation_Processor $processor Charitable donation processor.
*
* @return bool|array
*/
public static function process_donation( $return, $donation_id, $processor ) {
return self::pronamic_process_donation( $return, $donation_id, $processor, new self() );
}

/**
* Returns the current gateway's ID.
*
* @return string
* @access public
* @static
* @since 1.0.1
*/
public static function get_gateway_id() {
return self::ID;
}
}
Loading

0 comments on commit f1352b5

Please sign in to comment.