Plugin Directory

Changeset 2482991


Ignore:
Timestamp:
02/28/2021 11:54:45 AM (5 years ago)
Author:
faizpay
Message:

1.0.9 update

Location:
faizpay-commerce
Files:
127 added
24 edited

Legend:

Unmodified
Added
Removed
  • faizpay-commerce/trunk/composer.lock

    r2482772 r2482991  
    1313                "type": "git",
    1414                "url": "https://github.com/FaizRasool/faizpay-php-payment-sdk.git",
    15                 "reference": "843c595545b2b7cf92f0ea9087670b4976480456"
     15                "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb"
    1616            },
    1717            "dist": {
    1818                "type": "zip",
    19                 "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/843c595545b2b7cf92f0ea9087670b4976480456",
    20                 "reference": "843c595545b2b7cf92f0ea9087670b4976480456",
     19                "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/90c4c50dc41e016654bd6f6e356575abd978fcbb",
     20                "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb",
    2121                "shasum": ""
    2222            },
     
    5050                "source": "https://github.com/FaizRasool/faizpay-php-payment-sdk/tree/master"
    5151            },
    52             "time": "2021-02-27T18:43:10+00:00"
     52            "time": "2021-02-28T11:42:29+00:00"
    5353        },
    5454        {
  • faizpay-commerce/trunk/faizpay-commerce-gateway.php

    r2482772 r2482991  
    44Plugin URI:        https://github.com/FaizRasool/faizpay-woocommerce-gateway
    55Description:       Enables the FaizPay as payment option on the woocommerce.
    6 Version:           1.0.8
     6Version:           1.0.9
    77WC requires at least: 3.0
    88WC tested up to: 5.6
  • faizpay-commerce/trunk/readme.txt

    r2470506 r2482991  
    44Tags: faizpay, woo, woocommerce, ecommerce, commerce, bank, HSBC, Barclay, Royal Bank of Scotland, RBS, Lloyds, Santander, Nationwide, Natwest
    55Requires at least: 3.0
    6 Requires PHP: 5.6
    7 Tested up to: 5.6
     6Requires PHP: 7.0
     7Tested up to: 8.0
    88Stable tag: 1.1.4
    99License: GPLv2 or later
  • faizpay-commerce/trunk/src/FaizPayPaymentGateway.php

    r2482724 r2482991  
    3838
    3939        add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     40
    4041        add_action('woocommerce_api_faizpay', array($this, 'webhook'));
    4142
     
    4344        // https://rudrastyh.com/woocommerce/thank-you-page.html
    4445
    45         add_filter('woocommerce_endpoint_order-received_title', [$this, 'redirect_end_point_title']);
    46         add_filter('woocommerce_thankyou_order_received_text', [$this, 'redirect_end_point_text']);
     46        // add_filter('woocommerce_endpoint_order-received_title', [$this, 'redirect_end_point_title']);
     47        add_filter('woocommerce_thankyou_order_received_text', [$this, 'order_received_text'], 10, 2);
    4748    }
    4849
    49     public function redirect_end_point_title($text)
     50
     51    public function order_received_text($text)
    5052    {
    51         return OrderComplete::title($text);
    52     }
    53 
    54     public function redirect_end_point_text($text)
    55     {
    56         return OrderComplete::title($text);
     53        return OrderComplete::title($text, $this);
    5754    }
    5855
  • faizpay-commerce/trunk/src/OrderComplete.php

    r2482724 r2482991  
    77class OrderComplete
    88{
    9     public static function title($old)
     9    public static function title($old, FaizPayPaymentGateway $faizPayPaymentGateway)
    1010    {
    1111        global $woocommerce;
    1212
    1313        $orderID = self::getOrderId();
     14
    1415        $order = wc_get_order($orderID);
    1516
    16         $orderData = wc_get_order($order);
    17 
    18         if($orderData === false){
     17        if ($order === false) {
    1918            return $old;
    2019        }
    2120
    22         $paymentMethod = $orderData->get_payment_method();
     21        $paymentMethod = $order->get_payment_method();
    2322        if ($paymentMethod != 'faizpay_payment') {
    2423            return $old;
    2524        }
    2625
     26        // if mark as accepted
    2727        if (self::checkOrderStatus()) {
    28             // Remove cart items
    29             $woocommerce->cart->empty_cart();
    30             return $old;
    31         }
    32         wc_add_notice('Your payment has been rejected', 'notice');
    33         $url = wc_get_checkout_url();
    34         if (wp_redirect($url)) {
    35             exit;
     28            // if doesn't need payment
     29            if (!$order->needs_payment()) {
     30                // Remove cart items
     31                $woocommerce->cart->empty_cart();
     32                // only show the final link if order completed in last half an hour
     33                $datePaid = $order->get_date_paid();
     34                if ($datePaid instanceof \DateTime) {
     35                    $now = new \DateTime();
     36                    $diff = $now->diff($datePaid);
     37                    $minutes =
     38                        ($diff->format('%a') * 1440) + // total days converted to minutes
     39                        ($diff->format('%h') * 60) +   // hours converted to minutes
     40                        $diff->format('%i');          // minutes
     41                    if ($minutes <= 30) { // if order with in half an hour
     42                        $url = $faizPayPaymentGateway->get_return_url($order);
     43                        if (wp_redirect($url)) {
     44                            exit;
     45                        }
     46                    }
     47                }
     48            }
     49        } else {
     50            if ($order->needs_payment()) {
     51                $url = $order->get_cancel_order_url_raw();
     52                if (wp_redirect($url)) {
     53                    exit;
     54                }
     55            }
    3656        }
    3757        return "Payment Rejected";
    3858    }
    3959
    40     public static function text($old)
     60    public
     61    static function text($old)
    4162    {
    4263        if (self::checkOrderStatus()) {
     
    4667    }
    4768
    48     private static function checkOrderStatus()
     69    private
     70    static function checkOrderStatus()
    4971    {
    5072        $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : "rejected";
     
    5577    }
    5678
    57     private static function getOrderId()
     79    private
     80    static function getOrderId()
    5881    {
    5982        return isset($_GET['order']) ? sanitize_text_field($_GET['order']) : "0";
  • faizpay-commerce/trunk/src/PaymentProcess.php

    r2482753 r2482991  
    7777            $item = Item::createItem(
    7878                $item->get_name(),
    79                 $item->get_quantity(),
    80                 NumberFormatter::formatNumber($item->get_total())
     79                $item->get_quantity()
    8180            );
    8281            if ($item instanceof Item) {
     
    8887        if ($order->get_shipping_address_1() != '') {
    8988            $country = $order->get_billing_country();
     89
    9090            if ($country == 'GB') {
    9191                $country = 'UK';
    9292            }
     93
     94            if (strlen($country) != '2') {
     95                $country = 'UK';
     96            }
     97
    9398            $deliveryAddress = DeliveryAddress::createDeliveryAddress(
    9499                $order->get_shipping_address_1(),
     
    100105        } else {
    101106            $country = $order->get_billing_country();
     107
    102108            if ($country == 'GB') {
    103109                $country = 'UK';
    104110            }
     111
     112            if (strlen($country) != '2') {
     113                $country = 'UK';
     114            }
     115
    105116            $deliveryAddress = DeliveryAddress::createDeliveryAddress(
    106117                $order->get_billing_address_1(),
  • faizpay-commerce/trunk/vendor/autoload.php

    r2482772 r2482991  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit8f7dbe19d769984dc8905253ccffc513::getLoader();
     7return ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416::getLoader();
  • faizpay-commerce/trunk/vendor/composer/InstalledVersions.php

    r2482772 r2482991  
    4343        0 => '9999999-dev',
    4444      ),
    45       'reference' => '843c595545b2b7cf92f0ea9087670b4976480456',
     45      'reference' => '90c4c50dc41e016654bd6f6e356575abd978fcbb',
    4646    ),
    4747    'faizrasool/faizpay-payment-gateway' =>
  • faizpay-commerce/trunk/vendor/composer/autoload_real.php

    r2482772 r2482991  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit8f7dbe19d769984dc8905253ccffc513
     5class ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit8f7dbe19d769984dc8905253ccffc513', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    29         spl_autoload_unregister(array('ComposerAutoloaderInit8f7dbe19d769984dc8905253ccffc513', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit8f7dbe19d769984dc8905253ccffc513::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • faizpay-commerce/trunk/vendor/composer/autoload_static.php

    r2482772 r2482991  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit8f7dbe19d769984dc8905253ccffc513
     7class ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3838    {
    3939        return \Closure::bind(function () use ($loader) {
    40             $loader->prefixLengthsPsr4 = ComposerStaticInit8f7dbe19d769984dc8905253ccffc513::$prefixLengthsPsr4;
    41             $loader->prefixDirsPsr4 = ComposerStaticInit8f7dbe19d769984dc8905253ccffc513::$prefixDirsPsr4;
    42             $loader->classMap = ComposerStaticInit8f7dbe19d769984dc8905253ccffc513::$classMap;
     40            $loader->prefixLengthsPsr4 = ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::$prefixLengthsPsr4;
     41            $loader->prefixDirsPsr4 = ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::$prefixDirsPsr4;
     42            $loader->classMap = ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::$classMap;
    4343
    4444        }, null, ClassLoader::class);
  • faizpay-commerce/trunk/vendor/composer/installed.json

    r2482772 r2482991  
    88                "type": "git",
    99                "url": "https://github.com/FaizRasool/faizpay-php-payment-sdk.git",
    10                 "reference": "843c595545b2b7cf92f0ea9087670b4976480456"
     10                "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb"
    1111            },
    1212            "dist": {
    1313                "type": "zip",
    14                 "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/843c595545b2b7cf92f0ea9087670b4976480456",
    15                 "reference": "843c595545b2b7cf92f0ea9087670b4976480456",
     14                "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/90c4c50dc41e016654bd6f6e356575abd978fcbb",
     15                "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb",
    1616                "shasum": ""
    1717            },
     
    2323                "phpunit/phpunit": "^8"
    2424            },
    25             "time": "2021-02-27T18:43:10+00:00",
     25            "time": "2021-02-28T11:42:29+00:00",
    2626            "default-branch": true,
    2727            "type": "library",
  • faizpay-commerce/trunk/vendor/composer/installed.php

    r2482772 r2482991  
    2020        0 => '9999999-dev',
    2121      ),
    22       'reference' => '843c595545b2b7cf92f0ea9087670b4976480456',
     22      'reference' => '90c4c50dc41e016654bd6f6e356575abd978fcbb',
    2323    ),
    2424    'faizrasool/faizpay-payment-gateway' =>
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/ORIG_HEAD

    r2482772 r2482991  
    1 843c595545b2b7cf92f0ea9087670b4976480456
     190c4c50dc41e016654bd6f6e356575abd978fcbb
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/info/refs

    r2482772 r2482991  
    1 843c595545b2b7cf92f0ea9087670b4976480456    refs/heads/master
    2 843c595545b2b7cf92f0ea9087670b4976480456    refs/remotes/origin/HEAD
    3 843c595545b2b7cf92f0ea9087670b4976480456    refs/remotes/origin/master
     190c4c50dc41e016654bd6f6e356575abd978fcbb    refs/heads/master
     290c4c50dc41e016654bd6f6e356575abd978fcbb    refs/remotes/origin/HEAD
     390c4c50dc41e016654bd6f6e356575abd978fcbb    refs/remotes/origin/master
    44332b9c1ddc35b1b0015a1cc1abc5ac91d1f23c96    refs/tags/v1.0.0
    55e18ab51255c37733bd0c2d14dbce3e57cc569663    refs/tags/v1.0.0^{}
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/logs/HEAD

    r2482772 r2482991  
    1 0000000000000000000000000000000000000000 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467 +0000    clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/
    2 843c595545b2b7cf92f0ea9087670b4976480456 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467 +0000    checkout: moving from master to master
    3 843c595545b2b7cf92f0ea9087670b4976480456 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467 +0000    reset: moving to 843c595545b2b7cf92f0ea9087670b4976480456
     10000000000000000000000000000000000000000 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000    clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/
     290c4c50dc41e016654bd6f6e356575abd978fcbb 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000    checkout: moving from master to master
     390c4c50dc41e016654bd6f6e356575abd978fcbb 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000    reset: moving to 90c4c50dc41e016654bd6f6e356575abd978fcbb
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/logs/refs/heads/master

    r2482772 r2482991  
    1 0000000000000000000000000000000000000000 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467 +0000    clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/
     10000000000000000000000000000000000000000 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000    clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/logs/refs/remotes/origin/HEAD

    r2482772 r2482991  
    1 0000000000000000000000000000000000000000 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467 +0000    clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/
     10000000000000000000000000000000000000000 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000    clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/objects/info/packs

    r2482772 r2482991  
    1 P pack-3cfe2eaa7c003569f48592f053b7e602233cced2.pack
     1P pack-b9681e062e74d9dcc11d2dab80dc2e57bad87397.pack
    22
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/packed-refs

    r2482772 r2482991  
    11# pack-refs with: peeled fully-peeled sorted
    2 843c595545b2b7cf92f0ea9087670b4976480456 refs/remotes/origin/master
     290c4c50dc41e016654bd6f6e356575abd978fcbb refs/remotes/origin/master
    33332b9c1ddc35b1b0015a1cc1abc5ac91d1f23c96 refs/tags/v1.0.0
    44^e18ab51255c37733bd0c2d14dbce3e57cc569663
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/refs/heads/master

    r2482772 r2482991  
    1 843c595545b2b7cf92f0ea9087670b4976480456
     190c4c50dc41e016654bd6f6e356575abd978fcbb
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/src/Errors.php

    r2482753 r2482991  
    2424    public const CODE_19 = [19, 'Item name need to be less than 255'];
    2525    public const CODE_20 = [20, 'Item quantity need to be more than 1'];
    26     public const CODE_21 = [21, 'Item Amount cannot be empty or less than 0.01'];
    27     public const CODE_22 = [22, 'Item Amount must be 2 decimal places'];
     26
    2827    public const CODE_23 = [23, 'Delivery Address Line 1 cannot be empty or greater than 255 characters'];
    2928    public const CODE_24 = [24, 'Delivery Address Line 2 cannot be greater than 255 characters'];
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/src/Item.php

    r2482772 r2482991  
    22
    33namespace FaizPay\PaymentSDK;
    4 
    5 use FaizPay\PaymentSDK\Helper\NumberFormatter;
    64
    75class Item
     
    1816
    1917    /**
    20      * @var string
    21      */
    22     private $amount;
    23 
    24     /**
    2518     * @param string $name
    2619     * @param int $quantity
    27      * @param string $amount
    2820     * @return Error|Item
    2921     */
    3022    public static function createItem(string $name,
    31                                       int $quantity,
    32                                       string $amount
     23                                      int $quantity
    3324    )
    3425    {
     
    4435            return new Error(Errors::CODE_20);
    4536        }
    46 
    47         // validate amount
    48         if ($amount == '' || $amount == '0.00' || (float)$amount < 0) {
    49             return new Error(Errors::CODE_21);
    50         }
    51 
    52         // validate amount
    53         if (!NumberFormatter::validateTwoDecimals($amount)) {
    54             return new Error(Errors::CODE_22);
    55         }
    56         return new Item($name, $quantity, $amount);
     37        return new Item($name, $quantity);
    5738    }
    5839
     
    6142     * @param string $name
    6243     * @param int $quantity
    63      * @param string $amount
    6444     */
    65     private function __construct(string $name, int $quantity, string $amount)
     45    private function __construct(string $name, int $quantity)
    6646    {
    6747        $this->name = $name;
    6848        $this->quantity = $quantity;
    69         $this->amount = $amount;
    7049    }
    7150
     
    8665    }
    8766
    88 
    89     /**
    90      * @return string
    91      */
    92     public function getAmount(): string
    93     {
    94         return $this->amount;
    95     }
    96 
    9767    /**
    9868     * @return string[]
     
    10373            'name' => $this->getName(),
    10474            'quantity' => $this->getQuantity(),
    105             'amount' => $this->getAmount()
    10675        ];
    10776    }
  • faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/tests/ItemTest.php

    r2482772 r2482991  
    1313    public function testErrorOnNameMoreThan255Characters()
    1414    {
    15         $item = Item::createItem(str_repeat('a', 256), 1, '1.00');
     15        $item = Item::createItem(str_repeat('a', 256), 1);
    1616        $this->assertInstanceOf(Error::class, $item);
    1717        $this->assertEquals($item->getMessage(), Errors::CODE_19[1]);
     
    2121    public function testErrorOnQuantityLessThan1()
    2222    {
    23         $item = Item::createItem('Cup', 0, '1.00');
     23        $item = Item::createItem('Cup', 0);
    2424        $this->assertInstanceOf(Error::class, $item);
    2525        $this->assertEquals($item->getMessage(), Errors::CODE_20[1]);
    2626
    27         $item = Item::createItem('Cup', -10, '1.00');
     27        $item = Item::createItem('Cup', -10);
    2828        $this->assertInstanceOf(Error::class, $item);
    2929        $this->assertEquals($item->getMessage(), Errors::CODE_20[1]);
    3030    }
    3131
    32     public function testErrorOnZeroAmount()
    33     {
    34         $item = Item::createItem('Cup', 1, '0.00');
    35         $this->assertInstanceOf(Error::class, $item);
    36         $this->assertEquals($item->getMessage(), Errors::CODE_21[1]);
    37 
    38     }
    39 
    40     public function testErrorOnEmptyAmount()
    41     {
    42         $item = Item::createItem('Cup', 1, '');
    43         $this->assertInstanceOf(Error::class, $item);
    44         $this->assertEquals($item->getMessage(), Errors::CODE_21[1]);
    45     }
    46 
    47     public function testErrorOnLessThanZeroAmount()
    48     {
    49         $item = Item::createItem('Cup', 1, '-1.00');
    50         $this->assertInstanceOf(Error::class, $item);
    51         $this->assertEquals($item->getMessage(), Errors::CODE_21[1]);
    52     }
    53 
    54     public function testErrorOnMoreOrLessThan2DecimalPlacesForAmount()
    55     {
    56         $item = Item::createItem('Cup', 1, '0.00000000001');
    57         $this->assertInstanceOf(Error::class, $item);
    58         $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);
    59 
    60         $item = Item::createItem('Cup', 1, '1');
    61         $this->assertInstanceOf(Error::class, $item);
    62         $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);
    63     }
    64 
    65     public function testErrorOnValidAmount()
    66     {
    67         $item = Item::createItem('Cup', 1, 'abc');
    68         $this->assertInstanceOf(Error::class, $item);
    69         $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);
    70 
    71         $item = Item::createItem('Cup', 1, 'abc.00');
    72         $this->assertInstanceOf(Error::class, $item);
    73         $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);
    74     }
    75 
    7632    public function testGetName()
    7733    {
    78         $item = Item::createItem('Cup', 1, '1.00');
     34        $item = Item::createItem('Cup', 1);
    7935        $this->assertEquals('Cup', $item->getName());
    8036    }
     
    8238    public function testGetQuantity()
    8339    {
    84         $item = Item::createItem('Cup', 1, '2.00');
     40        $item = Item::createItem('Cup', 1);
    8541        $this->assertEquals(1, $item->getQuantity());
    86     }
    87 
    88     public function testGetAmount()
    89     {
    90         $item = Item::createItem('Cup', 1, '1.00');
    91         $this->assertEquals('1.00', $item->getAmount());
    9242    }
    9343
     
    9545    public function testGetToArray()
    9646    {
    97         $item = Item::createItem('Cup', 1, '1.00');
     47        $item = Item::createItem('Cup', 1);
    9848        $this->assertEquals(
    9949            [
    10050                'name' => 'Cup',
    101                 'quantity' => 1,
    102                 'amount' => '1.00'
     51                'quantity' => 1
    10352            ], $item->toArray());
    10453    }
    105 
    10654}
Note: See TracChangeset for help on using the changeset viewer.