Esempio n. 1
0
        public CommonBusiness(IAgentConnectIntegration agentConnectIntegration, IReceiptIntegration receiptIntegration)
        {
            agentConnectIntegration.ThrowIfNull(nameof(agentConnectIntegration));
            receiptIntegration.ThrowIfNull(nameof(receiptIntegration));

            this.agentConnectIntegration = agentConnectIntegration;
            this.receiptIntegration      = receiptIntegration;
        }
        public SendReversalBusiness(IAgentConnectIntegration agentConnectIntegration, IReceiptIntegration receiptIntegration, ILookupBusiness lookupBusiness)
        {
            agentConnectIntegration.ThrowIfNull(nameof(agentConnectIntegration));
            receiptIntegration.ThrowIfNull(nameof(receiptIntegration));
            receiptIntegration.ThrowIfNull(nameof(lookupBusiness));

            _agentConnectIntegration = agentConnectIntegration;
            _receiptIntegration      = receiptIntegration;
            _lookupBusiness          = lookupBusiness;
        }
Esempio n. 3
0
        public BillPayBusiness(IAgentConnectIntegration agentConnectIntegration, IReceiptIntegration receiptIntegration, ILookupBusiness lookupBusiness)
        {
            agentConnectIntegration.ThrowIfNull(nameof(agentConnectIntegration));
            receiptIntegration.ThrowIfNull(nameof(receiptIntegration));
            lookupBusiness.ThrowIfNull(nameof(lookupBusiness));

            this.agentConnectIntegration = agentConnectIntegration;
            this.receiptIntegration      = receiptIntegration;
            this.lookupBusiness          = lookupBusiness;
        }
Esempio n. 4
0
        public static List <byte[]> ProcessReceipt(List <List <ReceiptSegmentType> > receiptSegments, string mimeType,
                                                   IReceiptIntegration receiptIntegration)
        {
            var           receiptMimeType = IdentifyReceiptMimeType(mimeType);
            List <byte[]> receipt         = new List <byte[]>();

            if (receiptSegments.Any())
            {
                var combinedSegments = receiptSegments.SelectMany(i => i).ToArray();
                for (var seg = 0; seg < combinedSegments.Length; seg++)
                {
                    if (combinedSegments[seg].MimeData != null && combinedSegments[seg].MimeData.Count > 0)
                    {
                        receipt.Add(combinedSegments[seg].MimeData.ToArray());
                    }
                }
            }

            // return segregated byte[] data for images.
            return(receipt);
        }
Esempio n. 5
0
        public static ReceiptsApiData GenerateAdditionalDataReceipts(CompletionReceiptType receipts,
                                                                     IReceiptIntegration receiptIntegration)
        {
            var textReceipt      = string.Empty;
            var isAdditionalData = false;

            if (receipts != null)
            {
                var mimeType = IdentifyReceiptMimeType(receipts.ReceiptMimeType);

                // Dont process Images or PDF's
                if (mimeType == MimeTypeEnum.ImageJPEG || mimeType == MimeTypeEnum.Pdf)
                {
                    return(null);
                }

                var receiptSegments = GetReceiptSegments(receipts.AgentReceiptMimeData,
                                                         receipts.ConsumerReceipt1MimeData, receipts.ConsumerReceipt2MimeData);
                var receipt = ProcessReceipt(receiptSegments, receipts.ReceiptMimeType, receiptIntegration);

                if (mimeType == MimeTypeEnum.Thermal)
                {
                    textReceipt = ProcessThermalReceipt(receipt, receipts.CharsetEncoding);
                }
                else if (mimeType == MimeTypeEnum.Text)
                {
                    textReceipt = ProcessTextReceipt(receipt, receipts.CharsetEncoding);
                }
                isAdditionalData = !string.IsNullOrWhiteSpace(textReceipt);
            }
            return(isAdditionalData
                ? new ReceiptsApiData
            {
                TextReceipt = textReceipt
            }
                : null);
        }