コード例 #1
0
        public string GenerateQRCode([FromBody] string xmlData)
        {
            string response;

            try
            {
                XmlDocument doc = new XmlDocument();
                //ISOComposer composer = new ISOComposer();
                doc.LoadXml(xmlData);
                ParseDeviceLocationInfo.SaveInfo(doc);

                string receiverVirtialId, amountString, pin;
                #region data fetched from xml
                receiverVirtialId = doc.GetElementsByTagName("ReceiverVID").Item(0).Attributes["value"].Value;
                amountString      = doc.GetElementsByTagName("TxnAmount").Item(0).Attributes["value"].Value;
                pin = doc.GetElementsByTagName("Data").Item(0).InnerText;
                #endregion

                string imageString = string.Empty, qrText = $"{receiverVirtialId} Amount: {amountString}";
                imageString = IDTPQRCodeGenerator.GenerateQRCode(qrText);

                response = IDTPXmlParser.PrepareSuccessResponse("GenerateQRCodeResponse", "QRCode", imageString);
                return(response);
            }

            catch (Exception ex)
            {
                response = IDTPXmlParser.PrepareFailResponse("GenerateQRCodeResponse");
                return(response);
            }
        }
コード例 #2
0
        public IActionResult Index(string name, double amount, string pin)
        {
            string imageString = string.Empty;
            var    qrText      = $"{name} Amount: {amount}";

            imageString = IDTPQRCodeGenerator.GenerateQRCode(qrText);

            QRCodeViewModel qRCodeViewModel = new QRCodeViewModel()
            {
                RecipientName = name, Amount = amount, PIN = pin, QRCodeImage = imageString
            };

            return(View(qRCodeViewModel));
        }