From a5aac99509471108af70a65dadc1353dd1990f87 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:02:16 +0100 Subject: [PATCH] Fix for issue #17? --- src/Gateways/Gateway.php | 11 +++++++++++ src/Pronamic.php | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Gateways/Gateway.php b/src/Gateways/Gateway.php index eee497f..614f703 100644 --- a/src/Gateways/Gateway.php +++ b/src/Gateways/Gateway.php @@ -226,6 +226,17 @@ public function process_payment( $transaction ) { throw new \Exception( \esc_html__( 'This gateway only supports one time payments.', 'pronamic_ideal' ) ); } + /** + * Get invoice to get updated transaction total for trial. + * + * @link https://github.com/pronamic/wp-pronamic-pay-memberpress/issues/13 + * @link https://github.com/pronamic/wp-pronamic-pay-memberpress/issues/17 + * @link https://github.com/pronamic/memberpress/blob/v1.11.6/app/helpers/MeprTransactionsHelper.php#L252-L254 + */ + MeprTransactionsHelper::get_invoice( $transaction ); + + $transaction->store(); + // Create Pronamic payment. $payment = Pronamic::get_payment( $transaction ); diff --git a/src/Pronamic.php b/src/Pronamic.php index 7e7fd5a..04506a5 100644 --- a/src/Pronamic.php +++ b/src/Pronamic.php @@ -12,7 +12,6 @@ use MeprSubscription; use MeprTransaction; -use MeprTransactionsHelper; use Pronamic\WordPress\Money\Money; use Pronamic\WordPress\Money\TaxedMoney; use Pronamic\WordPress\Pay\AddressHelper; @@ -48,14 +47,6 @@ public static function get_payment( MeprTransaction $memberpress_transaction ) { $memberpress_product = $memberpress_transaction->product(); $memberpress_subscription = $memberpress_transaction->subscription(); - /** - * Get invoice to get updated transaction total for trial. - * - * @link https://github.com/pronamic/wp-pronamic-pay-memberpress/issues/13 - * @link https://github.com/pronamic/memberpress/blob/v1.11.6/app/helpers/MeprTransactionsHelper.php#L252-L254 - */ - MeprTransactionsHelper::get_invoice( $memberpress_transaction ); - // Title. $title = sprintf( /* translators: %s: payment data title */