public IDisposableDependencyObjectWrapper <IPaymentGatewayManager> Create(ESubscriptionPaymentGatewayType gateway) { switch (gateway) { // case SubscriptionPaymentGatewayType.Paypal: // return IocManager.Instance.ResolveAsDisposable<PayPalGatewayManager>(); default: throw new Exception("Can not create IPaymentGatewayManager for given gateway: " + gateway); } }
public void RemoveCacheItem(ESubscriptionPaymentGatewayType gateway, string paymentId) { var key = GetCacheKey(gateway, paymentId); var cacheItem = GetCacheItemOrNull(gateway, paymentId); if (cacheItem == null) { return; } _cacheManager.GetCache(PaymentCacheItem.CacheName).Remove(key); }
public async Task <SubscriptionPayment> UpdateByGatewayAndPaymentIdAsync(ESubscriptionPaymentGatewayType gateway, string paymentId, int?tenantId, SubscriptionPaymentStatus status) { var payment = await SingleAsync(p => p.PaymentId == paymentId && p.Gateway == gateway); payment.Status = status; if (tenantId.HasValue) { payment.TenantId = tenantId.Value; } return(payment); }
public async Task <SubscriptionPayment> GetByGatewayAndPaymentIdAsync(ESubscriptionPaymentGatewayType gateway, string paymentId) { return(await SingleAsync(p => p.PaymentId == paymentId && p.Gateway == gateway)); }
private static string GetCacheKey(ESubscriptionPaymentGatewayType gateway, string paymentId) { return(gateway + "_" + paymentId); }
public virtual PaymentCacheItem GetCacheItemOrNull(ESubscriptionPaymentGatewayType gateway, string paymentId) { return(_cacheManager .GetCache(PaymentCacheItem.CacheName) .GetOrDefault <string, PaymentCacheItem>(GetCacheKey(gateway, paymentId))); }
public static SubscriptionPaymentStatus GetPaymentStatus(this ESubscriptionPaymentGatewayType gateway, string externalPaymentStatus) { return(gateway.CreatePaymentGatewayPaymentStatusConverter().ConvertToSubscriptionPaymentStatus(externalPaymentStatus)); }
private static IPaymentGatewayPaymentStatusConverter CreatePaymentGatewayPaymentStatusConverter(this ESubscriptionPaymentGatewayType gateway) { switch (gateway) { // case SubscriptionPaymentGatewayType.Paypal: // return new PayPalPaymentGatewayPaymentStatusConverter(); default: throw new Exception("Unknown payment gatwway: " + gateway); } }
public PaymentCacheItem(ESubscriptionPaymentGatewayType gateWay, EPaymentPeriodType paymentPeriodType, string paymentId) { GateWay = gateWay; PaymentId = paymentId; PaymentPeriodType = paymentPeriodType; }