Completed
Push — master ( 7e3634...ff897c )
by Gilmar
02:36
created

Order::getModificationValueInt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of gpupo/adyen-sdk
5
 *
6
 * (c) Gilmar Pupo <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * For more information, see
12
 * <http://www.g1mr.com/adyen-sdk/>.
13
 */
14
15
namespace Gpupo\AdyenSdk\Payment\Request\Order;
16
17
use Gpupo\CommonSdk\Entity\EntityAbstract;
18
use Gpupo\CommonSdk\Entity\EntityInterface;
19
20
/**
21
 * @method string getId()    Acesso a id
22
 * @method setId(string $id)    Define id
23
 * @method Gpupo\AdyenSdk\Payment\Request\Order\Shopper getShopper()    Acesso a shopper
24
 * @method setShopper(Gpupo\AdyenSdk\Payment\Request\Order\Shopper $shopper)    Define shopper
25
 * @method float getAmount()    Acesso a amount
26
 * @method setAmount(float $amount)    Define amount
27
 * @method Gpupo\AdyenSdk\Payment\Request\Order\BillingAddress getBillingAddress()    Acesso a billingAddress
28
 * @method setBillingAddress(Gpupo\AdyenSdk\Payment\Request\Order\BillingAddress $billingAddress)    Define billingAddress
29
 * @method Gpupo\AdyenSdk\Payment\Request\Order\ShippingAddress getShippingAddress()    Acesso a shippingAddress
30
 * @method setShippingAddress(Gpupo\AdyenSdk\Payment\Request\Order\ShippingAddress $shippingAddress)    Define shippingAddress
31
 * @method int getInstallments()    Acesso a installments
32
 * @method setInstallments(integer $installments)    Define installments
33
 * @method string getDeliveryDate()    Acesso a deliveryDate
34
 * @method setDeliveryDate(string $deliveryDate)    Define deliveryDate
35
 * @method string getCreatedAt()    Acesso a createdAt
36
 * @method setCreatedAt(string $createdAt)    Define createdAt
37
 * @method setModificationValue(float $amount)    Define o valor para modificação
38
 */
39
class Order extends EntityAbstract implements EntityInterface
40
{
41
    public function getSchema()
42
    {
43
        return [
44
            'id'                => 'string',
45
            'shopper'           => 'object',
46
            'amount'            => 'number',
47
            'billingAddress'    => 'object',
48
            'shippingAddress'   => 'object',
49
            'installments'      => 'integer',
50
            'deliveryDate'      => 'string',
51
            'createdAt'         => 'string',
52
            'modificationValue' => 'number',
53
        ];
54
    }
55
56
    protected function amountFormat($decimal_separator, $key = 'amount')
57
    {
58
        return number_format($this->get($key), 2, $decimal_separator, '');
59
    }
60
61
    public function getAmount()
62
    {
63
        return $this->amountFormat('.');
64
    }
65
66
    public function getAmountInt()
67
    {
68
        return $this->amountFormat('');
69
    }
70
71
    public function getModificationValueInt()
72
    {
73
        return $this->amountFormat('', 'modificationValue');
74
    }
75
}
76