Skip to content

Commit

Permalink
Use new refunds API.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Mar 21, 2023
1 parent c14b1d6 commit fe8e31e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/RefundsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Pronamic\WordPress\Money\Money;
use Pronamic\WordPress\Pay\Payments\Payment;
use Pronamic\WordPress\Pay\Plugin;
use Pronamic\WordPress\Pay\Refunds\Refund;

/**
* Easy Digital Downloads refunds
Expand Down Expand Up @@ -133,11 +134,9 @@ private function process_refund( EDD_Payment $edd_payment, Payment $payment ) {
$payment->get_total_amount()->get_currency()
);

$refund_reference = Plugin::create_refund( $transaction_id, $gateway, $amount );
$refund = new Refund( $payment, $amount );

if ( null === $refund_reference ) {
throw new \Exception( __( 'Unable to create refund at gateway.', 'pronamic_ideal' ) );
}
Plugin::create_refund( $refund );

// Update payment amount refunded.
$edd_refunded_amount = $edd_payment->get_meta( '_pronamic_pay_amount_refunded', true );
Expand Down

0 comments on commit fe8e31e

Please sign in to comment.