| @@ -9,8 +9,9 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | namespace SureDonation\Inc\Abilities; |
| 12 | 12 | |
| 13 | +use SureDonation\Inc\Database\Tables\Donations; | |
| 13 | 14 | use SureDonation\Inc\Helper; |
| 14 | 15 | |
| 15 | 16 | // Exit if accessed directly. |
| 16 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -701,9 +702,12 @@ | ||
| 701 | 702 | 'default' => '', |
| 702 | 703 | ], |
| 703 | 704 | 'status' => [ |
| 704 | 705 | 'type' => 'string', |
| 705 | - 'enum' => [ 'all', 'pending', 'processing', 'completed', 'failed', 'refunded', 'partially_refunded', 'cancelled', 'suspicious' ], | |
| 706 | + // Sourced from the table's whitelist so this cannot drift | |
| 707 | + // from what the codebase actually writes, as the | |
| 708 | + // write schemas below had. | |
| 709 | + 'enum' => array_merge( [ 'all' ], Donations::get_valid_statuses() ), | |
| 706 | 710 | 'default' => 'all', |
| 707 | 711 | 'description' => __( 'Filter by payment status.', 'suredonation' ), |
| 708 | 712 | ], |
| 709 | 713 | 'campaign_id' => [ |
| @@ -808,8 +812,12 @@ | ||
| 808 | 812 | 'currency' => [ 'type' => 'string' ], |
| 809 | 813 | 'donation_type' => [ 'type' => 'string' ], |
| 810 | 814 | 'is_anonymous' => [ 'type' => 'boolean' ], |
| 811 | 815 | 'donor_comment' => [ 'type' => 'string' ], |
| 816 | + 'donor_comment_status' => [ | |
| 817 | + 'type' => 'string', | |
| 818 | + 'enum' => [ 'approved', 'pending', 'rejected' ], | |
| 819 | + ], | |
| 812 | 820 | 'payment_status' => [ 'type' => 'string' ], |
| 813 | 821 | 'payment_mode' => [ 'type' => 'string' ], |
| 814 | 822 | 'gateway' => [ 'type' => 'string' ], |
| 815 | 823 | 'transaction_id' => [ 'type' => 'string' ], |
| @@ -959,9 +967,9 @@ | ||
| 959 | 967 | 'description' => __( 'The donation ID.', 'suredonation' ), |
| 960 | 968 | ], |
| 961 | 969 | 'status' => [ |
| 962 | 970 | 'type' => 'string', |
| 963 | - 'enum' => [ 'pending', 'processing', 'completed', 'failed', 'refunded', 'partially_refunded', 'cancelled' ], | |
| 971 | + 'enum' => Donations::get_valid_statuses(), | |
| 964 | 972 | 'description' => __( 'The new payment status.', 'suredonation' ), |
| 965 | 973 | ], |
| 966 | 974 | ], |
| 967 | 975 | ], |
| @@ -1077,9 +1085,9 @@ | ||
| 1077 | 1085 | 'description' => __( 'Comment left by the donor.', 'suredonation' ), |
| 1078 | 1086 | ], |
| 1079 | 1087 | 'payment_status' => [ |
| 1080 | 1088 | 'type' => 'string', |
| 1081 | - 'enum' => [ 'pending', 'processing', 'completed', 'failed', 'refunded', 'partially_refunded', 'cancelled' ], | |
| 1089 | + 'enum' => Donations::get_valid_statuses(), | |
| 1082 | 1090 | 'default' => 'pending', |
| 1083 | 1091 | 'description' => __( 'Status to record. Defaults to "pending" so recording a donation does not send donor receipts or fire completion automations; pass "completed" explicitly for a gift that has already cleared.', 'suredonation' ), |
| 1084 | 1092 | ], |
| 1085 | 1093 | 'donation_type' => [ |