示例#1
0
        public async Task <AckCodeType> CreateRecurringPaymentsProfileAsync(CreateRecurringPaymentsProfileReq request)
        {
            PayPalAPIAAInterfaceClient client = new PayPalAPIAAInterfaceClient();
            var response = await client.CreateRecurringPaymentsProfileAsync(GetAuthorizationRequest(), request);

            return(response.CreateRecurringPaymentsProfileResponse1.Ack);
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            CreateRecurringPaymentsProfileRequestType request = new CreateRecurringPaymentsProfileRequestType();

            populateRequest(request);

            // Invoke the API
            CreateRecurringPaymentsProfileReq wrapper = new CreateRecurringPaymentsProfileReq();

            wrapper.CreateRecurringPaymentsProfileRequest = request;

            // Configuration map containing signature credentials and other required configuration.
            // For a full list of configuration parameters refer in wiki page
            // [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
            Dictionary <string, string> configurationMap = Configuration.GetAcctAndConfig();

            // Create the PayPalAPIInterfaceServiceService service object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);

            // # API call
            // Invoke the CreateRecurringPaymentsProfile method in service wrapper object
            CreateRecurringPaymentsProfileResponseType createRPProfileResponse = service.CreateRecurringPaymentsProfile(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, createRPProfileResponse);
        }
        public CreateRecurringPaymentsProfileReq GetCreateRecurringPaymentsProfileRequest(
            ProcessPaymentRequest processPaymentRequest)
        {
            var req = new CreateRecurringPaymentsProfileReq
            {
                CreateRecurringPaymentsProfileRequest = new CreateRecurringPaymentsProfileRequestType
                {
                    Version = GetVersion(),
                    CreateRecurringPaymentsProfileRequestDetails = _payPalRecurringPaymentsService.GetCreateRecurringPaymentProfileRequestDetails(processPaymentRequest)
                }
            };

            return(req);
        }
示例#4
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            CreateRecurringPaymentsProfileRequestType request = new CreateRecurringPaymentsProfileRequestType();

            populateRequest(request);

            // Invoke the API
            CreateRecurringPaymentsProfileReq wrapper = new CreateRecurringPaymentsProfileReq();

            wrapper.CreateRecurringPaymentsProfileRequest = request;
            PayPalAPIInterfaceServiceService           service = new PayPalAPIInterfaceServiceService();
            CreateRecurringPaymentsProfileResponseType createRPProfileResponse = service.CreateRecurringPaymentsProfile(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, createRPProfileResponse);
        }
示例#5
0
        public override string RecurringBillingCreateSubscription(String SubscriptionDescription, Customer ThisCustomer, Address UseBillingAddress, Address UseShippingAddress, Decimal RecurringAmount, DateTime StartDate, int RecurringInterval, DateIntervalTypeEnum RecurringIntervalType, int OriginalRecurringOrderNumber, string XID, IDictionary <string, string> TransactionContext, out String RecurringSubscriptionID, out String RecurringSubscriptionCommand, out String RecurringSubscriptionResult)
        {
            string result = string.Empty;

            try
            {
                //Re-Use the Internal Gateway Recurring Billing logic for calculating how much of the order is recurring
                ShoppingCart recurringCart = new ShoppingCart(ThisCustomer.SkinID, ThisCustomer, CartTypeEnum.RecurringCart, OriginalRecurringOrderNumber, false);

                CreditCardDetailsType creditCard = new CreditCardDetailsType();

                if (UseBillingAddress.CardNumber != null && UseBillingAddress.CardNumber.Length > 0)
                {
                    creditCard.CreditCardNumber  = UseBillingAddress.CardNumber;
                    creditCard.ExpMonth          = Localization.ParseUSInt(UseBillingAddress.CardExpirationMonth);
                    creditCard.ExpYear           = Localization.ParseUSInt(UseBillingAddress.CardExpirationYear);
                    creditCard.ExpMonthSpecified = true;
                    creditCard.ExpYearSpecified  = true;
                    creditCard.CVV2 = XID;

                    if (UseBillingAddress.CardType == "AmericanExpress")
                    {
                        creditCard.CreditCardType = (CreditCardTypeType)Enum.Parse(typeof(CreditCardTypeType), "Amex", true);
                    }
                    else
                    {
                        creditCard.CreditCardType = (CreditCardTypeType)Enum.Parse(typeof(CreditCardTypeType), UseBillingAddress.CardType, true);
                    }
                    creditCard.CreditCardTypeSpecified = true;
                }
                else
                {
                    creditCard.CreditCardTypeSpecified = false;
                }

                BasicAmountType recurringAmount = new BasicAmountType();
                recurringAmount.currencyID = (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), AppLogic.AppConfig("Localization.StoreCurrency"), true);
                recurringAmount.Value      = RecurringAmount.ToString();

                DateIntervalTypeEnum recurringIntervalType = recurringCart.CartItems[0].RecurringIntervalType;                 //We currently only support 1 interval per recurring order, so grabbing the first as a default should be safe
                int recurringInterval = recurringCart.CartItems[0].RecurringInterval;

                BillingPeriodDetailsType billingPeriodDetails = PayPalController.GetECRecurringPeriodDetails(recurringIntervalType, recurringInterval);
                billingPeriodDetails.Amount = recurringAmount;
                billingPeriodDetails.TotalBillingCyclesSpecified = false;

                ScheduleDetailsType scheduleDetails = new ScheduleDetailsType();
                scheduleDetails.Description                        = string.Format("Recurring order created on {0} from {1}", System.DateTime.Now.ToShortDateString(), AppLogic.AppConfig("StoreName"));
                scheduleDetails.MaxFailedPayments                  = 0;
                scheduleDetails.MaxFailedPaymentsSpecified         = true;
                scheduleDetails.AutoBillOutstandingAmount          = AutoBillType.NoAutoBill;
                scheduleDetails.AutoBillOutstandingAmountSpecified = true;
                scheduleDetails.PaymentPeriod                      = billingPeriodDetails;

                RecurringPaymentsProfileDetailsType profileDetails = new RecurringPaymentsProfileDetailsType();
                profileDetails.SubscriberName   = ThisCustomer.FirstName + " " + ThisCustomer.LastName;
                profileDetails.BillingStartDate = StartDate;

                CreateRecurringPaymentsProfileRequestDetailsType profileRequestDetails = new CreateRecurringPaymentsProfileRequestDetailsType();
                profileRequestDetails.ScheduleDetails = scheduleDetails;
                profileRequestDetails.RecurringPaymentsProfileDetails = profileDetails;
                profileRequestDetails.CreditCard = creditCard;

                if (!(UseBillingAddress.CardNumber != null && UseBillingAddress.CardNumber.Length > 0))
                {
                    profileRequestDetails.Token = XID;
                }

                if (recurringCart.IsAllDownloadComponents())
                {
                    PaymentDetailsItemType paymentDetailsItem = new PaymentDetailsItemType();
                    paymentDetailsItem.ItemCategory          = ItemCategoryType.Digital;
                    paymentDetailsItem.ItemCategorySpecified = true;

                    List <PaymentDetailsItemType> paymentDetailsList = new List <PaymentDetailsItemType>();
                    paymentDetailsList.Add(paymentDetailsItem);

                    profileRequestDetails.PaymentDetailsItem = paymentDetailsList.ToArray();
                }

                CreateRecurringPaymentsProfileRequestType profileRequest = new CreateRecurringPaymentsProfileRequestType();
                profileRequest.Version = API_VER;
                profileRequest.CreateRecurringPaymentsProfileRequestDetails = profileRequestDetails;

                CreateRecurringPaymentsProfileReq request = new CreateRecurringPaymentsProfileReq();
                request.CreateRecurringPaymentsProfileRequest = profileRequest;

                CreateRecurringPaymentsProfileResponseType profileResponse = new CreateRecurringPaymentsProfileResponseType();
                profileResponse = IPayPal.CreateRecurringPaymentsProfile(request);

                if (profileResponse != null && profileResponse.Ack.ToString().StartsWith("success", StringComparison.InvariantCultureIgnoreCase))
                {
                    result = AppLogic.ro_OK;
                }
                else
                {
                    if (profileResponse.Errors != null)
                    {
                        bool first = true;
                        for (int ix = 0; ix < profileResponse.Errors.Length; ix++)
                        {
                            if (!first)
                            {
                                result += ", ";
                            }
                            result += profileResponse.Errors[ix].LongMessage;
                            first   = false;
                        }
                    }
                }

                RecurringSubscriptionID      = (profileResponse.CreateRecurringPaymentsProfileResponseDetails.ProfileID == null ? "No ProfileID provided" : profileResponse.CreateRecurringPaymentsProfileResponseDetails.ProfileID);
                RecurringSubscriptionCommand = string.Empty;
                RecurringSubscriptionResult  = (profileResponse.CreateRecurringPaymentsProfileResponseDetails.DCCProcessorResponse == null ? "No response provided" : profileResponse.CreateRecurringPaymentsProfileResponseDetails.DCCProcessorResponse);

                //Log the transaction
                OrderTransactionCollection ecRecurringOrderTransaction = new OrderTransactionCollection(OriginalRecurringOrderNumber);
                ecRecurringOrderTransaction.AddTransaction("PayPal Express Checkout Recurring Profile Creation",
                                                           request.ToString(),
                                                           result,
                                                           string.Empty,
                                                           (profileResponse.CreateRecurringPaymentsProfileResponseDetails.ProfileID == null ? "No ProfileID provided" : profileResponse.CreateRecurringPaymentsProfileResponseDetails.ProfileID),
                                                           AppLogic.ro_PMPayPalExpress,
                                                           null,
                                                           RecurringAmount);
            }
            catch
            {
                result = "Recurring Profile Creation Failed.";
                RecurringSubscriptionID      = string.Empty;
                RecurringSubscriptionCommand = string.Empty;
                RecurringSubscriptionResult  = result;
            }
            return(result);
        }
示例#6
0
        /// <summary>
        /// Process recurring payment
        /// </summary>
        /// <param name="processPaymentRequest">Payment info required for an order processing</param>
        /// <returns>Process payment result</returns>
        public ProcessPaymentResult ProcessRecurringPayment(ProcessPaymentRequest processPaymentRequest)
        {
            var result = new ProcessPaymentResult();

            var customer = _customerService.GetCustomerById(processPaymentRequest.CustomerId);

            var req = new CreateRecurringPaymentsProfileReq();

            req.CreateRecurringPaymentsProfileRequest         = new CreateRecurringPaymentsProfileRequestType();
            req.CreateRecurringPaymentsProfileRequest.Version = GetApiVersion();
            var details = new CreateRecurringPaymentsProfileRequestDetailsType();

            req.CreateRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails = details;

            details.CreditCard = new CreditCardDetailsType();
            details.CreditCard.CreditCardNumber  = processPaymentRequest.CreditCardNumber;
            details.CreditCard.CreditCardType    = GetPaypalCreditCardType(processPaymentRequest.CreditCardType);
            details.CreditCard.ExpMonthSpecified = true;
            details.CreditCard.ExpMonth          = processPaymentRequest.CreditCardExpireMonth;
            details.CreditCard.ExpYearSpecified  = true;
            details.CreditCard.ExpYear           = processPaymentRequest.CreditCardExpireYear;
            details.CreditCard.CVV2      = processPaymentRequest.CreditCardCvv2;
            details.CreditCard.CardOwner = new PayerInfoType();
            details.CreditCard.CardOwner.PayerCountry  = GetPaypalCountryCodeType(customer.BillingAddress.Country);
            details.CreditCard.CreditCardTypeSpecified = true;

            details.CreditCard.CardOwner.Address = new AddressType();
            details.CreditCard.CardOwner.Address.CountrySpecified = true;
            details.CreditCard.CardOwner.Address.Street1          = customer.BillingAddress.Address1;
            details.CreditCard.CardOwner.Address.Street2          = customer.BillingAddress.Address2;
            details.CreditCard.CardOwner.Address.CityName         = customer.BillingAddress.City;
            if (customer.BillingAddress.StateProvince != null)
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = customer.BillingAddress.StateProvince.Abbreviation;
            }
            else
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = "CA";
            }
            details.CreditCard.CardOwner.Address.Country    = GetPaypalCountryCodeType(customer.BillingAddress.Country);
            details.CreditCard.CardOwner.Address.PostalCode = customer.BillingAddress.ZipPostalCode;
            details.CreditCard.CardOwner.Payer               = customer.BillingAddress.Email;
            details.CreditCard.CardOwner.PayerName           = new PersonNameType();
            details.CreditCard.CardOwner.PayerName.FirstName = customer.BillingAddress.FirstName;
            details.CreditCard.CardOwner.PayerName.LastName  = customer.BillingAddress.LastName;

            //start date
            details.RecurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType();
            details.RecurringPaymentsProfileDetails.BillingStartDate = DateTime.UtcNow;
            details.RecurringPaymentsProfileDetails.ProfileReference = processPaymentRequest.OrderGuid.ToString();

            //schedule
            details.ScheduleDetails                                 = new ScheduleDetailsType();
            details.ScheduleDetails.Description                     = "Recurring payment";
            details.ScheduleDetails.PaymentPeriod                   = new BillingPeriodDetailsType();
            details.ScheduleDetails.PaymentPeriod.Amount            = new BasicAmountType();
            details.ScheduleDetails.PaymentPeriod.Amount.Value      = Math.Round(processPaymentRequest.OrderTotal, 2).ToString("N", new CultureInfo("en-us"));
            details.ScheduleDetails.PaymentPeriod.Amount.currencyID = PaypalHelper.GetPaypalCurrency(_currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId));
            details.ScheduleDetails.PaymentPeriod.BillingFrequency  = processPaymentRequest.RecurringCycleLength;
            switch (processPaymentRequest.RecurringCyclePeriod)
            {
            case RecurringProductCyclePeriod.Days:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Day;
                break;

            case RecurringProductCyclePeriod.Weeks:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Week;
                break;

            case RecurringProductCyclePeriod.Months:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Month;
                break;

            case RecurringProductCyclePeriod.Years:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Year;
                break;

            default:
                throw new NopException("Not supported cycle period");
            }
            details.ScheduleDetails.PaymentPeriod.TotalBillingCycles          = processPaymentRequest.RecurringTotalCycles;
            details.ScheduleDetails.PaymentPeriod.TotalBillingCyclesSpecified = true;



            using (var service2 = new PayPalAPIAASoapBinding())
            {
                if (!_paypalDirectPaymentSettings.UseSandbox)
                {
                    service2.Url = "https://api-3t.paypal.com/2.0/";
                }
                else
                {
                    service2.Url = "https://api-3t.sandbox.paypal.com/2.0/";
                }

                service2.RequesterCredentials                       = new CustomSecurityHeaderType();
                service2.RequesterCredentials.Credentials           = new UserIdPasswordType();
                service2.RequesterCredentials.Credentials.Username  = _paypalDirectPaymentSettings.ApiAccountName;
                service2.RequesterCredentials.Credentials.Password  = _paypalDirectPaymentSettings.ApiAccountPassword;
                service2.RequesterCredentials.Credentials.Signature = _paypalDirectPaymentSettings.Signature;
                service2.RequesterCredentials.Credentials.Subject   = "";

                CreateRecurringPaymentsProfileResponseType response = service2.CreateRecurringPaymentsProfile(req);

                string error   = "";
                bool   success = PaypalHelper.CheckSuccess(response, out error);
                if (success)
                {
                    result.NewPaymentStatus = PaymentStatus.Pending;
                    if (response.CreateRecurringPaymentsProfileResponseDetails != null)
                    {
                        result.SubscriptionTransactionId = response.CreateRecurringPaymentsProfileResponseDetails.ProfileID;
                    }
                }
                else
                {
                    result.AddError(error);
                }
            }

            return(result);
        }
        /// <summary>
        /// Process recurring payment
        /// </summary>
        /// <param name="processPaymentRequest">Payment info required for an order processing</param>
        /// <returns>Process payment result</returns>
        public override ProcessPaymentResult ProcessRecurringPayment(ProcessPaymentRequest processPaymentRequest)
        {
            var result = new ProcessPaymentResult();

            var store    = Services.StoreService.GetStoreById(processPaymentRequest.StoreId);
            var customer = _customerService.GetCustomerById(processPaymentRequest.CustomerId);
            var settings = Services.Settings.LoadSetting <PayPalDirectPaymentSettings>(processPaymentRequest.StoreId);

            var req = new CreateRecurringPaymentsProfileReq();

            req.CreateRecurringPaymentsProfileRequest         = new CreateRecurringPaymentsProfileRequestType();
            req.CreateRecurringPaymentsProfileRequest.Version = ApiVersion;
            var details = new CreateRecurringPaymentsProfileRequestDetailsType();

            req.CreateRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails = details;

            details.CreditCard = new CreditCardDetailsType();
            details.CreditCard.CreditCardNumber  = processPaymentRequest.CreditCardNumber;
            details.CreditCard.CreditCardType    = GetCreditCardType(processPaymentRequest.CreditCardType);
            details.CreditCard.ExpMonthSpecified = true;
            details.CreditCard.ExpMonth          = processPaymentRequest.CreditCardExpireMonth;
            details.CreditCard.ExpYearSpecified  = true;
            details.CreditCard.ExpYear           = processPaymentRequest.CreditCardExpireYear;
            details.CreditCard.CVV2      = processPaymentRequest.CreditCardCvv2;
            details.CreditCard.CardOwner = new PayerInfoType();
            details.CreditCard.CardOwner.PayerCountry  = GetCountryCodeType(customer.BillingAddress.Country);
            details.CreditCard.CreditCardTypeSpecified = true;

            details.CreditCard.CardOwner.Address = new AddressType();
            details.CreditCard.CardOwner.Address.CountrySpecified = true;
            details.CreditCard.CardOwner.Address.Street1          = customer.BillingAddress.Address1;
            details.CreditCard.CardOwner.Address.Street2          = customer.BillingAddress.Address2;
            details.CreditCard.CardOwner.Address.CityName         = customer.BillingAddress.City;
            if (customer.BillingAddress.StateProvince != null)
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = customer.BillingAddress.StateProvince.Abbreviation;
            }
            else
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = "CA";
            }
            details.CreditCard.CardOwner.Address.Country    = GetCountryCodeType(customer.BillingAddress.Country);
            details.CreditCard.CardOwner.Address.PostalCode = customer.BillingAddress.ZipPostalCode;
            details.CreditCard.CardOwner.Payer               = customer.BillingAddress.Email;
            details.CreditCard.CardOwner.PayerName           = new PersonNameType();
            details.CreditCard.CardOwner.PayerName.FirstName = customer.BillingAddress.FirstName;
            details.CreditCard.CardOwner.PayerName.LastName  = customer.BillingAddress.LastName;

            //start date
            details.RecurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType();
            details.RecurringPaymentsProfileDetails.BillingStartDate = DateTime.UtcNow;
            details.RecurringPaymentsProfileDetails.ProfileReference = processPaymentRequest.OrderGuid.ToString();

            //schedule
            details.ScheduleDetails                                 = new ScheduleDetailsType();
            details.ScheduleDetails.Description                     = T("Plugins.Payments.PayPalDirect.RecurringPayment");
            details.ScheduleDetails.PaymentPeriod                   = new BillingPeriodDetailsType();
            details.ScheduleDetails.PaymentPeriod.Amount            = new BasicAmountType();
            details.ScheduleDetails.PaymentPeriod.Amount.Value      = Math.Round(processPaymentRequest.OrderTotal, 2).ToString("N", new CultureInfo("en-us"));
            details.ScheduleDetails.PaymentPeriod.Amount.currencyID = GetApiCurrency(store.PrimaryStoreCurrency);
            details.ScheduleDetails.PaymentPeriod.BillingFrequency  = processPaymentRequest.RecurringCycleLength;
            switch (processPaymentRequest.RecurringCyclePeriod)
            {
            case RecurringProductCyclePeriod.Days:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Day;
                break;

            case RecurringProductCyclePeriod.Weeks:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Week;
                break;

            case RecurringProductCyclePeriod.Months:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Month;
                break;

            case RecurringProductCyclePeriod.Years:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Year;
                break;

            default:
                throw new SmartException(T("Plugins.Payments.PayPalDirect.NotSupportedPeriod"));
            }
            details.ScheduleDetails.PaymentPeriod.TotalBillingCycles          = processPaymentRequest.RecurringTotalCycles;
            details.ScheduleDetails.PaymentPeriod.TotalBillingCyclesSpecified = true;

            using (var service = GetApiAaService(settings))
            {
                var response = service.CreateRecurringPaymentsProfile(req);

                var error   = "";
                var success = IsSuccess(response, out error);

                if (success)
                {
                    result.NewPaymentStatus = PaymentStatus.Pending;
                    if (response.CreateRecurringPaymentsProfileResponseDetails != null)
                    {
                        result.SubscriptionTransactionId = response.CreateRecurringPaymentsProfileResponseDetails.ProfileID;
                    }
                }
                else
                {
                    result.AddError(error);
                }
            }

            return(result);
        }
示例#8
0
        /// <summary>
        /// Process recurring payment
        /// </summary>
        /// <param name="processPaymentRequest">Payment info required for an order processing</param>
        /// <returns>Process payment result</returns>
        public ProcessPaymentResult ProcessRecurringPayment(ProcessPaymentRequest processPaymentRequest)
        {
            var result = new ProcessPaymentResult();

            var customer = _customerService.GetCustomerById(processPaymentRequest.CustomerId);

            var req = new CreateRecurringPaymentsProfileReq();

            req.CreateRecurringPaymentsProfileRequest         = new CreateRecurringPaymentsProfileRequestType();
            req.CreateRecurringPaymentsProfileRequest.Version = GetApiVersion();
            var details = new CreateRecurringPaymentsProfileRequestDetailsType();

            req.CreateRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails = details;

            details.CreditCard = new CreditCardDetailsType();
            details.CreditCard.CreditCardNumber       = processPaymentRequest.CreditCardNumber;
            details.CreditCard.CreditCardType         = GetPaypalCreditCardType(processPaymentRequest.CreditCardType);
            details.CreditCard.ExpMonth               = processPaymentRequest.CreditCardExpireMonth;
            details.CreditCard.ExpYear                = processPaymentRequest.CreditCardExpireYear;
            details.CreditCard.CVV2                   = processPaymentRequest.CreditCardCvv2;
            details.CreditCard.CardOwner              = new PayerInfoType();
            details.CreditCard.CardOwner.PayerCountry = GetPaypalCountryCodeType(customer.BillingAddress.Country);

            details.CreditCard.CardOwner.Address          = new AddressType();
            details.CreditCard.CardOwner.Address.Street1  = customer.BillingAddress.Address1;
            details.CreditCard.CardOwner.Address.Street2  = customer.BillingAddress.Address2;
            details.CreditCard.CardOwner.Address.CityName = customer.BillingAddress.City;
            if (customer.BillingAddress.StateProvince != null)
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = customer.BillingAddress.StateProvince.Abbreviation;
            }
            else
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = "CA";
            }
            details.CreditCard.CardOwner.Address.Country    = GetPaypalCountryCodeType(customer.BillingAddress.Country);
            details.CreditCard.CardOwner.Address.PostalCode = customer.BillingAddress.ZipPostalCode;
            details.CreditCard.CardOwner.Payer               = customer.BillingAddress.Email;
            details.CreditCard.CardOwner.PayerName           = new PersonNameType();
            details.CreditCard.CardOwner.PayerName.FirstName = customer.BillingAddress.FirstName;
            details.CreditCard.CardOwner.PayerName.LastName  = customer.BillingAddress.LastName;

            //start date
            details.RecurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType();
            details.RecurringPaymentsProfileDetails.BillingStartDate = DateTime.UtcNow.ToString("s", CultureInfo.InvariantCulture);
            details.RecurringPaymentsProfileDetails.ProfileReference = processPaymentRequest.OrderGuid.ToString();

            //schedule
            details.ScheduleDetails                                 = new ScheduleDetailsType();
            details.ScheduleDetails.Description                     = "Recurring payment";
            details.ScheduleDetails.PaymentPeriod                   = new BillingPeriodDetailsType();
            details.ScheduleDetails.PaymentPeriod.Amount            = new BasicAmountType();
            details.ScheduleDetails.PaymentPeriod.Amount.value      = Math.Round(processPaymentRequest.OrderTotal, 2).ToString("N", new CultureInfo("en-us"));
            details.ScheduleDetails.PaymentPeriod.Amount.currencyID = PaypalHelper.GetPaypalCurrency(_currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId));
            details.ScheduleDetails.PaymentPeriod.BillingFrequency  = processPaymentRequest.RecurringCycleLength;
            switch (processPaymentRequest.RecurringCyclePeriod)
            {
            case RecurringProductCyclePeriod.Days:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.DAY;
                break;

            case RecurringProductCyclePeriod.Weeks:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.WEEK;
                break;

            case RecurringProductCyclePeriod.Months:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.MONTH;
                break;

            case RecurringProductCyclePeriod.Years:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.YEAR;
                break;

            default:
                throw new NopException("Not supported cycle period");
            }
            details.ScheduleDetails.PaymentPeriod.TotalBillingCycles = processPaymentRequest.RecurringTotalCycles;



            var service = GetService();
            CreateRecurringPaymentsProfileResponseType response = service.CreateRecurringPaymentsProfile(req);

            string error;
            bool   success = PaypalHelper.CheckSuccess(response, out error);

            if (success)
            {
                result.NewPaymentStatus = PaymentStatus.Pending;
                if (response.CreateRecurringPaymentsProfileResponseDetails != null)
                {
                    result.SubscriptionTransactionId = response.CreateRecurringPaymentsProfileResponseDetails.ProfileID;
                }
            }
            else
            {
                result.AddError(error);
            }
            return(result);
        }
示例#9
0
        /// <summary>
        /// Process recurring payment
        /// </summary>
        /// <param name="paymentInfo">Payment info required for an order processing</param>
        /// <param name="customer">Customer</param>
        /// <param name="orderGuid">Unique order identifier</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void ProcessRecurringPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
        {
            InitSettings();

            CreateRecurringPaymentsProfileReq req = new CreateRecurringPaymentsProfileReq();

            req.CreateRecurringPaymentsProfileRequest         = new CreateRecurringPaymentsProfileRequestType();
            req.CreateRecurringPaymentsProfileRequest.Version = this.APIVersion;
            CreateRecurringPaymentsProfileRequestDetailsType details = new CreateRecurringPaymentsProfileRequestDetailsType();

            req.CreateRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails = details;

            details.CreditCard = new CreditCardDetailsType();
            details.CreditCard.CreditCardNumber  = paymentInfo.CreditCardNumber;
            details.CreditCard.CreditCardType    = GetPaypalCreditCardType(paymentInfo.CreditCardType);
            details.CreditCard.ExpMonthSpecified = true;
            details.CreditCard.ExpMonth          = paymentInfo.CreditCardExpireMonth;
            details.CreditCard.ExpYearSpecified  = true;
            details.CreditCard.ExpYear           = paymentInfo.CreditCardExpireYear;
            details.CreditCard.CVV2      = paymentInfo.CreditCardCvv2;
            details.CreditCard.CardOwner = new PayerInfoType();
            details.CreditCard.CardOwner.PayerCountry  = GetPaypalCountryCodeType(paymentInfo.BillingAddress.Country);
            details.CreditCard.CreditCardTypeSpecified = true;

            details.CreditCard.CardOwner.Address = new AddressType();
            details.CreditCard.CardOwner.Address.CountrySpecified = true;
            details.CreditCard.CardOwner.Address.Street1          = paymentInfo.BillingAddress.Address1;
            details.CreditCard.CardOwner.Address.Street2          = paymentInfo.BillingAddress.Address2;
            details.CreditCard.CardOwner.Address.CityName         = paymentInfo.BillingAddress.City;
            if (paymentInfo.BillingAddress.StateProvince != null)
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = paymentInfo.BillingAddress.StateProvince.Abbreviation;
            }
            else
            {
                details.CreditCard.CardOwner.Address.StateOrProvince = "CA";
            }
            details.CreditCard.CardOwner.Address.Country    = GetPaypalCountryCodeType(paymentInfo.BillingAddress.Country);
            details.CreditCard.CardOwner.Address.PostalCode = paymentInfo.BillingAddress.ZipPostalCode;
            details.CreditCard.CardOwner.Payer               = paymentInfo.BillingAddress.Email;
            details.CreditCard.CardOwner.PayerName           = new PersonNameType();
            details.CreditCard.CardOwner.PayerName.FirstName = paymentInfo.BillingAddress.FirstName;
            details.CreditCard.CardOwner.PayerName.LastName  = paymentInfo.BillingAddress.LastName;

            //start date
            details.RecurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType();
            details.RecurringPaymentsProfileDetails.BillingStartDate = DateTime.UtcNow;
            details.RecurringPaymentsProfileDetails.ProfileReference = orderGuid.ToString();

            //schedule
            details.ScheduleDetails                                 = new ScheduleDetailsType();
            details.ScheduleDetails.Description                     = string.Format("{0} - {1}", IoC.Resolve <ISettingManager>().StoreName, "recurring payment");
            details.ScheduleDetails.PaymentPeriod                   = new BillingPeriodDetailsType();
            details.ScheduleDetails.PaymentPeriod.Amount            = new BasicAmountType();
            details.ScheduleDetails.PaymentPeriod.Amount.Value      = paymentInfo.OrderTotal.ToString("N", new CultureInfo("en-us"));
            details.ScheduleDetails.PaymentPeriod.Amount.currencyID = PaypalHelper.GetPaypalCurrency(IoC.Resolve <ICurrencyService>().PrimaryStoreCurrency);
            details.ScheduleDetails.PaymentPeriod.BillingFrequency  = paymentInfo.RecurringCycleLength;
            switch (paymentInfo.RecurringCyclePeriod)
            {
            case (int)RecurringProductCyclePeriodEnum.Days:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Day;
                break;

            case (int)RecurringProductCyclePeriodEnum.Weeks:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Week;
                break;

            case (int)RecurringProductCyclePeriodEnum.Months:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Month;
                break;

            case (int)RecurringProductCyclePeriodEnum.Years:
                details.ScheduleDetails.PaymentPeriod.BillingPeriod = BillingPeriodType.Year;
                break;

            default:
                throw new NopException("Not supported cycle period");
            }
            details.ScheduleDetails.PaymentPeriod.TotalBillingCycles          = paymentInfo.RecurringTotalCycles;
            details.ScheduleDetails.PaymentPeriod.TotalBillingCyclesSpecified = true;

            CreateRecurringPaymentsProfileResponseType response = service2.CreateRecurringPaymentsProfile(req);

            string error   = string.Empty;
            bool   Success = PaypalHelper.CheckSuccess(response, out error);

            if (Success)
            {
                processPaymentResult.PaymentStatus = PaymentStatusEnum.Pending;
                if (response.CreateRecurringPaymentsProfileResponseDetails != null)
                {
                    processPaymentResult.SubscriptionTransactionId = response.CreateRecurringPaymentsProfileResponseDetails.ProfileID;
                }
            }
            else
            {
                processPaymentResult.Error     = error;
                processPaymentResult.FullError = error;
            }
        }
    // # CreateRecurringPaymentsProfile API Operation
    // The CreateRecurringPaymentsProfile API operation creates a recurring payments profile.
    // You must invoke the CreateRecurringPaymentsProfile API operation for each profile you want to create.
    // The API operation creates a profile and an associated billing agreement.
    // Note:
    // There is a one-to-one correspondence between billing agreements and recurring payments profiles.
    // To associate a recurring payments profile with its billing agreement,
    // you must ensure that the description in the recurring payments profile matches the description of a billing agreement.
    // For version 54.0 and later, use SetExpressCheckout to initiate creation of a billing agreement.
    public CreateRecurringPaymentsProfileResponseType CreateRecurringPaymentsProfileAPIOperation()
    {
        // Create the CreateRecurringPaymentsProfileResponseType object
        CreateRecurringPaymentsProfileResponseType responseCreateRecurringPaymentsProfileResponseType = new CreateRecurringPaymentsProfileResponseType();

        try
        {
            // Create the CreateRecurringPaymentsProfileReq object
            CreateRecurringPaymentsProfileReq createRecurringPaymentsProfile = new CreateRecurringPaymentsProfileReq();

            // Create the CreateRecurringPaymentsProfileRequestType object
            CreateRecurringPaymentsProfileRequestType createRecurringPaymentsProfileRequest = new CreateRecurringPaymentsProfileRequestType();

            // You can include up to 10 recurring payments profiles per request. The
            // order of the profile details must match the order of the billing
            // agreement details specified in the SetExpressCheckout request which
            // takes mandatory argument:
            //
            // * `billing start date` - The date when billing for this profile begins.
            // `Note:
            // The profile may take up to 24 hours for activation.`
            RecurringPaymentsProfileDetailsType recurringPaymentsProfileDetails
                = new RecurringPaymentsProfileDetailsType("2013-12-31T13:01:19+00:00");

            // Billing amount for each billing cycle during this payment period.
            // This amount does not include shipping and tax amounts.
            // `Note:
            // All amounts in the CreateRecurringPaymentsProfile request must have
            // the same currency.`
            BasicAmountType billingAmount = new BasicAmountType(CurrencyCodeType.USD, "3.00");

            // Regular payment period for this schedule which takes mandatory
            // params:
            //
            // * `Billing Period` - Unit for billing during this subscription period. It is one of the
            // following values:
            //  * Day
            //  * Week
            //  * SemiMonth
            //  * Month
            //  * Year
            //  For SemiMonth, billing is done on the 1st and 15th of each month.
            //  `Note:
            //  The combination of BillingPeriod and BillingFrequency cannot exceed
            //  one year.`
            // * `Billing Frequency` - Number of billing periods that make up one billing cycle.
            // The combination of billing frequency and billing period must be less
            // than or equal to one year. For example, if the billing cycle is
            // Month, the maximum value for billing frequency is 12. Similarly, if
            // the billing cycle is Week, the maximum value for billing frequency is
            // 52.
            // `Note:
            // If the billing period is SemiMonth, the billing frequency must be 1.`
            // * `Billing Amount`
            BillingPeriodDetailsType paymentPeriod = new BillingPeriodDetailsType(BillingPeriodType.DAY, Convert.ToInt32("5"), billingAmount);

            // Describes the recurring payments schedule, including the regular
            // payment period, whether there is a trial period, and the number of
            // payments that can fail before a profile is suspended which takes
            // mandatory params:
            //
            // * `Description` - Description of the recurring payment.
            // `Note:
            // You must ensure that this field matches the corresponding billing
            // agreement description included in the SetExpressCheckout request.`
            // * `Payment Period`
            ScheduleDetailsType scheduleDetails = new ScheduleDetailsType("description", paymentPeriod);

            // `CreateRecurringPaymentsProfileRequestDetailsType` which takes
            // mandatory params:
            //
            // * `Recurring Payments Profile Details`
            // * `Schedule Details`
            CreateRecurringPaymentsProfileRequestDetailsType createRecurringPaymentsProfileRequestDetails
                = new CreateRecurringPaymentsProfileRequestDetailsType(recurringPaymentsProfileDetails, scheduleDetails);

            // Either EC token or a credit card number is required.If you include
            // both token and credit card number, the token is used and credit card number is
            // ignored
            // In case of setting EC token,
            // `createRecurringPaymentsProfileRequestDetails.Token = "EC-5KH01765D1724703R";`
            // A timestamped token, the value of which was returned in the response
            // to the first call to SetExpressCheckout. Call
            // CreateRecurringPaymentsProfile once for each billing
            // agreement included in SetExpressCheckout request and use the same
            // token for each call. Each CreateRecurringPaymentsProfile request
            // creates a single recurring payments profile.
            // `Note:
            // Tokens expire after approximately 3 hours.`

            // Credit card information for recurring payments using direct payments.
            CreditCardDetailsType creditCard = new CreditCardDetailsType();

            // Type of credit card. For UK, only Maestro, MasterCard, Discover, and
            // Visa are allowable. For Canada, only MasterCard and Visa are
            // allowable and Interac debit cards are not supported. It is one of the
            // following values:
            //
            // * Visa
            // * MasterCard
            // * Discover
            // * Amex
            // * Solo
            // * Switch
            // * Maestro: See note.
            // `Note:
            // If the credit card type is Maestro, you must set currencyId to GBP.
            // In addition, you must specify either StartMonth and StartYear or
            // IssueNumber.`
            creditCard.CreditCardType = CreditCardTypeType.VISA;

            // Credit Card Number
            creditCard.CreditCardNumber = "4442662639546634";

            // Credit Card Expiration Month
            creditCard.ExpMonth = Convert.ToInt32("12");

            // Credit Card Expiration Year
            creditCard.ExpYear = Convert.ToInt32("2016");
            createRecurringPaymentsProfileRequestDetails.CreditCard = creditCard;

            createRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails
                = createRecurringPaymentsProfileRequestDetails;

            createRecurringPaymentsProfile.CreateRecurringPaymentsProfileRequest = createRecurringPaymentsProfileRequest;

            // # Create the service wrapper object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();


            // # API call
            // Invoke the CreateRecurringPaymentsProfile method
            responseCreateRecurringPaymentsProfileResponseType
                = service.CreateRecurringPaymentsProfile(createRecurringPaymentsProfile);

            if (responseCreateRecurringPaymentsProfileResponseType != null)
            {
                // Response envelope acknowledgement
                string acknowledgement = "CreateRecurringPaymentsProfile API Operation - ";
                acknowledgement += responseCreateRecurringPaymentsProfileResponseType.Ack.ToString();
                logger.Info(acknowledgement + "\n");
                Console.WriteLine(acknowledgement + "\n");

                // # Success values
                if (responseCreateRecurringPaymentsProfileResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
                {
                    // A unique identifier for future reference to the details of this recurring payment
                    logger.Info("Profile ID : " + responseCreateRecurringPaymentsProfileResponseType.CreateRecurringPaymentsProfileResponseDetails.ProfileID + "\n");
                    Console.WriteLine("Profile ID : " + responseCreateRecurringPaymentsProfileResponseType.CreateRecurringPaymentsProfileResponseDetails.ProfileID + "\n");
                }
                // # Error Values
                else
                {
                    List <ErrorType> errorMessages = responseCreateRecurringPaymentsProfileResponseType.Errors;
                    foreach (ErrorType error in errorMessages)
                    {
                        logger.Debug("API Error Message : " + error.LongMessage);
                        Console.WriteLine("API Error Message : " + error.LongMessage + "\n");
                    }
                }
            }
        }
        // # Exception log
        catch (System.Exception ex)
        {
            // Log the exception message
            logger.Debug("Error Message : " + ex.Message);
            Console.WriteLine("Error Message : " + ex.Message);
        }
        return(responseCreateRecurringPaymentsProfileResponseType);
    }
示例#11
0
 /// <remarks/>
 public void CreateRecurringPaymentsProfileAsync(CreateRecurringPaymentsProfileReq CreateRecurringPaymentsProfileReq, object userState) {
     if ((this.CreateRecurringPaymentsProfileOperationCompleted == null)) {
         this.CreateRecurringPaymentsProfileOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateRecurringPaymentsProfileOperationCompleted);
     }
     this.InvokeAsync("CreateRecurringPaymentsProfile", new object[] {
                 CreateRecurringPaymentsProfileReq}, this.CreateRecurringPaymentsProfileOperationCompleted, userState);
 }
示例#12
0
 /// <remarks/>
 public void CreateRecurringPaymentsProfileAsync(CreateRecurringPaymentsProfileReq CreateRecurringPaymentsProfileReq) {
     this.CreateRecurringPaymentsProfileAsync(CreateRecurringPaymentsProfileReq, null);
 }
示例#13
0
 public CreateRecurringPaymentsProfileResponseType CreateRecurringPaymentsProfile(CreateRecurringPaymentsProfileReq CreateRecurringPaymentsProfileReq)
 {
     return(CreateRecurringPaymentsProfile(CreateRecurringPaymentsProfileReq, null));
 }
示例#14
0
        /**
         *
         */
        public CreateRecurringPaymentsProfileResponseType CreateRecurringPaymentsProfile(CreateRecurringPaymentsProfileReq CreateRecurringPaymentsProfileReq, string apiUsername)
        {
            setStandardParams(CreateRecurringPaymentsProfileReq.CreateRecurringPaymentsProfileRequest);
            string resp = call("CreateRecurringPaymentsProfile", CreateRecurringPaymentsProfileReq.toXMLString(), apiUsername);

            return(new CreateRecurringPaymentsProfileResponseType(resp));
        }
示例#15
0
        public static String MakeECRecurringProfile(ShoppingCart cart, int orderNumber, String payPalToken, String payerID, DateTime nextRecurringShipDate)
        {
            PayPalAPISoapBinding   IPayPalRefund;
            PayPalAPIAASoapBinding IPayPal;

            PayPalController.GetPaypalRequirements(out IPayPalRefund, out IPayPal);
            String result = String.Empty;

            CreateRecurringPaymentsProfileReq                ECRecurringRequest  = new CreateRecurringPaymentsProfileReq();
            CreateRecurringPaymentsProfileRequestType        varECRequest        = new CreateRecurringPaymentsProfileRequestType();
            CreateRecurringPaymentsProfileRequestDetailsType varECRequestDetails = new CreateRecurringPaymentsProfileRequestDetailsType();
            CreateRecurringPaymentsProfileResponseType       ECRecurringResponse = new CreateRecurringPaymentsProfileResponseType();

            //Re-Use the Internal Gateway Recurring Billing logic for calculating how much of the order is recurring
            ShoppingCart cartRecur       = new ShoppingCart(cart.ThisCustomer.SkinID, cart.ThisCustomer, CartTypeEnum.RecurringCart, orderNumber, false);
            Decimal      CartTotalRecur  = Decimal.Round(cartRecur.Total(true), 2, MidpointRounding.AwayFromZero);
            Decimal      RecurringAmount = CartTotalRecur - CommonLogic.IIF(cartRecur.Coupon.CouponType == CouponTypeEnum.GiftCard, CommonLogic.IIF(CartTotalRecur < cartRecur.Coupon.DiscountAmount, CartTotalRecur, cartRecur.Coupon.DiscountAmount), 0);

            DateIntervalTypeEnum ecRecurringIntervalType = cartRecur.CartItems[0].RecurringIntervalType;                //We currently only support 1 interval per recurring order, so grabbing the first as a default should be safe
            int ecRecurringInterval = cartRecur.CartItems[0].RecurringInterval;

            BasicAmountType ecRecurringAmount = new BasicAmountType();

            ecRecurringAmount.currencyID = (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), AppLogic.AppConfig("Localization.StoreCurrency"), true);
            ecRecurringAmount.Value      = RecurringAmount.ToString();

            BillingPeriodDetailsType varECSchedulePaymentDetails = GetECRecurringPeriodDetails(ecRecurringIntervalType, ecRecurringInterval);

            varECSchedulePaymentDetails.Amount = ecRecurringAmount;
            varECSchedulePaymentDetails.TotalBillingCyclesSpecified = false;

            ScheduleDetailsType varECSchedule = new ScheduleDetailsType();

            //Need a better description, but it must match the one sent in StartEC
            varECSchedule.Description                        = "Recurring order created on " + System.DateTime.Now.ToShortDateString() + " from " + AppLogic.AppConfig("StoreName");
            varECSchedule.MaxFailedPayments                  = 0; //Cancel the order if a recurrence fails
            varECSchedule.MaxFailedPaymentsSpecified         = true;
            varECSchedule.AutoBillOutstandingAmount          = AutoBillType.NoAutoBill;
            varECSchedule.AutoBillOutstandingAmountSpecified = true;
            varECSchedule.PaymentPeriod                      = varECSchedulePaymentDetails;

            RecurringPaymentsProfileDetailsType varECProfileDetails = new RecurringPaymentsProfileDetailsType();

            varECProfileDetails.SubscriberName   = cart.ThisCustomer.FirstName + " " + cart.ThisCustomer.LastName;
            varECProfileDetails.BillingStartDate = nextRecurringShipDate;

            varECRequestDetails.ScheduleDetails = varECSchedule;
            varECRequestDetails.Token           = payPalToken;
            varECRequestDetails.RecurringPaymentsProfileDetails = varECProfileDetails;

            if (cart.IsAllDownloadComponents())
            {
                PaymentDetailsItemType varECPaymentDetails = new PaymentDetailsItemType();
                varECPaymentDetails.ItemCategory          = ItemCategoryType.Digital;
                varECPaymentDetails.ItemCategorySpecified = true;

                List <PaymentDetailsItemType> ECPaymentDetailsList = new List <PaymentDetailsItemType>();

                ECPaymentDetailsList.Add(varECPaymentDetails);

                varECRequestDetails.PaymentDetailsItem = ECPaymentDetailsList.ToArray();
            }

            varECRequest.Version = API_VER;
            varECRequest.CreateRecurringPaymentsProfileRequestDetails = varECRequestDetails;

            ECRecurringRequest.CreateRecurringPaymentsProfileRequest = varECRequest;

            ECRecurringResponse = IPayPal.CreateRecurringPaymentsProfile(ECRecurringRequest);

            if (ECRecurringResponse.Ack.ToString().StartsWith("success", StringComparison.InvariantCultureIgnoreCase))
            {
                result = AppLogic.ro_OK;
            }
            else
            {
                if (ECRecurringResponse.Errors != null)
                {
                    bool first = true;
                    for (int ix = 0; ix < ECRecurringResponse.Errors.Length; ix++)
                    {
                        if (!first)
                        {
                            result += ", ";
                        }
                        result += ECRecurringResponse.Errors[ix].LongMessage;
                        first   = false;
                    }
                }
            }

            //Log the transaction
            OrderTransactionCollection ecRecurringOrderTransaction = new OrderTransactionCollection(orderNumber);

            ecRecurringOrderTransaction.AddTransaction("PayPal Express Checkout Recurring Profile Creation",
                                                       ECRecurringRequest.ToString(),
                                                       result,
                                                       payerID,                                                                                                                                                                                       //PNREF = payerID
                                                       (ECRecurringResponse.CreateRecurringPaymentsProfileResponseDetails.ProfileID == null ? "No ProfileID provided" : ECRecurringResponse.CreateRecurringPaymentsProfileResponseDetails.ProfileID), //Code = ProfileID
                                                       AppLogic.ro_PMPayPalExpress,
                                                       null,
                                                       RecurringAmount);

            return(result);
        }
        /**
         * AUTO_GENERATED
         */
        public CreateRecurringPaymentsProfileResponseType CreateRecurringPaymentsProfile(CreateRecurringPaymentsProfileReq createRecurringPaymentsProfileReq, string apiUserName)
        {
            setStandardParams(createRecurringPaymentsProfileReq.CreateRecurringPaymentsProfileRequest);
            string      response    = Call("CreateRecurringPaymentsProfile", createRecurringPaymentsProfileReq.ToXMLString(), apiUserName);
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(response);
            XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='CreateRecurringPaymentsProfileResponse']");

            return(new CreateRecurringPaymentsProfileResponseType(xmlNode));
        }