Skip to content

Commit

Permalink
Merge branch 'release/2.1.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Oct 4, 2019
2 parents 9dca2a5 + deca33f commit 905bb4f
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 77 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## [Unreleased][unreleased]
-

## [2.1.12] - 2019-10-04
- Improved RTL support in 'Synchronized payment date' settings fields.
- Fixed loading extension in multisite when plugin is network activated and Gravity Forms is activated per site.

## [2.1.11] - 2019-09-02
- Fix entry payment fulfillment.

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

[unreleased]: https://github.com/wp-pay-extensions/gravityforms/compare/2.1.11...HEAD
[unreleased]: https://github.com/wp-pay-extensions/gravityforms/compare/2.1.12...HEAD
[2.1.12]: https://github.com/wp-pay-extensions/gravityforms/compare/2.1.11...2.1.12
[2.1.11]: https://github.com/wp-pay-extensions/gravityforms/compare/2.1.10...2.1.11
[2.1.10]: https://github.com/wp-pay-extensions/gravityforms/compare/2.1.9...2.1.10
[2.1.9]: https://github.com/wp-pay-extensions/gravityforms/compare/2.1.8...2.1.9
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": "gravityforms",
"version": "2.1.11",
"version": "2.1.12",
"description": "Gravity Forms driver for the WordPress payment processing library.",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/AdminPaymentFormPostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ function( $action ) {
}
}

if ( '_pronamic_pay_gf_subscription_interval_date' === $meta_key ) {
$period = filter_input( INPUT_POST, '_pronamic_pay_gf_subscription_interval_period', FILTER_SANITIZE_STRING );

switch ( $period ) {
case 'M':
$meta_value = filter_input( INPUT_POST, '_pronamic_pay_gf_subscription_interval_m_date', FILTER_SANITIZE_STRING );
break;
case 'Y':
$meta_value = filter_input( INPUT_POST, '_pronamic_pay_gf_subscription_interval_y_date', FILTER_SANITIZE_STRING );
break;
}
}

if ( isset( $meta_value ) && '' !== $meta_value ) {
update_post_meta( $post_id, $meta_key, $meta_value );
} else {
Expand Down
49 changes: 20 additions & 29 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
use GFUserData;
use Pronamic\WordPress\Pay\Core\PaymentMethods;
use Pronamic\WordPress\Pay\Core\Recurring;
use Pronamic\WordPress\Pay\Core\Statuses;
use Pronamic\WordPress\Pay\Payments\PaymentStatus;
use Pronamic\WordPress\Pay\Core\Util as Core_Util;
use Pronamic\WordPress\Pay\Customer;
use Pronamic\WordPress\Pay\Payments\Payment;
use Pronamic\WordPress\Pay\Subscriptions\SubscriptionStatus;
use Pronamic\WordPress\Pay\Subscriptions\Subscription;
use RGFormsModel;
use WP_User;
Expand All @@ -34,7 +35,7 @@
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.1.11
* @version 2.1.12
* @since 1.0.0
*/
class Extension {
Expand All @@ -56,19 +57,9 @@ class Extension {
* Bootstrap
*/
public static function bootstrap() {
if ( ! GravityForms::is_active() ) {
return;
}

$extension = new Extension();
$extension->setup();
}

/**
* Setup.
*/
public function setup() {
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
add_action( 'plugins_loaded', array( $extension, 'plugins_loaded' ) );
}

/**
Expand Down Expand Up @@ -418,23 +409,23 @@ public function redirect_url( $url, $payment ) {
$data = new PaymentData( $form, $lead, $feed );

switch ( $payment->status ) {
case Statuses::CANCELLED:
case PaymentStatus::CANCELLED:
$url = $data->get_cancel_url();

break;
case Statuses::EXPIRED:
case PaymentStatus::EXPIRED:
$url = $feed->get_url( Links::EXPIRED );

break;
case Statuses::FAILURE:
case PaymentStatus::FAILURE:
$url = $data->get_error_url();

break;
case Statuses::SUCCESS:
case PaymentStatus::SUCCESS:
$url = $data->get_success_url();

break;
case Statuses::OPEN:
case PaymentStatus::OPEN:
default:
$url = $data->get_normal_return_url();

Expand Down Expand Up @@ -517,23 +508,23 @@ public function update_status( Payment $payment, $can_redirect = false ) {
}

switch ( $payment->status ) {
case Statuses::CANCELLED:
case PaymentStatus::CANCELLED:
$this->payment_action( $fail_action, $lead, $action, PaymentStatuses::CANCELLED );

break;
case Statuses::EXPIRED:
case PaymentStatus::EXPIRED:
$this->payment_action( $fail_action, $lead, $action, PaymentStatuses::EXPIRED );

break;
case Statuses::FAILURE:
case PaymentStatus::FAILURE:
$this->payment_action( $fail_action, $lead, $action, PaymentStatuses::FAILED );

break;
case Statuses::REFUNDED:
case PaymentStatus::REFUNDED:
$this->payment_action( 'refund_payment', $lead, $action, PaymentStatuses::REFUNDED );

break;
case Statuses::SUCCESS:
case PaymentStatus::SUCCESS:
if ( ! Entry::is_payment_approved( $lead ) || 'add_subscription_payment' === $success_action ) {
// @link https://github.com/wp-premium/gravityformspaypal/blob/2.3.1/class-gf-paypal.php#L1741-L1742
$this->payment_action( $success_action, $lead, $action, PaymentStatuses::PAID );
Expand All @@ -550,7 +541,7 @@ public function update_status( Payment $payment, $can_redirect = false ) {
$this->fulfill_order( $lead );

break;
case Statuses::OPEN:
case PaymentStatus::OPEN:
default:
if ( 'recurring' === $payment->recurring_type ) {
gform_update_meta( $lead['id'], 'pronamic_subscription_payment_id', $payment->get_id() );
Expand Down Expand Up @@ -590,7 +581,7 @@ public function subscription_update_status( Subscription $subscription ) {
);

switch ( $subscription->get_status() ) {
case Statuses::ACTIVE:
case SubscriptionStatus::ACTIVE:
if ( ! Entry::is_payment_active( $lead ) ) {
$action['note'] = __( 'Subscription manually activated.', 'pronamic_ideal' );

Expand All @@ -601,12 +592,12 @@ public function subscription_update_status( Subscription $subscription ) {
}

break;
case Statuses::CANCELLED:
case SubscriptionStatus::CANCELLED:
$this->payment_action( 'cancel_subscription', $lead, $action, PaymentStatuses::CANCELLED );

break;
case Statuses::EXPIRED:
case Statuses::COMPLETED:
case SubscriptionStatus::EXPIRED:
case SubscriptionStatus::COMPLETED:
// @todo are we sure an 'expired subscription' is the same as the Pronamic\WordPress\Pay\Core\Statuses::COMPLETED status?
$this->payment_action( 'expire_subscription', $lead, $action, PaymentStatuses::EXPIRED );

Expand Down Expand Up @@ -908,7 +899,7 @@ public function maybe_display_confirmation() {
*
* @return mixed
*/
public function get_confirmation( $lead, $payment_status = Statuses::OPEN ) {
public function get_confirmation( $lead, $payment_status = PaymentStatus::OPEN ) {
$form = GFAPI::get_form( $lead['form_id'] );

$feed = FeedsDB::get_feed_by_entry_id( $lead['id'] );
Expand Down
14 changes: 7 additions & 7 deletions src/Links.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Pronamic\WordPress\Pay\Extensions\GravityForms;

use Pronamic\WordPress\Pay\Core\Statuses;
use Pronamic\WordPress\Pay\Payments\PaymentStatus;

/**
* Title: WordPress pay extension Gravity Forms links
Expand All @@ -19,7 +19,7 @@
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.0.0
* @version 2.1.12
* @since 1.0.0
*/
class Links {
Expand Down Expand Up @@ -68,15 +68,15 @@ class Links {
*/
public static function transform_status( $payment_status ) {
switch ( $payment_status ) {
case Statuses::CANCELLED:
case PaymentStatus::CANCELLED:
return self::CANCEL;
case Statuses::EXPIRED:
case PaymentStatus::EXPIRED:
return self::EXPIRED;
case Statuses::FAILURE:
case PaymentStatus::FAILURE:
return self::ERROR;
case Statuses::SUCCESS:
case PaymentStatus::SUCCESS:
return self::SUCCESS;
case Statuses::OPEN:
case PaymentStatus::OPEN:
default:
return self::OPEN;
}
Expand Down
4 changes: 2 additions & 2 deletions src/PaymentStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Pronamic\WordPress\Pay\Extensions\GravityForms;

use Pronamic\WordPress\Pay\Core\Statuses as Core_Statuses;
use Pronamic\WordPress\Pay\Payments\PaymentStatus as Core_Statuses;

/**
* Title: WordPress pay extension Gravity Forms payment statuses
Expand All @@ -19,7 +19,7 @@
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.1.1
* @version 2.1.12
* @since 1.0.0
*/
class PaymentStatuses {
Expand Down
Loading

0 comments on commit 905bb4f

Please sign in to comment.