Ejemplo n.º 1
0
    public string DoCaptureCode(string authorization_id, string amount)
    {
        CallerServices caller = new CallerServices();

        IAPIProfile profile = ProfileFactory.createSSLAPIProfile();

        profile.APIUsername     = "******";
        profile.APIPassword     = "******";
        profile.CertificateFile = @"~\MyTestCertificate.txt";
        profile.Environment     = "sandbox";
        caller.APIProfile       = profile;

        DoCaptureRequestType pp_request = new DoCaptureRequestType();

        pp_request.Version = "51.0";

        pp_request.AuthorizationID   = authorization_id;
        pp_request.Amount            = new BasicAmountType();
        pp_request.Amount.Value      = amount;
        pp_request.Amount.currencyID = CurrencyCodeType.GBP;
        pp_request.CompleteType      = CompleteCodeType.Complete;

        DoCaptureResponseType pp_response = new DoCaptureResponseType();

        pp_response = (DoCaptureResponseType)caller.Call("DoCapture", pp_request);
        return(pp_response.Ack.ToString());
    }
Ejemplo n.º 2
0
        public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string CertificateFile_Sig, string APISignature_Sig, string CertificateFile_Cer, string PrivateKeyPassword_Cer, string stage, string subject, bool is3token, bool isunipay)
        {
            if (is3token == true)
            {
                IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
                profile.APIUsername  = apiUsername;
                profile.APIPassword  = apiPassword;
                profile.Environment  = stage;
                profile.Subject      = subject;
                profile.APISignature = signature;
                return(profile);
            }
            //else if (Global.isunipay == true)
            else if (isunipay == true)
            {
                IAPIProfile profile = ProfileFactory.createUniPayAPIProfile();
                profile.getFirstPartyEmail = subject;
                profile.Environment        = stage;
                return(profile);
            }
            else
            {
                IAPIProfile profile = ProfileFactory.createSSLAPIProfile();
                profile.APIUsername        = apiUsername;
                profile.APIPassword        = apiPassword;
                profile.Environment        = stage;
                profile.CertificateFile    = CertificateFile_Cer;
                profile.PrivateKeyPassword = PrivateKeyPassword_Cer;
                profile.Subject            = subject;

                return(profile);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add new profile
        /// </summary>
        /// <param name="profileDTO"></param>
        /// <returns></returns>
        public void SaveProfileInformation(ProfileDTO profileDTO)
        {
            //if profileDTO data is not valid
            if (profileDTO == null)
            {
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);
            }

            //Create a new profile entity
            var newProfile = ProfileFactory.CreateProfile(profileDTO.FirstName, profileDTO.LastName, profileDTO.Email, "Anand", DateTime.Now, "Anand", DateTime.Now);

            //Save Profile
            newProfile = SaveProfile(newProfile);

            //if profileDTO contains any address
            if (profileDTO.AddressDTO != null)
            {
                foreach (AddressDTO objAddressDTO in profileDTO.AddressDTO)
                {
                    this.SaveAddress(objAddressDTO, newProfile);
                }
            }

            //if profileDTO contains any phone
            if (profileDTO.PhoneDTO != null)
            {
                foreach (PhoneDTO objPhoneDTO in profileDTO.PhoneDTO)
                {
                    this.SavePhone(objPhoneDTO, newProfile);
                }
            }
        }
Ejemplo n.º 4
0
        public ProfileCollectionVirtualise1()
        {
            profiles = this.WhenAnyValue(a => a.Value).Select(GetProfiles).ToProperty(this, a => a.Profiles);

            IList <Profile> GetProfiles(int i)
            {
                var ProfilePool = ProfileFactory.BuildPool();

                return(DataVirtualizingCollectionBuilder
                       .Build <Profile>(i, RxApp.MainThreadScheduler)
                       .NonPreloading()
                       .Hoarding()
                       .NonTaskBasedFetchers(
                           (offset, pageSize) =>
                {
                    Console.WriteLine($"{nameof(Profiles)}: Loading page with offset {offset}");
                    var range = Enumerable.Range(offset, pageSize).Select(i => ProfilePool[i % ProfilePool.Count]).ToArray();
                    return range;
                },
                           () =>
                {
                    Console.WriteLine($"{nameof(Profiles)}: Loading count");
                    return 420420;
                })
                       .AsyncIndexAccess((_, __) => new Profile()));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Add new profile
        /// </summary>
        /// <param name="profileDTO"></param>
        public void SaveProfileInformation(ProfileDTO profileDTO)
        {
            if (profileDTO == null)
            {
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);
            }

            var newProfile = ProfileFactory.CreateProfile(profileDTO.FirstName, profileDTO.LastName, profileDTO.Email, "Anand", DateTime.Now, "Anand", DateTime.Now);

            newProfile = SaveProfile(newProfile);

            if (profileDTO.AddressDTO != null && profileDTO.AddressDTO.Any())
            {
                foreach (AddressDTO address in profileDTO.AddressDTO)
                {
                    this.SaveAddress(address, newProfile);
                }
            }

            if (profileDTO.PhoneDTO != null && profileDTO.PhoneDTO.Any())
            {
                foreach (PhoneDTO phone in profileDTO.PhoneDTO)
                {
                    this.SavePhone(phone, newProfile);
                }
            }
        }
Ejemplo n.º 6
0
        private static IAPIProfile CreateAPIProfile(string PayPalUserName, string PayPalPassword, string PayPalSignature,
                                                    string subject, string mode)
        {
            try
            {
                var profile = ProfileFactory.createSignatureAPIProfile();

                if (profile != null)
                {
                    profile.Environment = mode;

                    EventLog.LogEvent("PayPal Express Get Api", "Getting Environment " + mode,
                                      EventLogSeverity.Information);

                    profile.APIUsername  = PayPalUserName;
                    profile.APIPassword  = PayPalPassword;
                    profile.APISignature = PayPalSignature;
                    profile.Subject      = subject;
                }
                else
                {
                    EventLog.LogEvent("Paypal API",
                                      "Paypal com.paypal.sdk.profiles.ProfileFactory.CreateAPIProfile has failed.",
                                      EventLogSeverity.Error);
                }
                return(profile);
            }
            catch (Exception ex)
            {
                EventLog.LogEvent("PayPal Utilities", ex.Message + " | " + ex.StackTrace, EventLogSeverity.Warning);
            }
            return(null);
        }
Ejemplo n.º 7
0
        public string GetBalanceCode()
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "GetBalance";
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
        public static NVPCallerServices PayPalAPIInitialize(bool isDev)
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            if (isDev)
            {
                profile.APIUsername  = DEV_API_USERNAME;
                profile.APIPassword  = DEV_API_PASSWORD;
                profile.Environment  = DEV_ENVIRONMENT;
                profile.Subject      = String.Empty;
                profile.APISignature = DEV_API_SIGNATURE;
            }
            else
            {
                profile.APIUsername  = API_USERNAME;
                profile.APIPassword  = API_PASSWORD;
                profile.Environment  = ENVIRONMENT;
                profile.Subject      = String.Empty;
                profile.APISignature = API_SIGNATURE;
            }


            NVPCallerServices caller = new NVPCallerServices();

            caller.APIProfile = profile;

            return(caller);
        }
Ejemplo n.º 9
0
        public List <ProfileModel> GetAllProfiles()
        {
            List <ProfileModel> profiles = new List <ProfileModel>();

            using (SQLiteConnection db = new SQLiteConnection(dbArgs))
            {
                db.Open();

                using (SQLiteDataReader reader = new SQLiteCommand("SELECT * from profiles", db).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        profiles.Add(ProfileFactory.NewProfileModel(
                                         reader.GetInt32(0),
                                         reader.GetString(1),
                                         reader.GetInt32(2),
                                         reader.GetString(3),
                                         reader.GetInt32(4)));
                    }
                    reader.Close();
                }

                db.Close();
            }

            return(profiles);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 使用UserId获得KYC服务器地址
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private ProfileRouter QueryKYCRouter(Guid?id)
        {
            var dac         = new UserAccountDAC();
            var userAccount = dac.GetById(id.Value);

            return(ProfileFactory.GetByCountryId(userAccount.CountryId));
        }
        public NVPCodec ECDoExpressCheckoutCode(string token, string payerID, string amount, string paymentType, string currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
            {
                profile.APIUsername  = "******";
                profile.APIPassword  = "******";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment  = "sandbox";
            }
            else if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "L")
            {
                profile.APIUsername  = "******";
                profile.APIPassword  = "******";
                profile.APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31Ab5GxWPc-1XSb8rJctwNCFHIYb84";
                profile.Environment  = "live";
            }
            else
            {
                profile.APIUsername  = "******";
                profile.APIPassword  = "******";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment  = "sandbox";
            }
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "65.1";
            encoder["METHOD"]  = "DoExpressCheckoutPayment";

            // Add request-specific fields to the request.
            // Pass the token returned in SetExpressCheckout.
            encoder["TOKEN"]         = token;
            encoder["PAYERID"]       = payerID;
            encoder["AMT"]           = amount;
            encoder["PAYMENTACTION"] = paymentType;
            encoder["CURRENCYCODE"]  = currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Tests the API by loading the input file, saving it to memory and comparing it to the wished result file.
        /// </summary>
        /// <param name="inFile">The file to load and save.</param>
        /// <param name="resultFile">The file to compare to.</param>
        private static void DoLoadSaveTest(string inFile, string resultFile)
        {
            MadCatzProfile profile = ProfileFactory.Load(inFile);

            byte[] data = null;
            using (var stream = new MemoryStream())
            {
                ProfileFactory.Save(stream, profile);
                data = stream.GetBuffer();
            }

            StreamReader writtenReader = null;
            MemoryStream memStream     = null;
            string       written       = null;

            try
            {
                memStream     = new MemoryStream(data);
                writtenReader = new StreamReader(memStream);
                written       = writtenReader.ReadToEnd().Trim().Replace("\0", string.Empty);
                writtenReader.Close();
                writtenReader = null;
                memStream     = null;
            }
            finally
            {
                if (writtenReader != null)
                {
                    writtenReader.Close();
                    writtenReader = null;
                    memStream     = null;
                }
                if (memStream != null)
                {
                    memStream.Close();
                }
            }

            StreamReader originalReader = null;
            string       original       = null;

            try
            {
                originalReader = new StreamReader(resultFile);
                original       = originalReader.ReadToEnd().Trim();
                originalReader.Close();
                originalReader = null;
            }
            finally
            {
                if (originalReader != null)
                {
                    originalReader.Close();
                }
            }

            Assert.AreEqual(original, written);
        }
Ejemplo n.º 13
0
        public void CreateFromFactory()
        {
            IProfileProvider dbProfile = ProfileFactory.GetProfileProvider("MyDbProfile1");

            dbProfile.SetProfile(this.ident, "test123");
            string result = dbProfile.GetProfile(this.ident).ToString();

            Assert.AreEqual("test123", result);
        }
Ejemplo n.º 14
0
        public string MassPayCode(string emailSubject, string receiverType, string currencyCode, string ReceiverEmail0, string amount0, string UniqueID0, string Note0, string ReceiverEmail1, string amount1, string UniqueID1, string Note1)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "MassPay";

            // Add request-specific fields to the request.
            encoder["EMAILSUBJECT"] = emailSubject;
            encoder["RECEIVERTYPE"] = receiverType;
            encoder["CURRENCYCODE"] = currencyCode;

            if (ReceiverEmail0.Length > 0)
            {
                encoder["L_EMAIL0"]    = ReceiverEmail0;
                encoder["L_Amt0"]      = amount0;
                encoder["L_UNIQUEID0"] = UniqueID0;
                encoder["L_NOTE0"]     = Note0;
            }

            if (ReceiverEmail1.Length > 0)
            {
                encoder["L_EMAIL1"]    = ReceiverEmail1;
                encoder["L_Amt1"]      = amount1;
                encoder["L_UNIQUEID1"] = UniqueID1;
                encoder["L_NOTE1"]     = Note1;
            }



            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
Ejemplo n.º 15
0
        public Hashtable DoDirectPaymentCode()
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = Constants.PayPal_Username;       //"sdk-three_api1.sdk.com";
            profile.APIPassword  = Constants.PayPal_Password;       //"QFZCWN5HZM8VBG7Q";
            profile.APISignature = Constants.PayPal_Signature;      //"AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = Constants.PayPal_PaymentAccount; //"live";// "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "DoDirectPayment";

            // Add request-specific fields to the request.
            encoder["PAYMENTACTION"]  = "Sale"; //paymentAction;
            encoder["AMT"]            = fPaymentOrderTotal.ToString();
            encoder["CREDITCARDTYPE"] = (sCCType.Equals(CreditCardType.AmericanExpress)) ? "Amex" : sCCType.ToString();
            encoder["ACCT"]           = CCNumber;
            encoder["EXPDATE"]        = sCCExpDate;
            encoder["CVV2"]           = sCCVerificationCode;
            encoder["FIRSTNAME"]      = sCCOwnerFirstName;
            encoder["LASTNAME"]       = sCCOwnerLastName;
            encoder["STREET"]         = (sCCOwnerStreet2.Trim().Length > 0) ? string.Concat(sCCOwnerStreet1, ", ", sCCOwnerStreet2) : sCCOwnerStreet1;
            encoder["CITY"]           = sCCOwnerCityName;
            encoder["STATE"]          = sCCOwnerStateOrProvince;
            encoder["ZIP"]            = sCCOwnerPostalCode;
            encoder["COUNTRYCODE"]    = sCCOwnerCountryCode;
            encoder["CURRENCYCODE"]   = "USD";

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);

            Hashtable htResult = new Hashtable();

            foreach (string st in decoder.AllKeys)
            {
                htResult.Add(st, decoder[st]);
            }
            return(htResult);
        }
Ejemplo n.º 16
0
        public void CorruptVersionTest()
        {
            var report = new TestReport();

            ProfileFactory.Load(TestConstants.CORRUPTED_TESTDATA_DIR + "CorruptVersion.pr0", report);
            report.AssertEquals(
                new List <string>(),
                new List <string>(),
                new List <string>(new string[] { "Unsupported version: 6" }));
        }
Ejemplo n.º 17
0
        public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string environment)
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = apiUsername;
            profile.APIPassword  = apiPassword;
            profile.APISignature = signature;
            profile.Environment  = environment;
            return(profile);
        }
Ejemplo n.º 18
0
        public void SaveProfile(MadCatzProfile profile)
        {
            if (!HasSaveFile(profile))
            {
                throw new InvalidOperationException("Can't save the profile: there is no save location available.");
            }

            ProfileFactory.Save(profileInfos[profile].ProfileFile, profile);
            profileInfos[profile].Edited = false;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 初始化APIProfile
        /// </summary>
        /// <returns></returns>
        private static IAPIProfile CreateProfile()
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = ConfigurationManager.AppSettings["APIUserName"];
            profile.APIPassword  = ConfigurationManager.AppSettings["APIPassword"];
            profile.APISignature = ConfigurationManager.AppSettings["APISinature"];
            profile.Environment  = ConfigurationManager.AppSettings["Environment"];
            profile.Subject      = "";
            return(profile);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 初始化APIProfile
        /// </summary>
        /// <returns></returns>
        private static IAPIProfile CreateProfile()
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PalPalUserName");
            profile.APIPassword  = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayPalPassword");
            profile.APISignature = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayPalSinature");
            profile.Environment  = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayPalEnvenment");
            profile.Subject      = "";
            return(profile);
        }
Ejemplo n.º 21
0
 void Main()
 {
     ProfileFactory[] objFactories = new ProfileFactory[2];
     objFactories[0] = new concreteFactoryforProfile1();
     objFactories[1] = new concreteFactoryforProfile2();
     foreach (ProfileFactory objFactory in objFactories)
     {
         IProfile objProfile = objFactory.GetProfile(this.Page);
         Page     p          = objProfile.Page;
     }
 }
Ejemplo n.º 22
0
        public ProfileCollectionTimed()
        {
            var pool = ProfileFactory.BuildPool();

            _ = Observable.Interval(TimeSpan.FromSeconds(_speed))
                .ObserveOnDispatcher()
                .Select(a => pool.Random())
                .ToObservableChangeSet()
                .Sort(new comparer())
                .Bind(out profiles).Subscribe();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 初始化APIProfile
        /// </summary>
        /// <returns></returns>
        private IAPIProfile CreateProfile()
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = base.CurrentSiteSetting.PayPalAPIAccountName;     // Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalAPIAccountName");
            profile.APIPassword  = base.CurrentSiteSetting.PayPalAPIAccountPassword; //Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalAPIAccountPassword");
            profile.APISignature = base.CurrentSiteSetting.PayPalAPISignature;       //Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalAPISignature");
            profile.Environment  = base.CurrentSiteSetting.PayPalEnvenment;          //Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalEnvenment");
            profile.Subject      = "";
            return(profile);
        }
Ejemplo n.º 24
0
    public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string CertificateFile_Cer, string PrivateKeyPassword_Cer)
    {
        IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

        profile.APIUsername = apiUsername;
        profile.APIPassword = apiPassword;
        profile.Environment = Constants.ENVIRONMENT;

        profile.Subject      = string.Empty;
        profile.APISignature = signature;
        return(profile);
    }
Ejemplo n.º 25
0
        public void Apply()
        {
            var group = new Group(ProfileName);
            var wps   = ProfileFactory.CreateWithFixedStep(StartPoint, LengthMeters, StepMeters, AngleDeg / 180.0 * Math.PI, SelectedNamingScheme.GetWaypointName);

            wps.ForEach(p => {
                WaypointsService.Waypoints.Add(p);
                group.Children.Add(p);
            });

            GroupsService.Groups.Add(group);
        }
Ejemplo n.º 26
0
        public void Build(List <Waypoint> points)
        {
            var group = new ProfileGroup(ProfileName);
            var wps   = ProfileFactory.CreateWithFixedStep(points, StepMeters, SelectedNamingScheme.GetWaypointName);

            wps.ForEach(p => {
                WaypointsService.Waypoints.Add(p);
                group.Children.Add(p);
            });

            GroupsService.Groups.Add(group);
        }
Ejemplo n.º 27
0
        public string CreateRecurringPaymentsProfileCode(string token, DateTime date, string amount, int BF, BillingPeriodType BP, CurrencyCodeType currencyCodeType)
        {
            CallerServices caller = new CallerServices();

            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, and API version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AsaWhdg.F1DEJUmkrAOGADAhmx2zAhz6qMKqOp5lTasZcyA1TAVoQrzO";
            profile.Environment  = "live";

            caller.APIProfile = profile;

            // Create the request object.



            CreateRecurringPaymentsProfileRequestType pp_request = new CreateRecurringPaymentsProfileRequestType();

            pp_request.Version = "51.0";



            // Add request-specific fields to the request.
            pp_request.CreateRecurringPaymentsProfileRequestDetails       = new CreateRecurringPaymentsProfileRequestDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.Token = "";
            pp_request.CreateRecurringPaymentsProfileRequestDetails.RecurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.RecurringPaymentsProfileDetails.BillingStartDate = date;
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails = new ScheduleDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod                   = new BillingPeriodDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.Amount            = new BasicAmountType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.Amount.Value      = amount;
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.Amount.currencyID = currencyCodeType; //Enum for currency code is  CurrencyCodeType.USD
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.BillingFrequency  = BF;
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.BillingPeriod     = BP;               ////Enum for BillingPeriod is  BillingPeriodType.Day

            // Execute the API operation and obtain the response.
            CreateRecurringPaymentsProfileResponseType pp_response = new CreateRecurringPaymentsProfileResponseType();

            pp_response = (CreateRecurringPaymentsProfileResponseType)caller.Call("CreateRecurringPaymentsProfile", pp_request);
            return(pp_response.Errors[0].LongMessage);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Add new profile
        /// </summary>
        /// <param name="profileDTO"></param>
        /// <returns></returns>
        public void SaveProfileInformation(ProfileDTO profileDTO)
        {
            //if profileDTO data is not valid
            if (profileDTO == null)
            {
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);
            }

            //Create a new profile entity
            var newProfile = ProfileFactory.CreateProfile(profileDTO.FirstName, profileDTO.LastName, profileDTO.Email, profileDTO.Status, "Namdeo Jadhav", DateTime.Now, "Namdeo Jadhav", DateTime.Now);

            //Save Profile
            newProfile = SaveProfile(newProfile);
        }
Ejemplo n.º 29
0
        public string DoDirectPaymentCode(string paymentAction, string amount, string creditCardType, string creditCardNumber, string expdate_month, string cvv2Number, string firstName, string lastName, string address1, string city, string state, string zip, string countryCode, string currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";                //"sdk-three_api1.sdk.com";
            profile.APIPassword  = "******";                                               //"QFZCWN5HZM8VBG7Q";
            profile.APISignature = "Aodyho-T1mAnue23UgKnw1JPD8E9AnPQgwCa26tyq818j5Kv.mh7AdxZ"; //"AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "DoDirectPayment";

            // Add request-specific fields to the request.
            encoder["PAYMENTACTION"]  = paymentAction;
            encoder["AMT"]            = amount;
            encoder["CREDITCARDTYPE"] = creditCardType;
            encoder["ACCT"]           = creditCardNumber;
            encoder["EXPDATE"]        = expdate_month;
            encoder["CVV2"]           = cvv2Number;
            encoder["FIRSTNAME"]      = firstName;
            encoder["LASTNAME"]       = lastName;
            encoder["STREET"]         = address1;
            encoder["CITY"]           = city;
            encoder["STATE"]          = state;
            encoder["ZIP"]            = zip;
            encoder["COUNTRYCODE"]    = countryCode;
            encoder["CURRENCYCODE"]   = currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
Ejemplo n.º 30
0
        public bool AddMerchant(MerchantProfile profile)
        {
            var server = ProfileFactory.GetByCountryId(profile.Country);

            if (server == null)
            {
                throw new InvalidProfileServiceException();
            }
            else
            {
                MerchantProfileRPC dac = new MerchantProfileRPC(server);
                return(dac.Insert(profile));
            }
        }