public LiqPayPaymentInfo(PaymentPrepareModel prepare) { Amount = prepare.Amount; OrderId = prepare.OrderId; Description = prepare.Description; CallbackUrl = prepare.CallbackUrl; Expired = GetDate(prepare.Expired); }
public PaymentInfo CreateManufacturerTradePromise(AddManufacturerSellDto manufacturerSellDto, string callbackEndpoint) { if (manufacturerSellDto.NewAccountExtension == null && manufacturerSellDto.ExisitingAccountExtensionId == null) { throw new NotFoundException("nor old neither new account extension"); } SessionService.CheckSession(manufacturerSellDto.Session); if (manufacturerSellDto.NewAccountExtension != null && manufacturerSellDto.NewAccountExtension.AccountId != manufacturerSellDto.Session.UserId) { throw new ForbiddenException("account owner"); } AccountExtensionModel accountExtension = manufacturerSellDto.ExisitingAccountExtensionId == null || !manufacturerSellDto.ExisitingAccountExtensionId.HasValue ? Mapper.Map <AccountExtensionDto, AccountExtensionModel>(manufacturerSellDto.NewAccountExtension) : AccountExtensionRepo.Get(manufacturerSellDto.ExisitingAccountExtensionId.Value); if (accountExtension == null) { throw new NotFoundException("account extension"); } if (accountExtension.AccountId != manufacturerSellDto.Session.UserId) { throw new ForbiddenException("account owner"); } string orderId = Guid.NewGuid().ToString(); SellModel sellModel = BuildOrderFromManufacturer(orderId, accountExtension, manufacturerSellDto.Positions); Sell sell = new Sell(orderId, sellModel); PendingOrders.Add(orderId, sell); PaymentPrepareModel paymentPrepare = new PaymentPrepareModel(orderId, sellModel.TotalPrice); paymentPrepare.CallbackUrl = callbackEndpoint; paymentPrepare.Expired = sell.Expires; PaymentInfo payment = PaymentService.CreateFromUserPayment(paymentPrepare); sell.PaymentInfo = payment; return(payment); }
public override PaymentInfo CreateFromUserPayment(PaymentPrepareModel paymentPrepare) { LiqPayPaymentInfo liqPayPayment = new LiqPayPaymentInfo(paymentPrepare) { Version = VERSION, Action = ACTION, Currency = CURRENCY, PublicKey = PUBLIC_KEY, PrivateKey = PRIVATE_KEY, }; string json = JsonConvert.SerializeObject(liqPayPayment); byte[] dataBytes = Encoding.UTF8.GetBytes(json); string data = Convert.ToBase64String(dataBytes); string signature = GetSignature(data); return(new PaymentInfo(data, signature)); }
public async Task <SignedPaymentInfo> GetPaymentForm(string login) { IEnumerable <OrderEntity> oldUnpayedOrders = await GetOldUnpayedOrders(login); if (oldUnpayedOrders.Count() == 0) { throw new NotFoundException("orders to pay for"); } int tax = GetTaxAmount(oldUnpayedOrders); string id = Guid.NewGuid().ToString(); PaymentPrepareModel paymentPrepare = new PaymentPrepareModel(id, tax, CALLBACK_URL); SignedPaymentInfo signedPayment = LiqPay.CreatePayment(paymentPrepare); PendingPayment pending = new PendingPayment(id, signedPayment, oldUnpayedOrders); PendingPayments.Add(id, pending); return(signedPayment); }
public abstract PaymentInfo CreateFromUserPayment(PaymentPrepareModel paymentPrepare);