コード例 #1
0
ファイル: InvoicePaymentModule.cs プロジェクト: dnywu/sales
 public InvoicePaymentModule()
 {
     this.RequiresAuthentication();
     Post["/pay"] = p =>
     {
         try
         {
             var invoicepayment = this.Request.Form.invoicepayment;
             PayInvoiceDto paydto = JsonConvert.DeserializeObject<PayInvoiceDto>(invoicepayment);
             PayInvoice cmd = new PayInvoice()
             {
                 AmountPaid = paydto.AmountPaid,
                 BankCharge = paydto.BankCharge,
                 InvoiceId = paydto.InvoiceId,
                 PaymentId = Guid.NewGuid(),
                 Notes = paydto.Notes,
                 PaymentDate = paydto.PaymentDate,
                 Reference = paydto.Reference,
                 PaymentMode = paydto.PaymentMode
             };
             this.Bus().Send("dokukuPaymentDistributorDataBus", new CommandMessage{Payload = cmd});
             return Response.AsJson(new { error = false, message = "OK" });
         }
         catch (Exception ex)
         {
             return Response.AsJson(new { error = true, message = ex.Message });
         }
     };
     Post["/SendToEmail/{emailTo}"] = p =>
     {
         try
         {
             var emailTo = p.emailTo.ToString();
             object result = null;
             return Response.AsJson(result);
         }
         catch (Exception ex)
         {
             return Response.AsJson(new { error = true, message = ex.Message });
         }
     };
 }
コード例 #2
0
ファイル: PaymentReceivedModule.cs プロジェクト: dnywu/sales
        public PaymentReceivedModule()
        {
            this.RequiresAuthentication();
            Post["/UpdatePaymentReceived"] = p =>
            {
                try
                {
                    //var paymentReceived = this.Request.Form.dataPaymentReceived;
                    //InvoicePayment dataPayment = JsonConvert.DeserializeObject<InvoicePayment>(paymentReceived);
                    //PayInvoice cmd = new PayInvoice
                    //{
                    //    InvoiceId = dataPayment.InvoiceId,
                    //     PaymentId= Guid.NewGuid(),
                    //    AmountPaid = dataPayment.AmountReceived,
                    //    BankCharge = dataPayment.BankChanges,
                    //    Notes = dataPayment.Notes,
                    //    PaymentDate = dataPayment.Date,
                    //    PaymentMode = dataPayment.PaymentMethod,
                    //    Reference = dataPayment.Reference
                    //};

                    //this.Bus().Send("dokukuPaymentDistributorDataBus", new CommandMessage{Payload = cmd});
                    return Response.AsJson(new { error = false, message = "OK" });
                }
                catch (Exception ex)
                {
                    return Response.AsJson(new { error = true, message = ex.Message });
                }
            };

            Get["/GetAllPaymentReceived"] = p =>
            {
                try
                {
                    //var paymentReceived = this.Request.Form.dataPaymentReceived;
                    //InvoicePayment dataPayment = JsonConvert.DeserializeObject<InvoicePayment>(paymentReceived);
                    IList<PayInvoice> listpayment = new List<PayInvoice>();
                    PayInvoice cmd = new PayInvoice
                    {
                        InvoiceId = Guid.NewGuid(),
                        PaymentId = Guid.NewGuid(),
                        AmountPaid = 9900,
                        BankCharge = 1000,
                        Notes = "belum lunas",
                        PaymentDate = DateTime.Now,
                        PaymentMode = new PaymentMode() { Code="001", Id=Guid.NewGuid(), Name="Transfer Bank" },
                        Reference = "sudah dibayar"
                    };
                    PayInvoice cmd1 = new PayInvoice
                    {
                        InvoiceId = Guid.NewGuid(),
                        PaymentId = Guid.NewGuid(),
                        AmountPaid = 10000,
                        BankCharge = 1000,
                        Notes = "sudah lunas",
                        PaymentDate = DateTime.Now,
                        PaymentMode = new PaymentMode() { Code = "001", Id = Guid.NewGuid(), Name = "Transfer Bank" },
                        Reference = "sudah dibayar"
                    };

                    listpayment.Add(cmd);
                    listpayment.Add(cmd1);

                    //this.Bus().Send("dokukuPaymentDistributorDataBus", new CommandMessage { Payload = cmd });
                    return Response.AsJson(cmd);
                }
                catch (Exception ex)
                {
                    return Response.AsJson(new { error = true, message = ex.Message });
                }
            };
            Get["/GetPaymentReceivedById/{id}"] = p =>
            {
                try
                {
                     var paymentId = p.id.ToString();
                    //InvoicePayment dataPayment = JsonConvert.DeserializeObject<InvoicePayment>(paymentReceived);
                    //PayInvoice cmd = new PayInvoice
                    //{
                    //    InvoiceId = dataPayment.InvoiceId,
                    //    PaymentId = Guid.NewGuid(),
                    //    AmountPaid = dataPayment.AmountReceived,
                    //    BankCharge = dataPayment.BankChanges,
                    //    Notes = dataPayment.Notes,
                    //    PaymentDate = dataPayment.Date,
                    //    PaymentMode = dataPayment.PaymentMethod,
                    //    Reference = dataPayment.Reference
                    //};

                    //this.Bus().Send("dokukuPaymentDistributorDataBus", new CommandMessage { Payload = cmd });
                    return Response.AsJson(new { error = false, message = "OK" });
                }
                catch (Exception ex)
                {
                    return Response.AsJson(new { error = true, message = ex.Message });
                }
            };

            Get["/GetDataPaymentReceivedToPaging/{start}/{limit}"] = p =>
            {
                //int start=0;
                //int limit=0;
                //IEnumerable<Invoices> invoices = this.InvoicesQueryRepository().GetDataInvoiceToPaging(this.CurrentAccount().OwnerId, start, limit);
                return Response.AsJson("");
            };
        }