protected function getDiscountForSwitchToYearly()
{
$amount = 0;
foreach ($this->asBraintreeSubscription()->discounts as $discount) {
if ($discount->id == 'plan-credit') {
$amount += (double) $discount->amount * $discount->numberOfBillingCycles;
}
}
return (object) ['amount' => $amount, 'numberOfBillingCycles' => 1];
}