LLMS_Order::get_gateway()
Retrieve the payment gateway instance for the order’s selected payment gateway
Return Return
(LLMS_Payment_Gateway|WP_Error) Instance of the LLMS_Payment_Gateway extending class used for the payment. WP_Error if the gateway cannot be located, e.g. because it's no longer enabled.
Source Source
File: includes/models/model.llms.order.php
public function get_gateway() {
$gateways = llms()->payment_gateways();
$gateway = $gateways->get_gateway_by_id( $this->get( 'payment_gateway' ) );
if ( $gateway && ( $gateway->is_enabled() || is_admin() ) ) {
return $gateway;
} else {
return new WP_Error( 'error', sprintf( __( 'Payment gateway %s could not be located or is no longer enabled', 'lifterlms' ), $this->get( 'payment_gateway' ) ) );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |