topshelfcraft/commerce-myfatoorah

Craft Commerce 社区提供的 MyFatoorah 支付网关

4.0.0-beta.2 2023-08-29 17:34 UTC

This package is auto-updated.

Last update: 2024-08-29 20:04:46 UTC


README

Top Shelf Craft 创建

简述。

此网关通过 MyFatoorah 网关集成 API 实现交易。

安装

  1. 从您的项目目录中,使用 Composer 需求插件包

    composer require topshelfcraft/commerce-myfatoorah
    

    注意:MyFatoorah 网关插件也适用于通过 Craft CMS 插件商店安装。

  2. 在控制面板中,转到 设置 → 插件,然后点击 MyFatoorah 的 “安装” 按钮。

  3. 没有步骤 3。

配置

要自定义插件的行为,您可以在 Craft 配置目录中添加一个 myfatoorah.php 文件

<?php

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();

系统要求是什么?

Craft 4.4+ 和 PHP 8.0.2+

我发现了一个错误。

请打开 GitHub 问题或提交到 4.x.dev 分支的 PR。

贡献者

  • 图标版权 MyFatoorah