Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

Tilopay{}WC 1.0└─ PaymentGateway

Tilopay payment gateway provider class.

This class handles all the custom logic for the Tilopay payment gateway provider.

No Hooks.

Usage

$Tilopay = new Tilopay();
// use class methods

Methods

  1. public is_account_connected( WC_Payment_Gateway $payment_gateway )

Tilopay{} code WC 10.8.1

class Tilopay extends PaymentGateway {

	/**
	 * Check if the payment gateway has a payments processor account connected.
	 *
	 * @param WC_Payment_Gateway $payment_gateway The payment gateway object.
	 *
	 * @return bool True if the payment gateway account is connected, false otherwise.
	 *              If the payment gateway does not provide the information, it will return true.
	 */
	public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
		try {
			return property_exists( $payment_gateway, 'tpay_key' ) && ! empty( $payment_gateway->tpay_key ) &&
				property_exists( $payment_gateway, 'tpay_user' ) && ! empty( $payment_gateway->tpay_user ) &&
				property_exists( $payment_gateway, 'tpay_password' ) && ! empty( $payment_gateway->tpay_password );
		} catch ( Throwable $e ) {
			// Do nothing but log so we can investigate.
			SafeGlobalFunctionProxy::wc_get_logger()->debug(
				'Failed to determine if gateway has an account connected: ' . $e->getMessage(),
				array(
					'gateway'   => $payment_gateway->id,
					'source'    => 'settings-payments',
					'exception' => $e,
				)
			);
		}

		return parent::is_account_connected( $payment_gateway );
	}
}