コード例 #1
0
 public Task <ReceiptResponse> SignAsync(ReceiptRequest request)
 {
     return(FromResult(new ReceiptResponse
     {
         ftQueueID = request.ftQueueID
     }));
 }
コード例 #2
0
        internal static ReceiptRequest PaymentTransferRequest(int n, decimal amount1 = 4.8m, decimal amount2 = 3.3m, string cashBoxId = "")
        {
            var reqdata = new ReceiptRequest()
            {
                ftCashBoxID        = cashBoxId,
                cbTerminalID       = "1",
                ftReceiptCase      = GetReceiptCase(0x465200000000000C),
                cbReceiptReference = n.ToString(),
                cbReceiptMoment    = DateTime.UtcNow,
                cbChargeItems      = new ChargeItem[] { },
                cbPayItems         = new PayItem[]                {
                    new PayItem()
                    {
                        ftPayItemCase = 0x4652000000000001,
                        Amount        = amount1 + amount2,
                        Quantity      = 1.0m,
                        Description   = "Cash"
                    },
                    new PayItem()
                    {
                        ftPayItemCase = 0x4652000000000011,
                        Amount        = -amount1 - amount2,
                        Quantity      = 1.0m,
                        Description   = "Payment compensation"
                    }
                }
            };

            return(reqdata);
        }
コード例 #3
0
        public bool Run(string hash)
        {
            Request            = new ReceiptRequest();
            Request.param.Hash = hash;

            return(Run(Request));
        }
コード例 #4
0
        public IHttpActionResult ValidatePurchaseReceipt(ReceiptRequest receiptRequest)
        {
            StringBuilder           traceLog = null;
            SearchResponse <string> response = null;

            try
            {
                traceLog = new StringBuilder();
                traceLog.AppendLine("Start: UpdateAppSubscriptionStatus Request Data:-DeviceId-"
                                    + receiptRequest.DeviceId + ",DeviceType-" + receiptRequest.DeviceType);
                response = new SearchResponse <string>();
                response.IsResultTrue = true;
                response.jsonData     = HomeRequestBL.ValidateIOSReceipt(receiptRequest);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                LogManager.LogManagerInstance.WriteErrorLog(ex);
                response.IsResultTrue = false;
                response.ErrorMessage = Message.ServerError;
                return(Ok(response));
            }
            finally
            {
                traceLog.AppendLine("End :UpdateAppSubscriptionStatus() Response Data:-Status Date-" + DateTime.Now.ToLongDateString());
                LogManager.LogManagerInstance.WriteTraceLog(traceLog);
                traceLog = null;
            }
        }
コード例 #5
0
 public IActionResult Receipt([FromBody] ReceiptRequest receiptRequest)
 {
     if (receiptRequest == null)
     {
         throw new Exception("参数错误");
     }
     //return SuccessRes(await oCRService.ReceiptOCR(receiptRequest));
     return(SuccessRes(""));
 }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oCRRequest"></param>
        /// <returns></returns>
        public ReceiptOCRResponse ReceiptOCR(ReceiptRequest oCRRequest)
        {
            var imageUrl = (oCRRequest.Type == null || oCRRequest.Type == 1) ? oCRRequest.imageUrl : "";

            //return
            //    RecognitOCRResult(TencentOCR.GeneralAccurateOCR(oCRRequest.imageUrl, oCRRequest.Type),
            //                      imageUrl);
            //_iOCRLogDAO.
            return(new ReceiptOCRResponse());
        }
コード例 #7
0
 async Task <ReceiptResponse> IPOS.SignAsync(ReceiptRequest request)
 {
     if (_options.CommunicationType == HttpCommunicationType.Json)
     {
         return(await JsonSignAsync <ReceiptRequest, ReceiptResponse>(request, "v1/sign"));
     }
     else
     {
         return(await XmlSignAsync <ReceiptRequest, ReceiptResponse>(request, "v1/sign"));
     }
 }
コード例 #8
0
        public void Sign_ShouldReturnSameQueueId()
        {
            var client      = CreateClient();
            var queueId     = Guid.NewGuid().ToString();
            var signRequest = new ReceiptRequest
            {
                ftQueueID = queueId
            };
            var response = client.Sign(signRequest);

            response.ftQueueID.Should().Be(queueId);
        }
コード例 #9
0
        public async Task SignAsync_ShouldReturnSameQueueId()
        {
            var client      = CreateClient();
            var queueId     = Guid.NewGuid().ToString();
            var signRequest = new ReceiptRequest
            {
                ftQueueID = queueId
            };
            var response = await client.SignAsync(signRequest);

            response.ftQueueID.Should().Be(queueId);
        }
コード例 #10
0
 private static void ExecuteSign(ReceiptRequest req)
 {
     try
     {
         ConsoleHelper.PrintRequest(req);
         var resp = _pos.Sign(req);
         ConsoleHelper.PrintResponse(resp);
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine("An error occured when trying to send the request.");
         Console.Error.WriteLine(ex);
     }
 }
コード例 #11
0
        public bool Run(ReceiptRequest requestData)
        {
            var reply = Client.MakeRequest <ReceiptRequest>(requestData);

            JsonReply = reply.Content;

            if (reply.StatusCode == System.Net.HttpStatusCode.OK)
            {
                Result = JsonConvert.DeserializeObject <ReceiptResult>(reply.Content);
                return(true);
            }

            return(false);
        }
コード例 #12
0
        public async Task <IActionResult> Receipt(WalletResponse form)
        {
            var command = new ReceiptRequest {
                WalletId = form.Receipt.WalletId, DateDue = form.Receipt.DateDue,
                Account  = form.Receipt.Account, Agency = form.Receipt.Agency,
            };

            if (ModelState.IsValid)
            {
                await Post <BaseResponse>($"wallet/receipt/update", command);
            }

            return(RedirectToAction(nameof(Wallet)));
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: usernamegemaoa/interface
        static ReceiptResponse signXml(ReceiptRequest request, string url, Guid cashboxid = default(Guid), string accesstoken = "00000000")
        {
            if (!url.EndsWith("/"))
            {
                url += "/";
            }

            //var reqdata = UseCase17Request(1, 5, 5, cashboxid.ToString());

            var ms         = new System.IO.MemoryStream();
            var serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(fiskaltrust.ifPOS.v0.ReceiptRequest));

            serializer.WriteObject(ms, request);
            //Console.WriteLine("{0:G} Sign request {1}", DateTime.Now, Encoding.UTF8.GetString(ms.ToArray()));

            var webreq = (HttpWebRequest)HttpWebRequest.Create(url + "xml/sign");

            webreq.Method      = "POST";
            webreq.ContentType = "application/xml;charset=utf-8";

            webreq.Headers.Add("cashboxid", cashboxid.ToString());
            webreq.Headers.Add("accesstoken", accesstoken);

            webreq.ContentLength = ms.Length;
            using (var reqStream = webreq.GetRequestStream())
            {
                reqStream.Write(ms.ToArray(), 0, (int)ms.Length);
            }

            var webresp = (HttpWebResponse)webreq.GetResponse();

            if (webresp.StatusCode == HttpStatusCode.OK)
            {
                serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(fiskaltrust.ifPOS.v0.ReceiptResponse));
                ms         = new System.IO.MemoryStream();
                webresp.GetResponseStream().CopyTo(ms);

                //Console.WriteLine("{0:G} Sign response {1}", DateTime.Now, Encoding.UTF8.GetString(ms.ToArray()));

                ms.Position = 0;
                fiskaltrust.ifPOS.v0.ReceiptResponse resp = (fiskaltrust.ifPOS.v0.ReceiptResponse)serializer.ReadObject(ms);
                return(resp);
            }
            else
            {
                //Console.WriteLine("{0:G} {1} {2}", DateTime.Now, webresp.StatusCode, webresp.StatusDescription);
                return(null);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: FlorianStadlberger/demo
        internal static ReceiptRequest ZeroReceiptRequest(int n, string cashBoxId, long ftReceiptCase)
        {
            var reqdata = new ReceiptRequest()
            {
                ftCashBoxID        = cashBoxId,
                cbTerminalID       = "1",
                ftReceiptCase      = ftReceiptCase,
                cbReceiptReference = n.ToString(),
                cbReceiptMoment    = DateTime.UtcNow,
                cbChargeItems      = new ChargeItem[] { },
                cbPayItems         = new PayItem[] { }
            };

            return(reqdata);
        }
コード例 #15
0
        private static async Task PerformPosRequest(ReceiptRequest req)
        {
            try
            {
                PrintRequest(req);
                var resp = await pos.SignAsync(req);

                PrintResponse(resp);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("An error occured when trying to send the request.");
                Console.Error.WriteLine(ex);
            }
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: smtm/interface
        internal static ReceiptRequest StopRequest(int n, string cashBoxId)
        {
            var reqdata = new ReceiptRequest()
            {
                //ftCashBoxID = "f9bb4d9f-db98-4c24-a614-87f9d874f0cc",
                ftCashBoxID        = cashBoxId,
                cbTerminalID       = "1",
                ftReceiptCase      = 0x4154000000000004,
                cbReceiptReference = n.ToString(),
                cbReceiptMoment    = DateTime.UtcNow,
                cbChargeItems      = new ChargeItem[] { },
                cbPayItems         = new PayItem[] { }
            };

            return(reqdata);
        }
コード例 #17
0
        public async Task Receipt(ReceiptRequest param)
        {
            var current = await _repoReceipt.By(false, r => r.WalletId == param.WalletId);

            if (current is null)
            {
                var receipt = new Receipt(param.Agency, param.Account,
                                          param.DateDue, param.WalletId);

                _notify.Validate(receipt, new ReceiptValidator());
                await _repoReceipt.Register(receipt);
            }
            else
            {
                current.Update(param.Agency, param.Account, param.DateDue);
                _repoReceipt.Update(current);
            }
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: smtm/interface
        internal static ReceiptRequest UseCase17Request(int n, decimal amount1 = 4.8m, decimal amount2 = 3.3m, string cashBoxId = "")
        {
            var reqdata = new ReceiptRequest()
            {
                //                ftCashBoxID = "f9bb4d9f-db98-4c24-a614-87f9d874f0cc",
                ftCashBoxID        = cashBoxId,
                cbTerminalID       = "1",
                ftReceiptCase      = 0x4154000000000000,
                cbReceiptReference = n.ToString(),
                cbReceiptMoment    = DateTime.UtcNow,

                cbChargeItems = new ChargeItem[]  {
                    new ChargeItem()
                    {
                        ftChargeItemCase = 0x4154000000000000,
                        ProductNumber    = "1",
                        Description      = "Artikel 1",
                        Quantity         = 1.0m,
                        VATRate          = 20.0m,
                        Amount           = amount1
                    },
                    new ChargeItem()
                    {
                        ftChargeItemCase = 0x4154000000000000,
                        ProductNumber    = "2",
                        Description      = "Artikel 2",
                        Quantity         = 1.0m,
                        VATRate          = 20.0m,
                        Amount           = amount2
                    }
                },
                cbPayItems = new PayItem[]                {
                    new PayItem()
                    {
                        ftPayItemCase = 0x4154000000000000,
                        Amount        = amount1 + amount2,
                        Quantity      = 1.0m,
                        Description   = "Bar"
                    }
                }
            };

            return(reqdata);
        }
コード例 #19
0
        internal static ReceiptRequest ForeignSaleRequest(int n, decimal amount1 = 4.8m, decimal amount2 = 3.3m, string cashBoxId = "")
        {
            var reqdata = new ReceiptRequest()
            {
                ftCashBoxID        = cashBoxId,
                cbTerminalID       = "1",
                ftReceiptCase      = GetReceiptCase(0x465200000000000E),
                cbReceiptReference = n.ToString(),
                cbReceiptMoment    = DateTime.UtcNow,

                cbChargeItems = new ChargeItem[]  {
                    new ChargeItem()
                    {
                        ftChargeItemCase = 0x4652000000000001,
                        ProductNumber    = "1",
                        Description      = "Article 1",
                        Quantity         = 1.0m,
                        VATRate          = 20.0m,
                        Amount           = amount1
                    },
                    new ChargeItem()
                    {
                        ftChargeItemCase = 0x4652000000000001,
                        ProductNumber    = "2",
                        Description      = "Article 2",
                        Quantity         = 1.0m,
                        VATRate          = 20.0m,
                        Amount           = amount2
                    }
                },
                cbPayItems = new PayItem[]                {
                    new PayItem()
                    {
                        ftPayItemCase = 0x4652000000000011,
                        Amount        = amount1 + amount2,
                        Quantity      = 1.0m,
                        Description   = "Payment compensation"
                    }
                }
            };

            return(reqdata);
        }
コード例 #20
0
        private static async Task ExecuteSignAsync(ReceiptRequest req)
        {
            try
            {
                ConsoleHelper.PrintRequest(req);
                var resp = await _pos.SignAsync(req);

                ConsoleHelper.PrintResponse(resp);
            }
            catch (RpcException ex)
            {
                Console.Error.WriteLine("An error occured when trying to send the request.");
                Console.Error.WriteLine(ex);
                foreach (var entry in ex.Trailers)
                {
                    Console.Error.WriteLine($"[{entry.Key}] {entry.Value}");
                }
            }
        }
コード例 #21
0
        internal static ReceiptRequest StopRequest(int n, string cashBoxId)
        {
            var reqdata = new ReceiptRequest()
            {
                //ftCashBoxID = "f9bb4d9f-db98-4c24-a614-87f9d874f0cc",
                ftCashBoxID = cashBoxId,
                cbTerminalID = "1",
                ftReceiptCase = 0x4154000000000004,
                cbReceiptReference = n.ToString(),
                cbReceiptMoment = DateTime.UtcNow,
                cbChargeItems = new ChargeItem[] { },
                cbPayItems = new PayItem[] { }
            };

            return reqdata;
        }
コード例 #22
0
        public async Task <IActionResult> ReceiveUpdate([FromBody] ReceiptRequest request)
        {
            await _service.Receipt(request);

            return(Result(new BaseResponse()));
        }
コード例 #23
0
 private static void PrintRequest(ReceiptRequest receiptRequest)
 {
     Console.WriteLine("{0:G} ReceiptRequest:", DateTime.Now);
     Console.WriteLine(JsonConvert.SerializeObject(receiptRequest, Formatting.Indented));
 }
コード例 #24
0
        internal static ReceiptRequest UseCase17Request(int n, decimal amount1 = 4.8m, decimal amount2 = 3.3m, string cashBoxId="")
        {

            var reqdata = new ReceiptRequest()
            {
                //                ftCashBoxID = "f9bb4d9f-db98-4c24-a614-87f9d874f0cc",
                ftCashBoxID = cashBoxId,
                cbTerminalID = "1",
                ftReceiptCase = 0x4154000000000000,
                cbReceiptReference = n.ToString(),
                cbReceiptMoment = DateTime.UtcNow,
                
                cbChargeItems = new ChargeItem[]  {
                    new ChargeItem()
                    {
                        ftChargeItemCase=0x4154000000000000,
                         ProductNumber="1",
                         Description="Artikel 1",
                         Quantity=1.0m,
                         VATRate=20.0m,
                         Amount=amount1
                    },
                    new ChargeItem()
                    {
                        ftChargeItemCase=0x4154000000000000,
                        ProductNumber="2",
                        Description="Artikel 2",
                        Quantity=1.0m,
                        VATRate=20.0m,
                        Amount=amount2
                    }
                },
                cbPayItems = new PayItem[]                {
                    new PayItem()
                    {
                        ftPayItemCase=0x4154000000000000,
                        Amount=amount1+amount2,
                        Quantity=1.0m,
                        Description="Bar"
                    }
                }
            };

            return reqdata;
        }
コード例 #25
0
        public string PushReceiptInfoToCore(AIA.Life.Models.Policy.Policy objpolicy)
        {
            try
            {
                ReceiptRequest    objReceiptRequest    = new ReceiptRequest();
                PolicyIntegration objpolicyIntegration = new PolicyIntegration();
                Agent             objAgentInfo         = objpolicyIntegration.FetchAgentBranch(objpolicy.UserName);
                objReceiptRequest.userId = objpolicy.UserName;
                // objReceiptRequest.userId = "TEST";  // test
                foreach (var Instrument in objpolicy.objPaymentInfo.objInstrumentDetails)
                {
                    WsTemporaryProposalReceiptHdr objhdr = new WsTemporaryProposalReceiptHdr();
                    if (objAgentInfo != null)
                    {
                        objhdr.branchCode = objAgentInfo.BranchCode; // test
                        objhdr.agentCode  = objAgentInfo.AgentCode;  // test
                    }
                    else
                    {
                        objhdr.branchCode = "SIF";             // test
                        objhdr.agentCode  = "AGE000000000158"; // test
                    }

                    objhdr.policyNo      = string.Empty;
                    objhdr.modeOfPayment = "Q";
                    objhdr.proposalNo    = objpolicy.ProposalNo.ToUpper();
                    objhdr.tempReceiptNo = Convert.ToString(Instrument.InstumentID);
                    objhdr.totalAmount   = Convert.ToString(Instrument.InstrumentAmount);

                    objhdr.createBy = objpolicy.UserName.ToUpper();
                    // objhdr.createBy = "TEST";  //test

                    objhdr.createDt    = DateTime.Now.Date.ToShortDateString();
                    objhdr.insuredCode = Convert.ToString(objpolicy.ContactID);
                    objhdr.firstName   = objpolicy.objProspectDetails.FirstName.ToUpper();
                    objhdr.middleName  = objpolicy.objProspectDetails.MiddleName != null?objpolicy.objProspectDetails.MiddleName.ToUpper() : "";

                    objhdr.productPlan  = objpolicy.PlanCode.ToUpper();
                    objhdr.surName      = objpolicy.objProspectDetails.LastName.ToUpper();
                    objhdr.proposalDate = DateTime.Now.Date.ToShortDateString();
                    objhdr.receiptNo    = string.Empty;
                    objhdr.quotationNo  = objpolicy.QuoteNo.ToUpper();

                    WsTemporaryProposalReceiptDet objReceiptDetail = new WsTemporaryProposalReceiptDet();
                    objReceiptDetail.proposalNo = objpolicy.ProposalNo.ToUpper();
                    #region Set Instrument Type
                    if (Instrument.PaymentMode == "Cheque")
                    {
                        objReceiptDetail.instrumentType = "CHEQUE";
                    }
                    else if (Instrument.PaymentMode == "Cash")
                    {
                        objReceiptDetail.instrumentType = "CASH";
                    }
                    else if (Instrument.PaymentMode == "DD")
                    {
                        objReceiptDetail.instrumentType = "DRAFT";
                    }
                    else
                    {
                        objReceiptDetail.instrumentType = string.Empty;
                    }
                    #endregion


                    objReceiptDetail.currency         = "LKR";
                    objReceiptDetail.currency         = objReceiptDetail.currency.ToUpper();
                    objReceiptDetail.amount           = Convert.ToString(Instrument.InstrumentAmount);
                    objReceiptDetail.instrumentNumber = Instrument.InstrumentNo;
                    objReceiptDetail.instrumentDate   = Instrument.InstrumentDate.Value.Date.ToShortDateString();
                    // For PG
                    objReceiptDetail.eopPgCurrencyno  = string.Empty;
                    objReceiptDetail.eopPgTransid     = string.Empty;
                    objReceiptDetail.eopPgStatusCode  = string.Empty;
                    objReceiptDetail.eopPgErrorDetail = string.Empty;
                    objReceiptDetail.eopPgErrorMsg    = string.Empty;
                    // Till here

                    // Test Purpose
                    objReceiptDetail.bankCode       = "7278"; //test
                    objReceiptDetail.bankCode       = objReceiptDetail.bankCode.ToUpper();
                    objReceiptDetail.bankBranchCode = "168";  //test
                    objReceiptDetail.bankBranchCode = objReceiptDetail.bankBranchCode.ToUpper();



                    objReceiptRequest.wsTemporaryProposalReceiptHdr.Add(objhdr);
                    objReceiptRequest.wsTemporaryProposalReceiptDet.Add(objReceiptDetail);
                }

                string          URl                = "http://secure.AIA.com:8080/Life_Agent_Saving/jersey/";
                string          result             = GetPostParametersToAPI("Receipting", "SaveProposalReceptDetails", URl, objReceiptRequest);
                ReceiptResponse objReceiptResponse = new ReceiptResponse();
                Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings();
                objReceiptResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <ReceiptResponse>(result, settings);
                if (objReceiptResponse.Status == "Success")
                {
                    objpolicy.Message = "Success";
                }
                else
                {
                    objpolicy.Message = "Error";
                }
            }
            catch (Exception ex)
            {
                objpolicy.Message = "Error";
            }

            return(objpolicy.Message);
        }
コード例 #26
0
        internal static ReceiptRequest ZeroReceiptRequest(int n, string cashBoxId)
        {
            var reqdata = new ReceiptRequest()
            {
                ftCashBoxID = cashBoxId,
                cbTerminalID = "1",
                ftReceiptCase = 0x4154000000000002,
                cbReceiptReference = n.ToString(),
                cbReceiptMoment = DateTime.UtcNow,
                cbChargeItems = new ChargeItem[] { },
                cbPayItems = new PayItem[] { }
            };

            return reqdata;
        }