Skip to content

Commit

Permalink
proration adjustments for next bill amount
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jul 29, 2017
1 parent 89bb0a0 commit d6d9cea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Core/Models/Business/BillingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ public BillingInvoice(StripeInvoice inv)

public BillingInvoice(Subscription sub)
{
Amount = sub.NextBillAmount.GetValueOrDefault();
Amount = sub.NextBillAmount.GetValueOrDefault() + sub.Balance.GetValueOrDefault();
if(Amount < 0)
{
Amount = 0;
}
Date = sub.NextBillingDate;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Core/Services/Implementations/BraintreePaymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public async Task AdjustStorageAsync(IStorableSubscriber storableSubscriber, int
AddOns = new AddOnsRequest(),
Options = new SubscriptionOptionsRequest
{
ProrateCharges = true
ProrateCharges = true,
RevertSubscriptionOnProrationFailure = true
}
};

Expand All @@ -64,7 +65,8 @@ public async Task AdjustStorageAsync(IStorableSubscriber storableSubscriber, int
new UpdateAddOnRequest
{
ExistingId = storageItem.Id,
Quantity = additionalStorage
Quantity = additionalStorage,
NeverExpires = true
}
};
}
Expand Down

0 comments on commit d6d9cea

Please sign in to comment.