← All changes
|
includes/donations/class-charitable-donation.php
+19
-5
1.7.0.2
→
1.8.13
View file →
| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * Donation model. |
| 4 | 4 | * |
| 5 | 5 | * @package Charitable/Classes/Charitable_Donation |
| 6 | 6 | * @author David Bisset |
| 7 | - * @copyright Copyright (c) 2022, WP Charitable LLC | |
| 7 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.0.0 |
| 10 | 10 | * @version 1.6.0 |
| 11 | 11 | */ |
| @@ -46,11 +46,19 @@ | ||
| 46 | 46 | $refund_log = get_post_meta( $this->ID, 'donation_refund', true ); |
| 47 | 47 | $total_refund = isset( $refund_log['total_refund'] ) ? $refund_log['total_refund'] : 0; |
| 48 | 48 | $refunds_per_campaign = isset( $refund_log['campaign_refunds'] ) ? $refund_log['campaign_refunds'] : array(); |
| 49 | 49 | |
| 50 | + if ( charitable_is_debug( 'square' ) ) { | |
| 51 | + // phpcs:disable | |
| 52 | + error_log( 'process_refund - Refund amount: ' . $refund_amount ); | |
| 53 | + error_log( 'process_refund - Total refund: ' . $total_refund ); | |
| 54 | + error_log( 'process_refund - Refunds per campaign: ' . print_r( $refunds_per_campaign, true ) ); | |
| 55 | + // phpcs:enable | |
| 56 | + } | |
| 57 | + | |
| 50 | 58 | foreach ( $this->get_campaign_donations() as $campaign_donation ) { |
| 51 | 59 | |
| 52 | - if ( 0 == $refund_amount ) { | |
| 60 | + if ( 0 === $refund_amount ) { | |
| 53 | 61 | break; |
| 54 | 62 | } |
| 55 | 63 | |
| 56 | 64 | if ( ! isset( $refunds_per_campaign[ $campaign_donation->campaign_id ] ) ) { |
| @@ -80,15 +88,21 @@ | ||
| 80 | 88 | $total_refund += $campaign_refund_amount; |
| 81 | 89 | } |
| 82 | 90 | |
| 83 | 91 | $refund_log = array( |
| 84 | - 'time' => time(), | |
| 85 | - 'message' => $message, | |
| 92 | + 'time' => time(), | |
| 93 | + 'message' => $message, | |
| 86 | 94 | 'campaign_refunds' => $refunds_per_campaign, |
| 87 | - 'total_refund' => $total_refund, | |
| 95 | + 'total_refund' => $total_refund, | |
| 88 | 96 | ); |
| 89 | 97 | |
| 90 | 98 | update_post_meta( $this->ID, 'donation_refund', $refund_log ); |
| 99 | + | |
| 100 | + if ( charitable_is_debug( 'square' ) ) { | |
| 101 | + // phpcs:disable | |
| 102 | + error_log( 'process_refund - Refund log: ' . print_r( $refund_log, true ) ); | |
| 103 | + // phpcs:enable | |
| 104 | + } | |
| 91 | 105 | |
| 92 | 106 | $this->update_status( 'charitable-refunded' ); |
| 93 | 107 | } |
| 94 | 108 | } |