本文整理汇总了PHP中app\Order::total方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::total方法的具体用法?PHP Order::total怎么用?PHP Order::total使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::total方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Order $order)
{
if (!$order) {
dd('vantar pöntun');
}
$this->order = $order;
$this->testing = false;
if (env('BORGUN_TEST') == true) {
$this->site = 'https://test.borgun.is/SecurePay/default.aspx';
$this->testing = true;
$this->PaymentGatewayId = '16';
$this->MerchantId = '9275444';
$this->SecretKey = '99887766';
} else {
$this->site = 'https://securepay.borgun.is/securepay/default.aspx';
$this->PaymentGatewayId = env('BORGUN_PAYMENTGATEWAYID');
$this->MerchantId = env('BORGUN_MERCHANTID');
$this->SecretKey = env('BORGUN_SECRETKEY');
}
$this->ReturnUrlSuccess = \Request::root() . '/payment/borgun/success';
$this->ReturnUrlSuccessServer = \Request::root() . '/payment/borgun/successserver';
$this->ReturnUrlCancel = \Request::root() . '/payment/borgun/cancel';
$this->ReturnUrlError = '';
$this->OrderId = $order->reference;
$this->Amount = $order->total();
$this->Currency = 'ISK';
$this->Language = 'IS';
}
示例2: collect
function test_an_order_is_discounted_by_a_percentage_when_a_percent_off_coupon_is_applied()
{
$books = collect([new Book(['price' => 2000]), new Book(['price' => 3000]), new Book(['price' => 4000])]);
$coupon = new Coupon(['value' => 30, 'is_percent' => true]);
$order = new Order($books);
$order->applyCoupon($coupon);
$this->assertEquals(6300, $order->total());
}
示例3: Order
/** @test */
function an_order_can_determine_the_total_cost_of_all_its_products()
{
$order = new Order();
$product = new Product('Fallout 4', 59);
$product2 = new Product('pillowcase', 7);
$order->add($product);
$order->add($product2);
$this->assertEquals(66, $order->total());
}