Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Core/Resgrid.Services/SubscriptionsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,9 @@ public async Task<CreateStripeSessionForUpdateData> CreateStripeSessionForUpdate
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/CreateStripeSessionForUpdate", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand Down Expand Up @@ -1018,6 +1021,9 @@ public async Task<GetCanceledPlanFromStripeData> GetActiveStripeSubscriptionAsyn
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/GetActiveStripeSubscription", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand All @@ -1042,6 +1048,9 @@ public async Task<GetCanceledPlanFromStripeData> GetActivePTTStripeSubscriptionA
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/GetActivePTTStripeSubscription", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand All @@ -1066,6 +1075,9 @@ public async Task<bool> ModifyPTTAddonSubscriptionAsync(string stripeCustomerId,
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/ModifyPTTAddonSubscription", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand All @@ -1092,6 +1104,9 @@ public async Task<bool> CancelSubscriptionAsync(string stripeCustomerId)
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/CancelSubscription", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand All @@ -1116,6 +1131,9 @@ public async Task<CreateStripeBillingPortalSessionData> CreateStripeSessionForCu
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/CreateStripeSessionForCustomerPortal", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand Down Expand Up @@ -1152,6 +1170,9 @@ public async Task<CreateStripeSessionForUpdateData> CreateStripeSessionForSub(in
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/CreateStripeSessionForSubscriptionCheckout", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand Down Expand Up @@ -1182,6 +1203,9 @@ public async Task<ChangeActiveSubscriptionData> ChangeActiveSubscriptionAsync(st
{
if (!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey))
{
if (string.IsNullOrWhiteSpace(stripeCustomerId))
stripeCustomerId = " ";

var client = new RestClient(Config.SystemBehaviorConfig.BillingApiBaseUrl, configureSerialization: s => s.UseNewtonsoftJson());
var request = new RestRequest($"/api/Billing/ChangeActiveSubscription", Method.Get);
request.AddHeader("X-API-Key", Config.ApiConfig.BackendInternalApikey);
Expand Down