add total services.

This commit is contained in:
Edward Yang 2022-07-22 18:25:06 +08:00
parent 5296e55671
commit 2591357bf8
5 changed files with 80 additions and 1 deletions

View File

@ -150,7 +150,8 @@ class CartService
'carts' => $carts,
'quantity' => $quantity,
'amount' => $amount,
'amount_format' => currency_format($amount)
'amount_format' => currency_format($amount),
'totals' => TotalService::getTotals(),
];
return $data;
}

View File

@ -0,0 +1,36 @@
<?php
/**
* TotalService.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-22 17:11:31
* @modified 2022-07-22 17:11:31
*/
namespace Beike\Shop\Services;
class TotalService
{
const TOTAL_CODES = [
'subtotal',
'shipping',
'total'
];
/**
* @return array
*/
public static function getTotals(): array
{
$totals = [];
foreach (self::TOTAL_CODES as $code) {
$totals[] = 11;
}
// hook= [subtotal, shipping]
return [];
}
}

View File

@ -0,0 +1,15 @@
<?php
/**
* ShippingService.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-22 17:58:14
* @modified 2022-07-22 17:58:14
*/
class ShippingService
{
}

View File

@ -0,0 +1,15 @@
<?php
/**
* SubtotalService.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-22 17:58:25
* @modified 2022-07-22 17:58:25
*/
class SubtotalService
{
}

View File

@ -0,0 +1,12 @@
{
"code": "service_charge",
"name": "订单手续费",
"description": "订单手续费,采用stripe支付方式或者低总额加收一定费用",
"type": "total",
"version": "v1.0.0",
"icon": "https://via.placeholder.com/100x100.png/112233?text=SERVICE",
"author": {
"name": "成都光大网络科技有限公司",
"email": "yangjin@opencart.cn"
}
}