PHP code example of topshelfcraft / commerce-myfatoorah

1. Go to this page and download the library: Download topshelfcraft/commerce-myfatoorah library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

topshelfcraft / commerce-myfatoorah example snippets




use craft\commerce\base\GatewayInterface;
use craft\commerce\elements\Order;
use TopShelfCraft\MyFatoorah\config\Settings;

return Settings::create()

	/*
	 * A callable that returns `true` if the gateway supports payments for the given order and `false` if not.
	 *
	 * This method is called before a payment is made for the supplied order. It can be
	 * used by developers building a checkout and deciding if this gateway should be shown as
	 * and option to the customer. It also can prevent a gateway from being used with a particular order.
	 *
	 * The callable expects two parameters:
	 *  - `$order`, the Order element
	 *  - `$gateway`, the GatewayInterface instance
	 *
	 * If omitted, the gateway will be available for all orders.
	 */
	->availableForUseWithOrder(function(Order $order, GatewayInterface $gateway) {
		// ...
	})

	/*
	 * The list of country code options available for settings controls.
	 */
	->countryCodeOptions([
		'BRH' => "BRH (Bahrain)",
		'EGY' => "EGY (Egypt)",
		'JOR' => "JOR (Jordan)",
		'KWT' => "KWT (Kuwait)",
		'OMN' => "OMN (Oman)",
		'QAT' => "QAT (Qatar)",
		'SAU' => "SAU (Saudi Arabia)",
		'ARE' => "ARE (United Arab Emirates)",
	])

	// Cast the fluent Settings object to a settings array for Craft to load.
	->toArray();