Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../wp-conte.../plugins/wpforms-.../src/Integrat.../Stripe/Api/Webhooks
File: CustomerSubscriptionCreated.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace WPForms\Integrations\Stripe\Api\Webhooks;
[2] Fix | Delete
[3] Fix | Delete
use RuntimeException;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Webhook customer.subscription.created class.
[7] Fix | Delete
*
[8] Fix | Delete
* @since 1.8.4
[9] Fix | Delete
*/
[10] Fix | Delete
class CustomerSubscriptionCreated extends Base {
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Handle the Webhook's data.
[14] Fix | Delete
*
[15] Fix | Delete
* @since 1.8.4
[16] Fix | Delete
*
[17] Fix | Delete
* @throws RuntimeException If payment not found or not updated.
[18] Fix | Delete
*
[19] Fix | Delete
* @return bool
[20] Fix | Delete
*/
[21] Fix | Delete
public function handle() {
[22] Fix | Delete
[23] Fix | Delete
$this->delay();
[24] Fix | Delete
[25] Fix | Delete
$payment = wpforms()->get( 'payment' )->get_by( 'subscription_id', $this->data->id );
[26] Fix | Delete
[27] Fix | Delete
if ( ! $payment ) {
[28] Fix | Delete
return false;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
if ( ! wpforms()->get( 'payment' )->update( $payment->id, [ 'subscription_status' => 'active' ] ) ) {
[32] Fix | Delete
throw new RuntimeException( 'Payment not updated' );
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
wpforms()->get( 'payment_meta' )->add_log(
[36] Fix | Delete
$payment->id,
[37] Fix | Delete
'Stripe subscription was set to active.'
[38] Fix | Delete
);
[39] Fix | Delete
[40] Fix | Delete
return true;
[41] Fix | Delete
}
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function