AddMissingTransactionIdForUncompletedDonations.php
4 years ago
AddStatementDescriptorToStripeAccounts.php
4 years ago
RemovePaymentIntentSecretMeta.php
2 years ago
RemovePaymentIntentSecretMeta.php
59 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\PaymentGateways\Gateways\Stripe\Migrations; |
| 4 | |
| 5 | use Give\Framework\Database\DB; |
| 6 | use Give\Framework\Migrations\Contracts\Migration; |
| 7 | |
| 8 | /** |
| 9 | * Removes the secret meta that was unnecessarily stored in the database for donations. |
| 10 | * |
| 11 | * @since 2.33.0 |
| 12 | */ |
| 13 | class RemovePaymentIntentSecretMeta extends Migration |
| 14 | { |
| 15 | /** |
| 16 | * @inheritDoc |
| 17 | */ |
| 18 | public static function id(): string |
| 19 | { |
| 20 | return 'remove_payment_intent_secret_meta'; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * @inheritDoc |
| 25 | */ |
| 26 | public static function title(): string |
| 27 | { |
| 28 | return __('Remove payment intent secret meta', 'give'); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * @inheritDoc |
| 33 | */ |
| 34 | public static function timestamp() |
| 35 | { |
| 36 | return strtotime('2023-06-29 00:00:00'); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @inheritDoc |
| 41 | */ |
| 42 | public function run() |
| 43 | { |
| 44 | DB::delete( |
| 45 | DB::prefix('give_donationmeta'), |
| 46 | ['meta_key' => '_give_stripe_payment_intent_client_secret'], |
| 47 | ['%s'] |
| 48 | ); |
| 49 | |
| 50 | $commentsTable = DB::prefix('give_comments'); |
| 51 | DB::query( |
| 52 | DB::prepare( |
| 53 | "DELETE FROM {$commentsTable} WHERE comment_type = 'donation' AND comment_content LIKE %s", |
| 54 | 'Stripe Payment Intent Client Secret:%' |
| 55 | ) |
| 56 | ); |
| 57 | } |
| 58 | } |
| 59 |