protected function getDiscountForSwitchToYearly()
    {
        $amount = 0;

        foreach ($this->asBraintreeSubscription()->discounts as $discount) {
            if ($discount->id == 'plan-credit') {
                $amount += (float) $discount->amount * $discount->numberOfBillingCycles;
            }
        }

        return (object) [
            'amount' => $amount,
            'numberOfBillingCycles' => 1,
        ];
    }
protected function getDiscountForSwitchToYearly()
    {
        $amount = 0;

        foreach ($this->asBraintreeSubscription()->discounts as $discount) {
            if ($discount->id == 'plan-credit') {
                $amount += (float) $discount->amount * $discount->numberOfBillingCycles;
            }
        }

        return (object) [
            'amount' => $amount,
            'numberOfBillingCycles' => 1,
        ];
    }
protected function getDiscountForSwitchToYearly ( ) { $ amount = 0 ; foreach ( $ this -> asBraintreeSubscription ( ) -> discounts as $ discount ) { if ( $ discount -> id == 'plan-credit' ) { $ amount += ( float ) $ discount -> amount * $ discount -> numberOfBillingCycles ; } } return ( object ) [ 'amount' => $ amount , 'numberOfBillingCycles' => 1 , ] ; }
Get the discount to apply when switching to a yearly plan.

@return object
Get the discount to apply when switching to a yearly plan .