gingerplugins/ginger-plugin-sdk

为 ginger-php 库提供额外层,用于插件开发。

1.5.2 2024-03-07 10:59 UTC

This package is auto-updated.

Last update: 2024-09-07 12:25:49 UTC


README

该库是根据 Ginger API 的模式自定义开发的。
应与支付插件或用于订单创建一起使用。

可用功能

  • 创建包含所有相关实体的订单实体。
  • 将新订单发布到 Ginger API。

概述

实体概述

  • 交易
  • 描述
  • 金额
  • 客户
    • 出生日期
    • 地址
      • 国家
  • 订单行
  • 额外信息
  • 客户端

交易

该实体包含几个单独的交易,基本上不超过1个交易。

  • 初始化新对象
$transactions = new Transactions(
    new Transaction(...)
);
  • 添加新交易
$transactions->addTransaction($transaction);
  • 按索引删除交易
$transactions->removeTransaction($index);

交易

该实体包含一般支付信息。您应使用此实体来告诉 API 如何处理您的请求。

  • 初始化新对象
$transaction = new Transaction(
    paymentMethod: "apple-pay"
);
  • 添加支付方式详情有两种方式

    • 在初始化时
    $transaction = new Transaction(
      paymentMethod: "ideal",
      paymentMethodDetails: new PaymentMethodDetails(...)
    );  
    • 通过标准对象示例,通过扩展其属性的方式(目前仅支持为支付方式准备)。
    $transaction->getPaymentMethodDetails()->setPaymentMethodDetailsIdeal();
  • 接收支付方式详情

$transaction->getPaymentMethodDetails();

支付方式

此字段应用于存储支付名称。

支付方式详情

该实体包含支付方式的其他有效负载,例如发行者 ID、托管字段数据
或续费支付的数据。

  • 目前,仅支持字符串类型的属性值。