Ejemplo n.º 1
0
        public async Task <IHttpActionResult> CreateReferenceNumber(string invoiceNumber)
        {
            //create new transaction - set it to unpaid, set refId and send to bank
            var userId    = User.Identity.GetUserId();
            var invoiceId = (await _invoiceAppService.GetInvoiceByNumber(invoiceNumber)).Id;

            var refId = _bankAppService.CreateReference(BankNameType.Mellat, userId, invoiceId);

            return(Ok(refId));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> CreateReferenceNumber(string invoiceNumber)
        {
            //create new transaction - set it to unpaid, set refId and send to bank
            var userId  = User.Identity.GetUserId();
            var invoice = (await _invoiceAppService.GetInvoiceByNumber(invoiceNumber));

            var invoiceVerified = invoice.VerifyInvoice();

            BankNameType bankNameType = ApplicationSettings.DefaultBankName;

            //if (bankName.IsPopulated())
            //    Enum.TryParse(bankName, out bankNameType);

            if (invoiceVerified)
            {
                var refId = await _bankAppService.CreateReference(bankNameType, userId, invoice.Id);

                return(Ok(refId));
            }
            return(BadRequest("فاکتور انتخابی قابل پرداخت نیست"));
        }