2021-11-14 05:28:24 +01:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using System;
|
2021-08-12 03:44:15 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-08-15 09:38:48 +02:00
|
|
|
|
using Teknik.BillingCore.Models;
|
2021-08-12 03:44:15 +02:00
|
|
|
|
using Teknik.Configuration;
|
|
|
|
|
|
|
|
|
|
namespace Teknik.BillingCore
|
|
|
|
|
{
|
|
|
|
|
public abstract class BillingService
|
|
|
|
|
{
|
|
|
|
|
protected readonly BillingConfig Config;
|
|
|
|
|
|
|
|
|
|
public BillingService(BillingConfig billingConfig)
|
|
|
|
|
{
|
|
|
|
|
Config = billingConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-20 01:59:31 +01:00
|
|
|
|
public abstract List<Customer> GetCustomers();
|
|
|
|
|
public abstract Customer GetCustomer(string id);
|
2021-11-14 05:28:24 +01:00
|
|
|
|
public abstract string CreateCustomer(string username, string email);
|
2021-08-12 03:44:15 +02:00
|
|
|
|
|
2021-08-15 09:38:48 +02:00
|
|
|
|
public abstract List<Product> GetProductList();
|
|
|
|
|
public abstract Product GetProduct(string productId);
|
2021-08-12 03:44:15 +02:00
|
|
|
|
|
2021-08-15 09:38:48 +02:00
|
|
|
|
public abstract List<Price> GetPriceList(string productId);
|
|
|
|
|
public abstract Price GetPrice(string priceId);
|
2021-08-12 03:44:15 +02:00
|
|
|
|
|
2021-08-15 09:38:48 +02:00
|
|
|
|
public abstract List<Subscription> GetSubscriptionList(string customerId);
|
|
|
|
|
public abstract Subscription GetSubscription(string subscriptionId);
|
2021-11-14 05:28:24 +01:00
|
|
|
|
public abstract Subscription CreateSubscription(string customerId, string priceId);
|
|
|
|
|
public abstract Subscription EditSubscriptionPrice(string subscriptionId, string priceId);
|
2021-11-29 07:26:20 +01:00
|
|
|
|
public abstract Subscription RenewSubscription(string subscriptionId);
|
2021-11-29 05:57:15 +01:00
|
|
|
|
public abstract bool CancelSubscription(string subscriptionId, bool atEndOfPeriod);
|
2021-08-12 03:44:15 +02:00
|
|
|
|
|
2021-11-14 05:28:24 +01:00
|
|
|
|
public abstract CheckoutSession CreateCheckoutSession(string customerId, string priceId, string successUrl, string cancelUrl);
|
|
|
|
|
public abstract CheckoutSession GetCheckoutSession(string sessionId);
|
|
|
|
|
|
2021-11-18 08:13:46 +01:00
|
|
|
|
public abstract PortalSession CreatePortalSession(string customerId, string returnUrl);
|
|
|
|
|
|
2021-11-16 05:17:42 +01:00
|
|
|
|
public abstract Task<Event> ParseEvent(HttpRequest request, string apiKey);
|
2021-11-14 05:28:24 +01:00
|
|
|
|
public abstract CheckoutSession ProcessCheckoutCompletedEvent(Event e);
|
2021-11-16 05:17:42 +01:00
|
|
|
|
public abstract Subscription ProcessSubscriptionEvent(Event e);
|
2021-11-20 01:14:27 +01:00
|
|
|
|
public abstract Customer ProcessCustomerEvent(Event e);
|
2021-08-12 03:44:15 +02:00
|
|
|
|
}
|
|
|
|
|
}
|