LLMS_Order_Generator::validate_gateway()
Validates the payment gateway.
Return Return
(boolean|WP_Error) Returns true on success or an error object.
Source Source
File: includes/class-llms-order-generator.php
protected function validate_gateway() {
$coupon_id = $this->coupon ? $this->coupon->get( 'id' ) : null;
/**
* If payment is required, verify we have a gateway.
*
* For free plans the manual gateway is automatically used, whether or not it's enabled.
*/
if ( $this->plan->requires_payment( $coupon_id ) && empty( $this->data['llms_payment_gateway'] ) ) {
return $this->error( self::E_GATEWAY_REQUIRED, __( 'No payment method selected.', 'lifterlms' ) );
}
$gateway_id = $this->data['llms_payment_gateway'] ?? 'manual';
$is_valid = llms_can_gateway_be_used_for_plan( $gateway_id, $this->plan );
if ( is_wp_error( $is_valid ) ) {
return $is_valid;
}
$this->gateway = llms()->payment_gateways()->get_gateway_by_id( $gateway_id );
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |