ratepay/shopware5-module

Shopware 5 的 Ratepay 支付方式

安装次数: 11

依赖关系: 0

建议者: 0

安全: 0

星标: 2

关注者: 7

分支: 6

公开问题: 0

类型:shopware-plugin


README

============================================

安装

通过 Packagist(推荐)

这只能在您使用Shopware 的 composer 设置时才可行

  1. 在您的项目目录中执行 composer require ratepay/shopware5-module
  2. 登录您的 Shopware 后端
  3. 安装并配置模块

通过 Shopware 商店(或 GitHub 发布下载

  1. Shopware 商店下载插件
  2. 通过插件管理器上传它或将它放入文件夹 custom/plugins/RpayRatePay
  3. 登录您的 Shopware 后端
  4. 安装并配置模块

变更日志

请查看 plugin.xml

Shopware CLI 命令

您可以使用 Shopware CLI 来对 Ratepay 订单执行操作。

所有命令都具有相同的结构

./bin/console ratepay:<operation> <order> [<orderDetail>] [<qty>] 

例如操作 deliver

将交付订单中(ID 为 125)的所有元素

./bin/console ratepay:deliver 125

例如操作 return

将返回订单中(交易 ID 为 54-214XXXXXX2133)的具有项目编号 SW00012 个元素

./bin/console ratepay:return 54-214XXXXXX2133 SW0001 2

例如操作 cancel

将取消订单中(订单编号为 200012)的具有项目编号 SW0001 的所有元素

./bin/console ratepay:cancel 200012 SW0001

请求服务

在容器中注册了三个请求服务

  • \RpayRatePay\Services\Request\PaymentDeliveryService

    使用此服务来执行订单的交付。

  • RpayRatePay\Services\Request\PaymentReturnService

    使用此服务来执行订单的退货。

  • RpayRatePay\Services\Request\PaymentCancelService

    使用此服务来执行订单的取消。

请求服务的使用

通过依赖注入获取请求服务。服务 ID 是类名(symfony 3 风格)

执行少量产品

use \RpayRatePay\DTO\BasketPosition;

$orderDetail = [ instance of \Shopware\Models\Order\Detail ]
$order = [ instance of \Shopware\Models\Order ]

$basketPosition = new BasketPosition($productNumber, $qty);
$basketPosition->setOrderDetail($orderDetail);
$basketPositions[] = $basketPosition;

$basketPosition = new BasketPosition($productNumber, $qty);
$basketPosition->setOrderDetail($orderDetail);
$basketPositions[] = $basketPosition;

[...]

$basketPositions[] = new BasketPosition(BasketPosition::SHIPPING_NUMBER, 1);
 
$requestService->setItems($basketPositions);
$requestService->setOrder($order);
$response = $requestService->doRequest();

如果您想交付/取消/退货订单的运费,则需要将 shipping 作为字符串作为 $productNumber 提供。必须将 $qty 设置为 1。您不需要在 $basketPosition 上调用 setOrderDetail()

请注意,如果您想交付/取消/退货产品或优惠券(运费除外),您必须始终调用 setOrderDetail()

执行完整操作

如果您想执行完整的交付/取消/退货,只需调用以下操作

$order = [ instance of \Shopware\Models\Order ]
$response = $requestService->doFullAction($order);

(已交付/退货/取消的项将被忽略。)

响应

您将获得一个 \RatePAY\Model\Response\AbstractResponse 或一个布尔值作为响应。

如果您得到一个 AbstractResponse,只需调用 isSuccessful() 来验证请求是否成功。

如果您得到一个值为 true 的布尔值,则操作已记录到数据库中,但尚未发送到网关。如果订单是分期付款,并且在订单中有未交付/未取消的项,则会发生这种情况。

功能标志

您可以通过设置插件配置中的标志来启用特定功能。

请注意:*您应该非常仔细地测试每个功能,因为它们在某些情况下可能会破坏您的流程。

请联系您的联系人以确保该功能可以在您的安装中运行。

使用逗号分隔功能,不要使用空格。