コード例 #1
0
 /// <param name="holder">Must not be null</param>
 /// <param name="number">Must not be null</param>
 /// <param name="brand">Must not be null</param>
 /// <param name="expiryMonth">Must not be null</param>
 /// <param name="expiryYear">Must not be null</param>
 /// <param name="cardIssueNumber">Can be null</param>
 /// <param name="verification">Must not be null</param>
 public CreditCardPaymentMethod(
     AccountHolder holder,
     AccountNumber number,
     AccountBrand brand,
     AccountExpiryMonth expiryMonth,
     AccountExpiryYear expiryYear,
     AccountCardIssueNumber cardIssueNumber,
     AccountVerification verification)
 {
     Holder          = holder;
     Number          = number;
     Brand           = brand;
     ExpiryMonth     = expiryMonth;
     ExpiryYear      = expiryYear;
     CardIssueNumber = cardIssueNumber;
     Verification    = verification;
 }
コード例 #2
0
        public PaymentRequest <CreditCardPaymentMethod> BuildCreditCardPaymentRequest(
            IPaymentType paymentType,
            int orderNumber,
            string orderReferenceId,
            int orderCustomerId,
            string orderCustomerEmail,
            string orderCustomerFirstName,
            string orderCustomerLastName,
            string orderCustomerAddress,
            string orderCustomerCity,
            string orderCustomerState,
            string orderCustomerZip,
            string orderCustomerCountry,
            string orderCustomerIp,
            decimal orderTotal,
            string orderCreditCardType,
            string orderCreditCardNumber,
            string orderCreditCardExpirationMonth,
            string orderCreditCardExpirationYear,
            string orderCreditCardIssueNumber,
            string orderCreditCardCvv)
        {
            UniqueIdentifier instanceId      = LoadAppConfigString("Moneybookers.SenderID", s => new UniqueIdentifier(s));
            TransactionMode  transactionMode = TransactionMode;
            ResponseMode     responseMode    = ResponseMode.Sync;
            UniqueIdentifier channelId       = LoadAppConfigString("Moneybookers.ChannelID", s => new UniqueIdentifier(s));
            UniqueIdentifier userLogin       = LoadAppConfigString("Moneybookers.UserLogin", s => new UniqueIdentifier(s));
            UserPassword     userPassword    = LoadAppConfigString("Moneybookers.UserPassword", s => new UserPassword(s));
            LimitedString    transactionId   = null;
            LimitedString    invoiceId       = new LimitedString(orderNumber.ToString());
            LimitedString    shopperId       = new LimitedString(orderCustomerEmail.TrimToMax(LimitedString.MaxLength));

            UniqueIdentifier referenceId = null;

            if (orderReferenceId != null)
            {
                referenceId = new UniqueIdentifier(orderReferenceId);
            }

            Amount        paymentAmount      = new Amount(orderTotal);
            Currency      paymentCurrency    = LoadAppConfigString("Localization.StoreCurrency", s => new Currency(s));
            LimitedString paymentUsage       = new LimitedString(String.Format("Order number {0}", orderNumber));
            Prefix        customerSalutation = null;
            Prefix        customerTitle      = null;
            Name          customerGivenName  = new Name(orderCustomerFirstName.TrimToMax(Name.MaxLength));
            Name          customerFamilyName = new Name(orderCustomerLastName.TrimToMax(Name.MaxLength));
            Sex           customerSex        = null;
            Date          customerBirthdate  = null;
            Name          customerCompany    = null;
            Street        customerStreet     = new Street(orderCustomerAddress.TrimToMax(Street.MaxLength));
            Zip           customerZip        = new Zip(orderCustomerZip.TrimToMax(Zip.MaxLength));
            City          customerCity       = new City(orderCustomerCity.TrimToMax(City.MaxLength));

            State customerState = null;

            if (orderCustomerState != null)
            {
                customerState = new State(orderCustomerState.TrimToMax(State.MaxLength));
            }

            string      orderCustomerCountryCode = AppLogic.GetCountryTwoLetterISOCode(orderCustomerCountry);
            CountryCode customerCountry          = new CountryCode(orderCustomerCountryCode.TrimToMax(CountryCode.MaxLength));

            PhoneNumber       customerPhone       = null;
            MobilePhoneNumber customerMobilePhone = null;

            EmailAddress customerEmail;

            if (String.IsNullOrEmpty(orderCustomerEmail))
            {
                customerEmail = new EmailAddress("*****@*****.**".TrimToMax(EmailAddress.MaxLength));
            }
            else
            {
                customerEmail = new EmailAddress(orderCustomerEmail.TrimToMax(EmailAddress.MaxLength));
            }

            var       formattedOrderCustomerIp = String.Join(".", orderCustomerIp.Split('.').Select(s => s.PadLeft(3, '0')).ToArray());
            IpAddress customerIp = new IpAddress(formattedOrderCustomerIp);

            AccountHolder      accountHolder      = new AccountHolder(String.Format("{0} {1}", orderCustomerFirstName, orderCustomerLastName).TrimToMax(AccountHolder.MaxLength));
            AccountNumber      accountNumber      = new AccountNumber(orderCreditCardNumber);
            AccountBrand       accountBrand       = new AccountBrand(orderCreditCardType);
            AccountExpiryMonth accountExpiryMonth = new AccountExpiryMonth(orderCreditCardExpirationMonth);
            AccountExpiryYear  accountExpiryYear  = new AccountExpiryYear(orderCreditCardExpirationYear);

            AccountCardIssueNumber accountCardIssueNumber = null;

            if (orderCreditCardIssueNumber != null)
            {
                accountCardIssueNumber = new AccountCardIssueNumber(orderCreditCardIssueNumber);
            }

            AccountVerification accountVerification = new AccountVerification(orderCreditCardCvv);

            LimitedString sessionId = new LimitedString(orderCustomerId.ToString());

            CreditCardPaymentMethod paymentMethod = new CreditCardPaymentMethod(
                accountHolder,
                accountNumber,
                accountBrand,
                accountExpiryMonth,
                accountExpiryYear,
                accountCardIssueNumber,
                accountVerification);

            PaymentCode paymentCode = new PaymentCode(paymentMethod, paymentType);

            PaymentRequest <CreditCardPaymentMethod> paymentRequest = new PaymentRequest <CreditCardPaymentMethod>(
                instanceId,
                transactionMode,
                responseMode,
                channelId,
                userLogin,
                userPassword,
                transactionId,
                invoiceId,
                shopperId,
                referenceId,
                paymentCode,
                paymentAmount,
                paymentCurrency,
                paymentUsage,
                customerSalutation,
                customerTitle,
                customerGivenName,
                customerFamilyName,
                customerSex,
                customerBirthdate,
                customerCompany,
                customerStreet,
                customerZip,
                customerCity,
                customerState,
                customerCountry,
                customerPhone,
                customerMobilePhone,
                customerEmail,
                customerIp,
                new LimitedString(AppLogic.GetStoreHTTPLocation(true) + "moneybookers3DSecureCallback.aspx"),
                sessionId);

            return(paymentRequest);
        }