bubbstore/installments
Composer 安装命令:
composer require bubbstore/installments
包简介
Biblioteca que facilita a manipulação de parcelamento de valores.
关键字:
README 文档
README
Biblioteca que facilita a manipulação de parcelamento de valores.
Instalação via composer
$ composer require bubbstore/installments
Como utilizar
<?php use bubbstore\Installments\Installments; use bubbstore\Installments\Exceptions\InstallmentsException; try { // Definimos um array com as taxas e descontos para cada número de parcela $taxes = [ ['installment' => 1, 'percent_discount' => 0, 'tax' => 0], ['installment' => 2, 'percent_discount' => 0, 'tax' => 0], ['installment' => 3, 'percent_discount' => 0, 'tax' => 0], ]; $installments = new Installments; $result = $installments->setAmount(200) ->setTaxes($taxes) ->setMinInstallmentValue(15.00) ->get(); exit(var_dump($result)); } catch (InstallmentsException $e) { echo $e->getMessage(); }
O resultado esperado será:
{
"max_installment":3,
"max_installment_value":66.67,
"amount":200,
"text":"3x de R$ 66,67 sem juros",
"text_with_tax":"3x de R$ 66,67",
"text_discount_percent":null,
"text_discount":null,
"installments":
[
{
"amount":200,
"amount_formated":"R$ 200,00",
"base_value":200,
"tax":0,
"tax_value":0,
"discount_percent":0,
"discount_value":0,
"discount_value_formated":"R$ 0,00",
"installment":1,
"installment_value":200,
"installment_value_formated":"R$ 200,00",
"text":"1x de R$ 200,00 sem juros",
"text_with_tax":"1x de R$ 200,00",
"text_discount_percent":null,
"text_discount":null
},
{
"amount":200,
"amount_formated":"R$ 200,00",
"base_value":200,
"tax":0,
"tax_value":0,
"discount_percent":0,
"discount_value":0,
"discount_value_formated":"R$ 0,00",
"installment":2,
"installment_value":100,
"installment_value_formated":"R$ 100,00",
"text":"2x de R$ 100,00 sem juros",
"text_with_tax":"2x de R$ 100,00",
"text_discount_percent":null,
"text_discount":null
},
{
"amount":200,
"amount_formated":"R$ 200,00",
"base_value":200,
"tax":0,
"tax_value":0,
"discount_percent":0,
"discount_value":0,
"discount_value_formated":"R$ 0,00",
"installment":3,
"installment_value":66.67,
"installment_value_formated":"R$ 66,67",
"text":"3x de R$ 66,67 sem juros",
"text_with_tax":"3x de R$ 66,67",
"text_discount_percent":null,
"text_discount":null
}
]
}
Change log
Consulte CHANGELOG para obter mais informações sobre o que mudou recentemente.
Contribuindo
Consulte CONTRIBUTING para obter mais detalhes.
Segurança
Se você descobrir quaisquer problemas relacionados à segurança, envie um e-mail para contato@bubbstore.com.br em vez de usar as issues.
统计信息
- 总下载量: 4.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-22