<?php
/**
 * Plugin panel : General settings
 *
 * @package YITH\PayPalPayouts
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
$where_find_credential_txt = sprintf(
	'%s <a href="//developer.paypal.com/developer/applications">developer.paypal.com</a>',
	_x(
		'You can find it inside your Payouts application settings in',
		'[ADMIN] this text describe where is possible found the Payout credentials',
		'yith-paypal-payouts-for-woocommerce'
	)
);

$general_settings = array(
	'general-settings' => array(
		'payouts_section_start' => array(
			'type' => 'sectionstart',
		),
		'payout_section_title'  => array(
			'type' => 'title',
			'name' => __( 'Payouts API Settings', 'yith-paypal-payouts-for-woocommerce' ),
		),
		'payout_business_email' => array(
			'id'        => 'yith_payouts_business_email',
			'name'      => __( 'PayPal business email', 'yith-paypal-payouts-for-woocommerce' ),
			'desc'      => sprintf(
				'%s<br/>%s',
				__(
					'Enter your business PayPal email to use the payouts service.',
					'yith-paypal-payouts-for-woocommerce'
				),
				$where_find_credential_txt
			),
			'type'      => 'yith-field',
			'yith-type' => 'text',
		),
		'payout_app_id'         => array(
			'id'        => 'yith_payouts_application_id',
			'name'      => __( 'Application client ID', 'yith-paypal-payouts-for-woocommerce' ),
			'desc'      => sprintf(
				'%s<br/>%s',
				__(
					'Enter your application client ID to use the payouts service.',
					'yith-paypal-payouts-for-woocommerce'
				),
				$where_find_credential_txt
			),
			'type'      => 'yith-field',
			'yith-type' => 'text',
		),
		'payout_app_secret_key' => array(
			'id'        => 'yith_payouts_application_secret_key',
			'name'      => __( 'Application client key', 'yith-paypal-payouts-for-woocommerce' ),
			'desc'      => sprintf(
				'%s<br/>%s',
				__(
					'Enter your application client secret key to use the payouts service.',
					'yith-paypal-payouts-for-woocommerce'
				),
				$where_find_credential_txt
			),
			'type'      => 'yith-field',
			'yith-type' => 'text',
		),
		'payout_sandbox_mode'   => array(
			'id'        => 'yith_payouts_sandbox_mode',
			'name'      => __( 'Enable sandbox mode', 'yith-paypal-payouts-for-woocommerce' ),
			'type'      => 'yith-field',
			'yith-type' => 'onoff',
			'default'   => 'no',
			'desc'      => __( 'Enable to use the sandbox environment to test payouts.', 'yith-paypal-payouts-for-woocommerce' ),
		),
		'payout_enable_log'     => array(
			'id'        => 'yith_payouts_enable_log',
			'name'      => __( 'Enable log', 'yith-paypal-payouts-for-woocommerce' ),
			'type'      => 'yith-field',
			'yith-type' => 'onoff',
			'default'   => 'no',
			'desc'      => __( 'Enable to add notes in the plugin\'s log file.', 'yith-paypal-payouts-for-woocommerce' ),
		),
		'payout_webhook_info'   => array(
			'id'        => 'payout_webhook',
			'type'      => 'yith-field',
			'yith-type' => 'webhook-info',
			'name'      => __( 'Webhook configuration', 'yith-paypal-payouts-for-woocommerce' ),
			// phpcs:disable
			'desc'      => sprintf( __( 'You can configure the webhook URL %1$s in your <a href="%2$s">application settings</a>. All the webhooks for all your connected users will be sent to this endpoint.', 'yith-paypal-payouts-for-woocommerce' ), '<code>' . esc_url( add_query_arg( 'wc-api', 'yith_payouts_response', site_url( '/' ) ) ) . '</code>', 'https://developer.paypal.com/developer/applications/' ) . '<br /><br />'
			               . __( "It's important to note that only test webhooks will be sent to your development webhook URL. Yet, if you are working on a live website, <b>both live and test</b> webhooks will be sent to your production webhook URL. This is due to the fact that you can create both live and test objects under a production application.", 'yith-paypal-payouts-for-woocommerce' ) . ' — ' . __( "We recommend to check the live mode whenever you receive an event webhook.", 'yith-paypal-payouts-for-woocommerce' ) . '<br /><br />'
			               . sprintf( __( 'For further information about webhooks, refer to the <a href="%s">webhook documentation</a>.', 'yith-paypal-payouts-for-woocommerce' ), 'https://developer.paypal.com/docs/integration/direct/webhooks/' ),
		),
		// phpcs:enable
		'payout_section_end'    => array(
			'type' => 'sectionend',
		),
	),
);

if ( defined( 'YITH_WPV_PREMIUM' ) ) {
	$general_settings['general-settings']['multivendor_section_start']        = array(
		'type' => 'title',
		'name' => __( 'Multi Vendor Settings', 'yith-paypal-payouts-for-woocommerce' ),
	);
	$general_settings['general-settings']['payout_include_vendor_commission'] = array(
		'id'        => 'yith_payouts_exclude_vendor_commission',
		'name'      => __( 'Exclude vendor products from payouts calculation', 'yith-paypal-payouts-for-woocommerce' ),
		'type'      => 'yith-field',
		'yith-type' => 'onoff',
		'default'   => 'yes',
		'desc'      => __( 'If checked, vendors\' products won\'t be calculated in payouts. This option is available only with YITH WooCommerce Multi Vendor version 3.0.0 or higher.', 'yith-paypal-payouts-for-woocommerce' ),
	);
	$general_settings['general-settings']['multivendor_section_end']          = array(
		'type' => 'sectionend',
	);
}

return $general_settings;
