add( self::PAYMENT_STALE_HANDLER, function () { return new Payment_Stale_Handler(); } ); } /** * Initializes service. * * @param GF_Service_Container $container Service Container. */ public function init( GF_Service_Container $container ) { parent::init( $container ); $handler = $container->get( self::PAYMENT_STALE_HANDLER ); // Enables executing the cron job for debugging purposes. Requires a "_execute_stale_payment_cron" query string parameter and GF_DEBUG to be defined as true. add_action( 'admin_init', [ $handler, 'maybe_execute_cron' ] ); // Handles logic when an entry's payment status changes. add_action( 'gform_post_payment_status_change', [ $handler, 'handle_payment_status_change' ] ); // Deactivate cron when Gravity Form is uninstalled. add_action( 'gform_uninstalling', [ $handler, 'deactivate_cron' ] ); } }