public function setPackage($package, $upgraded = null)
    {
        $this->currency = get_config_value('subscriptions.currency', 'US');
        $this->itemName = $package->name;
        $this->itemId = $package->id;
        $this->itemAmount = $package->price;
        $this->duration = $package->duration;
        $this->billingPeriod = $package->billingPeriod;
        $this->recurring = $package->recurring;

        if ($upgraded) {
            $this->duration = max(0, $package->duration - $upgraded->duration);
            $this->itemAmount = max(0, $package->price - $upgraded->price);
            $this->upgrade = true;
        }

        $this->_package = $package;

        return $this;
    }
public function setPackage($package, $upgraded = null)
    {
        $this->currency = get_config_value('subscriptions.currency', 'US');
        $this->itemName = $package->name;
        $this->itemId = $package->id;
        $this->itemAmount = $package->price;
        $this->duration = $package->duration;
        $this->billingPeriod = $package->billingPeriod;
        $this->recurring = $package->recurring;

        if ($upgraded) {
            $this->duration = max(0, $package->duration - $upgraded->duration);
            $this->itemAmount = max(0, $package->price - $upgraded->price);
            $this->upgrade = true;
        }

        $this->_package = $package;

        return $this;
    }
public function setPackage ( $ package , $ upgraded = null ) { $ this -> currency = get_config_value ( 'subscriptions.currency' , 'US' ) ; $ this -> itemName = $ package -> name ; $ this -> itemId = $ package -> id ; $ this -> itemAmount = $ package -> price ; $ this -> duration = $ package -> duration ; $ this -> billingPeriod = $ package -> billingPeriod ; $ this -> recurring = $ package -> recurring ; if ( $ upgraded ) { $ this -> duration = max ( 0 , $ package -> duration - $ upgraded -> duration ) ; $ this -> itemAmount = max ( 0 , $ package -> price - $ upgraded -> price ) ; $ this -> upgrade = true ; } $ this -> _package = $ package ; return $ this ; }
Set the transaction price.

@param ComSubscriptionsDomainEntityPackage $package
@param bool                                $upgraded
Set the transaction price .