示例#1
0
        public UpdatePaymentStatusResponseModel SaveMidtransLog(UpdatePaymentStatusInputModel data, ModeMidTransEnum mode)
        {
            MidTransLog temp = new MidTransLog();

            PurchaseRepository purchaseRepo = new PurchaseRepository(DbContext);
            var purchaseInfo = purchaseRepo.GetPaymentByInvoiceNumber(data.InvoiceNumber).FirstOrDefault();

            temp.CreateByUserID          = data.UserID;
            temp.CreateDate              = DateTime.Now;
            temp.MidTransStatus          = (int)data.Status;
            temp.PaymentID               = purchaseInfo.ID;
            temp.BankName                = data.BankName;
            temp.VANumber                = data.VANumber;
            temp.MidTransTransactionType = data.MidTransPaymentType;

            MidtransLogRepository repo = new MidtransLogRepository(DbContext);

            var res = repo.Insert(temp);

            UpdatePaymentStatusOutputModel output = new UpdatePaymentStatusOutputModel();

            output.Message = res.Message;

            UpdatePaymentStatusResponseModel response = new UpdatePaymentStatusResponseModel();

            response.Message  = res.Message;
            response.Response = true;


            return(response);
        }
示例#2
0
        public Response Insert(MidTransLog data)
        {
            string   message = "Failed";
            bool     result  = false;
            Response res     = new Response();

            try
            {
                if (data.ID == Guid.Empty)
                {
                    data.ID = Guid.NewGuid();

                    db.Add(data);

                    db.SaveChanges();

                    message = "Save data success";
                    result  = true;
                }

                res.ID      = data.ID;
                res.Message = message;
                res.Result  = result;

                return(res);
            }
            catch (Exception ex)
            {
                res.Message = ex.Message;
                res.Result  = false;

                return(res);
            }
        }
示例#3
0
        public UpdatePaymentStatusResponseModel SaveMidtransLog(NotificationHandlingModel data, ModeMidTransEnum mode)
        {
            MidTransLog temp = new MidTransLog();


            temp.CreateByUserID = Guid.NewGuid();
            temp.CreateDate     = DateTime.Now;
            temp.MidTransStatus = 3;
            temp.PaymentID      = Guid.NewGuid();

            var      iString = data.transaction_time;
            DateTime oDate   = DateTime.ParseExact(iString, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);

            temp.Transaction_Time   = oDate;
            temp.Transaction_Status = data.transaction_status;
            temp.Transaction_ID     = data.transaction_id;
            temp.Status_Message     = data.status_message;
            temp.Status_Code        = data.status_code;
            temp.Signature_Key      = data.signature_key;
            temp.Payment_Type       = data.payment_type;
            temp.Order_ID           = data.order_id;
            temp.Merchant_ID        = data.merchant_id;
            temp.Gross_Amount       = data.gross_amount;
            temp.Currency           = data.currency;
            temp.Approval_Code      = data.approval_code;
            temp.ModeTransaction    = (int)mode;

            MidtransLogRepository repo = new MidtransLogRepository(DbContext);

            var res = repo.Insert(temp);

            UpdatePaymentStatusOutputModel output = new UpdatePaymentStatusOutputModel();

            output.Message = res.Message;

            UpdatePaymentStatusResponseModel response = new UpdatePaymentStatusResponseModel();

            response.Message  = res.Message;
            response.Response = true;


            return(response);
        }