Beispiel #1
0
        public async Task <InvoicePaymentProvider> CreateUriForPayment(Invoice invoice, Order order, Plan plan)
        {
            PlanPrice price    = plan.PlanPrices.Single(x => x.Currency.Code == Currency.CurrencyValue.ARS);
            var       contract = new CheckoutCreateContract
            {
                Total       = price.Price,
                Currency    = Currency.CurrencyValue.ARS.ToString(),
                Reference   = invoice.Id.ToString(),
                Description = plan.Description,
                ReturnUrl   = _mobbexOptions.ReturnUrl + "?invoiceId=" + invoice.Id,
                Webhook     = _mobbexOptions.WebhookUrl + "?invoiceId=" + invoice.Id,
                Test        = _mobbexOptions.Environment == Domain.Enums.PaymentProviderEnvironment.Sandbox,
                Options     = new SubscriptionOptionsDto()
            };

            var response = await _apiGateway.PostAsync <CheckoutContract, CheckoutCreateContract>(ENDPOINT, contract);

            return(new InvoicePaymentProvider
            {
                Link = new System.Uri(response.Data.Url),
                Transaction = response.Data.Id,
                InvoceId = invoice.Id,
                PaymentProvider = new PaymentProvider(PaymentProvider.PaymentProviderValue.Mobbex)
            });
        }