Do not save refund id after ppcp_refund_order

This commit is contained in:
Alex P 2023-03-17 17:23:33 +02:00
parent 3b1407aab4
commit 7a994f8d28
No known key found for this signature in database
GPG key ID: 54487A734A204D71
3 changed files with 14 additions and 9 deletions

View file

@ -103,7 +103,9 @@ class RefundProcessor {
switch ( $mode ) {
case self::REFUND_MODE_REFUND:
$this->refund( $order, $wc_order, $amount, $reason );
$refund_id = $this->refund( $order, $wc_order, $amount, $reason );
$this->add_refund_to_meta( $wc_order, $refund_id );
break;
case self::REFUND_MODE_VOID:
@ -133,13 +135,14 @@ class RefundProcessor {
* @param string $reason The reason for the refund.
*
* @throws RuntimeException When operation fails.
* @return string The PayPal refund ID.
*/
public function refund(
Order $order,
WC_Order $wc_order,
float $amount,
string $reason = ''
): void {
): string {
$payments = $this->get_payments( $order );
$captures = $payments->captures();
@ -157,9 +160,7 @@ class RefundProcessor {
)
);
$refund_id = $this->payments_endpoint->refund( $refund );
$this->add_refund_to_meta( $wc_order, $refund_id );
return $this->payments_endpoint->refund( $refund );
}
/**