internal static void UpdateSubscriptionItem(IMundiAPIClient client, string subscriptionId, string subscriptionItemId) { var request = SubscriptionBuilders.BuildUpdateSubscriptionItemRequest(); try { var response = client.Subscriptions.UpdateSubscriptionItem(subscriptionId, subscriptionItemId, request); FileHelper.SaveResponse(response, "UpdateSubscriptionItem"); } catch (ErrorException e) { FileHelper.SaveApiError(e, "UpdateSubscriptionItem"); } catch (Exception e) { FileHelper.SaveException(e, "UpdateSubscriptionItem"); } }
internal static void CreateDiscountOnItem(IMundiAPIClient client, string subscriptionId, string subscriptionItemId) { var request = SubscriptionBuilders.BuildCreateDiscountOnItemRequest(subscriptionItemId); try { var response = client.Subscriptions.CreateDiscount(request, subscriptionId); FileHelper.SaveResponse(response, "CreateDiscountOnItem"); } catch (ErrorException e) { FileHelper.SaveApiError(e, "CreateDiscountOnItem"); } catch (Exception e) { FileHelper.SaveException(e, "CreateDiscountOnItem"); } }
internal static string CreateSubscriptionItem(IMundiAPIClient client, string subscriptionId) { var request = SubscriptionBuilders.BuildCreateSubscriptionItemRequest(); try { var response = client.Subscriptions.CreateSubscriptionItem(request, subscriptionId); FileHelper.SaveResponse(response, "CreateSubscriptionItem"); return(response.Id); } catch (ErrorException e) { FileHelper.SaveApiError(e, "CreateSubscriptionItem"); return(null); } catch (Exception e) { FileHelper.SaveException(e, "CreateSubscriptionItem"); return(null); } }
internal static string CreateSubscriptionByPlan(IMundiAPIClient client) { var planId = PlansClient.CreatePlan(client); var request = SubscriptionBuilders.BuildCreateSubscriptionByPlanRequest(planId); try { var response = client.Subscriptions.CreateSubscription(request); FileHelper.SaveResponse(response, "CreateSubscriptionByPlan"); return(response.Id); } catch (ErrorException e) { FileHelper.SaveApiError(e, "CreateSubscriptionByPlan"); return(null); } catch (Exception e) { FileHelper.SaveException(e, "CreateSubscriptionByPlan"); return(null); } }