Contains members that define a Rapid token customer (and card) stored in the merchant's account.
コード例 #1
0
ファイル: TestUtil.cs プロジェクト: incarnate/eway-rapid-net
        internal static void AssertReturnedCustomerData_VerifyCardDetailsAreEqual(Customer responseCustomer, Customer requestCustomer)
        {
            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.ExpiryMonth) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.ExpiryMonth))
                Assert.AreEqual(responseCustomer.CardDetails.ExpiryMonth, requestCustomer.CardDetails.ExpiryMonth);

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.ExpiryYear) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.ExpiryYear))
            Assert.AreEqual(responseCustomer.CardDetails.ExpiryYear, requestCustomer.CardDetails.ExpiryYear);

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.IssueNumber) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.IssueNumber))
            Assert.AreEqual(responseCustomer.CardDetails.IssueNumber, requestCustomer.CardDetails.IssueNumber);

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.Name) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.Name))
            Assert.AreEqual(responseCustomer.CardDetails.Name, requestCustomer.CardDetails.Name);

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.StartMonth) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.StartMonth))
            Assert.AreEqual(responseCustomer.CardDetails.StartMonth, requestCustomer.CardDetails.StartMonth);

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.StartYear) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.StartYear))
            Assert.AreEqual(responseCustomer.CardDetails.StartYear, requestCustomer.CardDetails.StartYear);
        }
コード例 #2
0
 //Assertion helpers
 internal static void AssertReturnedCustomerData_VerifyAddressAreEqual(Customer responseCustomer, Customer requestCustomer)
 {
     Assert.AreEqual(responseCustomer.Address.State, requestCustomer.Address.State);
     Assert.AreEqual(responseCustomer.Address.City, requestCustomer.Address.City);
     Assert.AreEqual(responseCustomer.Address.Country, requestCustomer.Address.Country);
     Assert.AreEqual(responseCustomer.Address.PostalCode, requestCustomer.Address.PostalCode);
     Assert.AreEqual(responseCustomer.Address.Street1, requestCustomer.Address.Street1);
     Assert.AreEqual(responseCustomer.Address.Street2, requestCustomer.Address.Street2);
 }
コード例 #3
0
ファイル: TestUtil.cs プロジェクト: incarnate/eway-rapid-net
 //Assertion helpers
 internal static void AssertReturnedCustomerData_VerifyAddressAreEqual(Customer responseCustomer, Customer requestCustomer)
 {
     Assert.AreEqual(responseCustomer.Address.State, requestCustomer.Address.State);
     Assert.AreEqual(responseCustomer.Address.City, requestCustomer.Address.City);
     Assert.AreEqual(responseCustomer.Address.Country, requestCustomer.Address.Country);
     Assert.AreEqual(responseCustomer.Address.PostalCode, requestCustomer.Address.PostalCode);
     Assert.AreEqual(responseCustomer.Address.Street1, requestCustomer.Address.Street1);
     Assert.AreEqual(responseCustomer.Address.Street2, requestCustomer.Address.Street2);
 }
コード例 #4
0
 internal static void AssertReturnedCustomerData_VerifyAllFieldsAreEqual(Customer responseCustomer, Customer requestCustomer)
 {
     Assert.AreEqual(responseCustomer.Comments, requestCustomer.Comments);
     Assert.AreEqual(responseCustomer.CompanyName, requestCustomer.CompanyName);
     Assert.AreEqual(responseCustomer.Fax, requestCustomer.Fax);
     Assert.AreEqual(responseCustomer.FirstName, requestCustomer.FirstName);
     Assert.AreEqual(responseCustomer.LastName, requestCustomer.LastName);
     Assert.AreEqual(responseCustomer.JobDescription, requestCustomer.JobDescription);
     Assert.AreEqual(responseCustomer.Mobile, requestCustomer.Mobile);
     Assert.AreEqual(responseCustomer.Phone, requestCustomer.Phone);
     Assert.AreEqual(responseCustomer.Reference, requestCustomer.Reference);
     Assert.AreEqual(responseCustomer.Title, requestCustomer.Title);
     Assert.AreEqual(responseCustomer.Url, requestCustomer.Url);
 }
コード例 #5
0
ファイル: TestUtil.cs プロジェクト: incarnate/eway-rapid-net
 internal static void AssertReturnedCustomerData_VerifyAllFieldsAreEqual(Customer responseCustomer, Customer requestCustomer)
 {
     Assert.AreEqual(responseCustomer.Comments, requestCustomer.Comments);
     Assert.AreEqual(responseCustomer.CompanyName, requestCustomer.CompanyName);
     Assert.AreEqual(responseCustomer.Fax, requestCustomer.Fax);
     Assert.AreEqual(responseCustomer.FirstName, requestCustomer.FirstName);
     Assert.AreEqual(responseCustomer.LastName, requestCustomer.LastName);
     Assert.AreEqual(responseCustomer.JobDescription, requestCustomer.JobDescription);
     Assert.AreEqual(responseCustomer.Mobile, requestCustomer.Mobile);
     Assert.AreEqual(responseCustomer.Phone, requestCustomer.Phone);
     Assert.AreEqual(responseCustomer.Reference, requestCustomer.Reference);
     Assert.AreEqual(responseCustomer.Title, requestCustomer.Title);
     Assert.AreEqual(responseCustomer.Url, requestCustomer.Url);
 }
コード例 #6
0
        internal static Customer CreateCustomer()
        {
            var customer = new Customer
            {
                Title     = "Mr.",
                FirstName = "John",
                LastName  = "Smith",
                Reference = "A12345",
                Address   = new Address()
                {
                    Country    = "au",
                    City       = "Sydney",
                    PostalCode = "2000",
                    State      = "NSW",
                    Street1    = "Level 5",
                    Street2    = "369 Queen Street"
                },
                CardDetails =
                    new CardDetails()
                {
                    Name        = "John Smith",
                    Number      = "4444333322221111",
                    ExpiryMonth = "12",
                    ExpiryYear  = "25",
                    CVN         = "123"
                },
                JobDescription = "Developer",
                RedirectURL    = "http://www.eway.com.au",
                Comments       = "empty comment",
                CompanyName    = "Demo Shop 123",
                Fax            = "",
                Mobile         = "09 889 0986",
                Email          = "*****@*****.**",
                Phone          = "09 889 6542",
                Url            = "http://www.ewaypayments.com"
            };

            return(customer);
        }
コード例 #7
0
        internal static void AssertReturnedCustomerData_VerifyCardDetailsAreEqual(Customer responseCustomer, Customer requestCustomer)
        {
            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.ExpiryMonth) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.ExpiryMonth))
            {
                Assert.AreEqual(responseCustomer.CardDetails.ExpiryMonth, requestCustomer.CardDetails.ExpiryMonth);
            }

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.ExpiryYear) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.ExpiryYear))
            {
                Assert.AreEqual(responseCustomer.CardDetails.ExpiryYear, requestCustomer.CardDetails.ExpiryYear);
            }

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.IssueNumber) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.IssueNumber))
            {
                Assert.AreEqual(responseCustomer.CardDetails.IssueNumber, requestCustomer.CardDetails.IssueNumber);
            }

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.Name) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.Name))
            {
                Assert.AreEqual(responseCustomer.CardDetails.Name, requestCustomer.CardDetails.Name);
            }

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.StartMonth) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.StartMonth))
            {
                Assert.AreEqual(responseCustomer.CardDetails.StartMonth, requestCustomer.CardDetails.StartMonth);
            }

            if (!string.IsNullOrWhiteSpace(responseCustomer.CardDetails.StartYear) &&
                !string.IsNullOrWhiteSpace(requestCustomer.CardDetails.StartYear))
            {
                Assert.AreEqual(responseCustomer.CardDetails.StartYear, requestCustomer.CardDetails.StartYear);
            }
        }
コード例 #8
0
ファイル: eWay.cs プロジェクト: vijayamazon/CaniGold.Store
        public override string ProcessCard(
            int orderNumber,
            int customerId,
            decimal orderTotal,
            bool useLiveTransactions,
            TransactionModeEnum transactionMode,
            AspDotNetStorefrontCore.Address billingAddress,
            string cardExtraCode,
            AspDotNetStorefrontCore.Address useShippingAddress,
            string CAVV,
            string ECI,
            string XID,
            out string AVSResult,
            out string authorizationResult,
            out string authorizationCode,
            out string authorizationTransId,
            out string transactionCommandOut,
            out string transactionResponse)
        {
            AVSResult             = string.Empty;
            authorizationResult   = string.Empty;
            authorizationCode     = string.Empty;
            authorizationTransId  = string.Empty;
            transactionCommandOut = string.Empty;
            transactionResponse   = string.Empty;

            try
            {
                if (AppConfigProvider.GetAppConfigValue("Localization.StoreCurrency") != "AUD" &&
                    AppConfigProvider.GetAppConfigValue("Localization.StoreCurrency") != "NZD")
                {
                    return("eWAY requires that the store currency be either AUD or NZD.");
                }

                var cardDetails = new CardDetails()
                {
                    Name        = $"{billingAddress.FirstName} {billingAddress.LastName}",
                    Number      = billingAddress.CardNumber,
                    ExpiryMonth = FormatExpiryMonth(billingAddress.CardExpirationMonth),
                    ExpiryYear  = FormatExpiryYear(billingAddress.CardExpirationYear),
                    CVN         = cardExtraCode
                };

                var address = new eWAY.Rapid.Models.Address()
                {
                    Street1    = billingAddress.Address1,
                    Street2    = billingAddress.Address2,
                    City       = billingAddress.City,
                    State      = billingAddress.State,
                    PostalCode = billingAddress.Zip,
                    Country    = AppLogic.GetCountryTwoLetterISOCode(billingAddress.Country),
                };

                var customer = new eWAY.Rapid.Models.Customer()
                {
                    FirstName   = billingAddress.FirstName,
                    LastName    = billingAddress.LastName,
                    Email       = billingAddress.EMail,
                    Phone       = billingAddress.Phone,
                    CardDetails = cardDetails,
                    Address     = address
                };

                var paymentDetails = new PaymentDetails()
                {
                    TotalAmount   = DecimalToFixedPoint(orderTotal),
                    InvoiceNumber = orderNumber.ToString(),
                    CurrencyCode  = Currency.GetDefaultCurrency()
                };

                var transaction = new Transaction()
                {
                    Customer        = customer,
                    PaymentDetails  = paymentDetails,
                    TransactionType = TransactionTypes.Purchase,
                    Capture         = transactionMode == TransactionModeEnum.authcapture
                                                ? true
                                                : false
                };

                transactionCommandOut = SanitizeTransaction(
                    XmlCommon.SerializeObject(transaction, transaction.GetType()),
                    new Dictionary <string, string>()
                {
                    { $">{billingAddress.CardNumber}</", $">{AppLogic.SafeDisplayCardNumber(billingAddress.CardNumber, "Orders", 0)}</" },
                    { $">{cardExtraCode}</", ">***</" },
                });

                var response = GetRapidClient()
                               .Create(PaymentMethod.Direct, transaction);

                if (response.TransactionStatus == null)
                {
                    return("Error calling payment gateway.");
                }

                transactionResponse = XmlCommon.SerializeObject(response, response.GetType());

                authorizationResult = response.TransactionStatus.ProcessingDetails?.ResponseMessage;

                if ((response.TransactionStatus.Status ?? false) == false)
                {
                    var errorCode = string.IsNullOrWhiteSpace(authorizationResult) &&
                                    response.Errors != null
                                                ? string.Join(" ", response.Errors)
                                                : authorizationResult;

                    return($"There was a problem processing the credit card transaction.  Error code: {errorCode}");
                }

                AVSResult            = response.TransactionStatus.VerificationResult?.CVN.ToString();
                authorizationCode    = response.TransactionStatus.ProcessingDetails.AuthorisationCode;
                authorizationTransId = response.TransactionStatus.TransactionID.ToString();
            }
            catch (Exception exception)
            {
                SysLog.LogException(exception, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                return("Error calling payment gateway.");
            }

            return(AppLogic.ro_OK);
        }
コード例 #9
0
ファイル: TestUtil.cs プロジェクト: incarnate/eway-rapid-net
 internal static Customer CreateCustomer()
 {
     var customer = new Customer
     {
         Title = "Mr.",
         FirstName = "John",
         LastName = "Smith",
         Reference = "A12345",
         Address = new Address()
         {
             Country = "au",
             City = "Sydney",
             PostalCode = "",
             State = "NSW",
             Street1 = "Level 5",
             Street2 = "369 Queen Street"
         },
         CardDetails =
             new CardDetails()
             {
                 Name = "John Smith",
                 Number = "4444333322221111",
                 ExpiryMonth = "12",
                 ExpiryYear = "25",
                 CVN = "123"
             },
         JobDescription = "Developer",
         RedirectURL = "http://www.eway.com.au",
         Comments = "empty comment",
         CompanyName = "Demo Shop 123",
         Fax = "",
         Mobile = "09 889 0986",
         Email = "*****@*****.**",
         Phone = "09 889 6542",
         Url = "http://www.ewaypayments.com"
     };
     return customer;
 }