Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\PaymentGateways

Controller::get_schema_for_gatewayprivateWC 1.0

Get the appropriate schema for a payment gateway.

Method of the class: Controller{}

No Hooks.

Returns

AbstractPaymentGatewaySettingsSchema.

Usage

// private - for code of main (parent) class only
$result = $this->get_schema_for_gateway( $gateway_id ): AbstractPaymentGatewaySettingsSchema;
$gateway_id(string) (required)
Gateway ID.

Controller::get_schema_for_gateway() code WC 10.4.3

private function get_schema_for_gateway( string $gateway_id ): AbstractPaymentGatewaySettingsSchema {
	switch ( $gateway_id ) {
		case 'bacs':
			return new BacsGatewaySettingsSchema();
		case 'cod':
			return new CodGatewaySettingsSchema();
		default:
			// Use generic schema for unknown gateways.
			return new PaymentGatewaySettingsSchema();
	}
}