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); }
/// <param name="instanceId">Must not be null</param> /// <param name="transactionMode">Must not be null</param> /// <param name="responseMode">Must not be null</param> /// <param name="channelId">Must not be null</param> /// <param name="userLogin">Must not be null</param> /// <param name="userPassword">Must not be null</param> /// <param name="transactionId"></param> /// <param name="invoiceId"></param> /// <param name="shopperId"></param> /// <param name="referenceId">Must not be null for refernce transactions</param> /// <param name="paymentCode">Must not be null</param> /// <param name="paymentAmount">Must not be null</param> /// <param name="paymentCurrency">Must not be null</param> /// <param name="paymentUsage">Must not be null</param> /// <param name="customerSalutation"></param> /// <param name="customerTitle"></param> /// <param name="customerGivenName">Must not be null for originating transactions</param> /// <param name="customerFamilyName">Must not be null for originating transactions</param> /// <param name="customerSex"></param> /// <param name="customerBirthdate"></param> /// <param name="customerCompany"></param> /// <param name="customerStreet">Must not be null for originating transactions</param> /// <param name="customerZip">Must not be null for originating transactions</param> /// <param name="customerCity">Must not be null for originating transactions</param> /// <param name="customerState"></param> /// <param name="customerCountry">Must not be null for originating transactions</param> /// <param name="customerPhone"></param> /// <param name="customerMobilePhone"></param> /// <param name="customerEmail">Must not be null for originating transactions</param> /// <param name="customerIp">Must not be null for originating transactions</param> /// <param name="responseUrl">Must not be null for Virtual Account transactions</param> public PaymentRequest( UniqueIdentifier instanceId, TransactionMode transactionMode, ResponseMode responseMode, UniqueIdentifier channelId, UniqueIdentifier userLogin, UserPassword userPassword, LimitedString transactionId, LimitedString invoiceId, LimitedString shopperId, UniqueIdentifier referenceId, PaymentCode paymentCode, Amount paymentAmount, Currency paymentCurrency, LimitedString paymentUsage, Prefix customerSalutation, Prefix customerTitle, Name customerGivenName, Name customerFamilyName, Sex customerSex, Date customerBirthdate, Name customerCompany, Street customerStreet, Zip customerZip, City customerCity, State customerState, CountryCode customerCountry, PhoneNumber customerPhone, MobilePhoneNumber customerMobilePhone, EmailAddress customerEmail, IpAddress customerIp, LimitedString responseUrl, LimitedString sessionId) { if (instanceId == null) { throw new ArgumentNullException("instanceId"); } if (instanceId == null) { throw new ArgumentNullException("instanceId"); } if (responseMode == null) { throw new ArgumentNullException("responseMode"); } if (channelId == null) { throw new ArgumentNullException("channelId"); } if (userLogin == null) { throw new ArgumentNullException("userLogin"); } if (userPassword == null) { throw new ArgumentNullException("userPassword"); } if (referenceId == null && (paymentCode.PaymentType == PaymentType.Capture || paymentCode.PaymentType == PaymentType.Reversal || paymentCode.PaymentType == PaymentType.Refund || paymentCode.PaymentType == PaymentType.Registration || paymentCode.PaymentType == PaymentType.Deregistration || paymentCode.PaymentType == PaymentType.Reschedule)) { throw new ArgumentNullException("referenceId"); } if (paymentCode == null) { throw new ArgumentNullException("paymentCode"); } if (paymentAmount == null) { throw new ArgumentNullException("paymentAmount"); } if (paymentCurrency == null) { throw new ArgumentNullException("paymentCurrency"); } if (paymentUsage == null) { throw new ArgumentNullException("paymentUsage"); } if (paymentCode.PaymentType == PaymentType.Preauthorisation || paymentCode.PaymentType == PaymentType.Debit) { if (customerGivenName == null) { throw new ArgumentNullException("customerGivenName"); } if (customerFamilyName == null) { throw new ArgumentNullException("customerFamilyName"); } if (customerStreet == null) { throw new ArgumentNullException("customerStreet"); } if (customerZip == null) { throw new ArgumentNullException("customerZip"); } if (customerCity == null) { throw new ArgumentNullException("customerCity"); } if (customerCountry == null) { throw new ArgumentNullException("customerCountry"); } if (customerEmail == null) { throw new ArgumentNullException("customerEmail"); } if (customerIp == null) { throw new ArgumentNullException("customerIp"); } } if (paymentCode.PaymentMethod is VirtualAccountPaymentMethod) { if (responseUrl == null) { throw new ArgumentNullException("responseUrl"); } } InstanceId = instanceId; TransactionMode = transactionMode; ResponseMode = responseMode; ChannelId = channelId; UserLogin = userLogin; UserPassword = userPassword; TransactionId = transactionId; InvoiceId = invoiceId; ShopperId = shopperId; ReferenceId = referenceId; PaymentCode = paymentCode; PaymentAmount = paymentAmount; PaymentCurrency = paymentCurrency; PaymentUsage = paymentUsage; CustomerSalutation = customerSalutation; CustomerTitle = customerTitle; CustomerGivenName = customerGivenName; CustomerFamilyName = customerFamilyName; CustomerSex = customerSex; CustomerBirthdate = customerBirthdate; CustomerCompany = customerCompany; CustomerStreet = customerStreet; CustomerZip = customerZip; CustomerCity = customerCity; CustomerState = customerState; CustomerCountry = customerCountry; CustomerPhone = customerPhone; CustomerMobilePhone = customerMobilePhone; CustomerEmail = customerEmail; CustomerIp = customerIp; ResponseUrl = responseUrl; SessionId = sessionId; }
public PaymentRequest <VirtualAccountPaymentMethod> BuildQuickCheckoutRequest( string orderTransactionId, int orderCustomerId, string orderCustomerEmail, string orderCustomerFirstName, string orderCustomerLastName, string orderCustomerAddress, string orderCustomerCity, string orderCustomerState, string orderCustomerZip, string orderCustomerCountry, string orderCustomerIp, decimal orderTotal) { UniqueIdentifier instanceId = LoadAppConfigString("Moneybookers.SenderID", s => new UniqueIdentifier(s)); TransactionMode transactionMode = TransactionMode; ResponseMode responseMode = ResponseMode.Async; 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 = new LimitedString(orderTransactionId.TrimToMax(LimitedString.MaxLength)); LimitedString invoiceId = null; LimitedString shopperId = new LimitedString(orderCustomerEmail.TrimToMax(LimitedString.MaxLength)); UniqueIdentifier referenceId = null; Amount paymentAmount = new Amount(orderTotal); Currency paymentCurrency = LoadAppConfigString("Localization.StoreCurrency", s => new Currency(s)); LimitedString paymentUsage = new LimitedString("Online order"); 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 = 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)); AccountId accountId = new AccountId(orderCustomerEmail.TrimToMax(AccountId.MaxLength)); LimitedString sessionId = new LimitedString(orderCustomerId.ToString()); VirtualAccountPaymentMethod paymentMethod = new VirtualAccountPaymentMethod(accountHolder, accountId); PaymentCode paymentCode = new PaymentCode(paymentMethod, PaymentType.Debit); PaymentRequest <VirtualAccountPaymentMethod> paymentRequest = new PaymentRequest <VirtualAccountPaymentMethod>( 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) + "moneybookersQuickCheckoutCallback.aspx"), sessionId); return(paymentRequest); }