Drop refund handling, finalize captures via webhook, add profanity filter
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
35f5d1acfb
commit
2e3abf33d9
11 files changed
+420
-82
No files matched your search
@@ -84,25 +84,11 @@ final class DonationStore {
|
||||
return 1 === $n;
|
||||
}
|
||||
|
||||
/** Atomic completed -> refunded|reversed. */
|
||||
public static function mark_reversed( int $id, string $status ): bool {
|
||||
global $wpdb;
|
||||
if ( ! in_array( $status, array( 'refunded', 'reversed' ), true ) ) {
|
||||
return false;
|
||||
}
|
||||
$n = $wpdb->query( $wpdb->prepare( 'UPDATE ' . self::t( 'donations' ) . " SET status = %s WHERE id = %d AND status = 'completed'", $status, $id ) );
|
||||
return 1 === $n;
|
||||
}
|
||||
|
||||
/** Hand a freshly completed donation to the rules engine (if present). Never throws. */
|
||||
public static function notify_applied( int $id ): void {
|
||||
self::call_engine( 'applyDonation', $id );
|
||||
}
|
||||
|
||||
public static function notify_reversed( int $id ): void {
|
||||
self::call_engine( 'reverseDonation', $id );
|
||||
}
|
||||
|
||||
private static function call_engine( string $method, int $id ): void {
|
||||
$row = self::find( $id );
|
||||
if ( ! $row ) {
|
||||
|
||||
Reference in new issue
Block a user