Exemple #1
0
        public V2.ProcessingInput GetProcessingInput(V2.CCTranType aTranType, ICCPayment pDoc)
        {
            if (pDoc == null)
            {
                throw new ArgumentNullException(nameof(pDoc));
            }
            V2.ProcessingInput result = new V2.ProcessingInput()
            {
                TranType   = aTranType,
                Amount     = pDoc.CuryDocBal.Value,
                CuryID     = pDoc.CuryID,
                OrigTranID = aTranType == V2.CCTranType.CaptureOnly ? null : pDoc.OrigRefNbr,
                AuthCode   = aTranType == V2.CCTranType.CaptureOnly ? pDoc.OrigRefNbr : null
            };
            if (FillCardData)
            {
                result.CardData             = GetCardData(_provider.GetCardDataReader());
                result.CardData.AddressData = GetAddressData(_provider.GetCustomerDataReader());
            }

            if (FillCustomerData)
            {
                result.CustomerData = GetCustomerData(_provider.GetCustomerDataReader());
            }
            result.DocumentData           = new V2.DocumentData();
            result.DocumentData.DocType   = pDoc.DocType;
            result.DocumentData.DocRefNbr = pDoc.RefNbr;
            FillDocumentData(result);
            return(result);
        }
Exemple #2
0
            public string CreatePaymentProfile()
            {
                string customerProfileId = V2ProcessingInputGenerator.GetCustomerData(_provider.GetCustomerDataReader()).CustomerProfileID;

                V2.CreditCardData cardData    = V2ProcessingInputGenerator.GetCardData(_provider.GetCardDataReader(), _provider.GetExpirationDateConverter());
                V2.AddressData    addressData = V2ProcessingInputGenerator.GetAddressData(_provider.GetCustomerDataReader());
                cardData.AddressData = addressData;
                string result = V2PluginErrorHandler.ExecuteAndHandleError(() => _processor.CreatePaymentProfile(customerProfileId, cardData));

                return(result);
            }
        protected List <CCProcessingBase.Interfaces.V2.CreditCardData> GetCardData(CCProcessingBase.SyncPMResponse syncResponse)
        {
            if (syncResponse == null)
            {
                throw new ArgumentNullException(nameof(syncResponse));
            }

            CCProcessingBase.ICreditCardDataReader cardDataReader             = _provider.GetCardDataReader();
            List <CCProcessingBase.Interfaces.V2.CreditCardData> cardDataList = new List <CCProcessingBase.Interfaces.V2.CreditCardData>();

            foreach (var cardInfo in syncResponse.PMList)
            {
                CCProcessingBase.Interfaces.V2.CreditCardData cardData = new CCProcessingBase.Interfaces.V2.CreditCardData()
                {
                    PaymentProfileID = cardInfo.Key
                };
                string cardNumber;
                if (cardInfo.Value.TryGetValue(cardDataReader.Key_CardNumber, out cardNumber))
                {
                    cardData.CardNumber = cardNumber;
                }
                string expirationDate;
                if (cardInfo.Value.TryGetValue(cardDataReader.Key_CardExpiryDate, out expirationDate))
                {
                    string dateTimeFormat = GetExpirationDateFormat();
                    if (!string.IsNullOrEmpty(dateTimeFormat))
                    {
                        DateTime expirationDateTime;
                        if (DateTime.TryParseExact(expirationDate,
                                                   dateTimeFormat,
                                                   null,
                                                   System.Globalization.DateTimeStyles.None,
                                                   out expirationDateTime))
                        {
                            cardData.CardExpirationDate = expirationDateTime;
                        }
                    }
                }

                cardDataList.Add(cardData);
            }
            return(cardDataList);
        }
Exemple #4
0
        public V2.ProcessingInput GetProcessingInput(V1.CCTranType aTranType, V1.ProcessingInput inputData)
        {
            if (inputData == null)
            {
                throw new ArgumentNullException(nameof(inputData));
            }

            V2.ProcessingInput result = new V2.ProcessingInput()
            {
                TranType   = ToV2(aTranType),
                Amount     = inputData.Amount,
                CuryID     = inputData.CuryID,
                OrigTranID = aTranType == V1.CCTranType.CaptureOnly ? null : inputData.OrigRefNbr,
                AuthCode   = aTranType == V1.CCTranType.CaptureOnly ? inputData.OrigRefNbr : null
            };
            result.CardData             = GetCardData(_provider.GetCardDataReader());
            result.CardData.AddressData = GetAddressData(_provider.GetCustomerDataReader());
            result.CustomerData         = GetCustomerData(_provider.GetCustomerDataReader());
            FillDocumentData(result, inputData);
            return(result);
        }