Esempio n. 1
0
        static PPHelper()
        {
            NSMutableDictionary dict = null;

            //if (AppData.Instance.PaypalConfig.Environment.Contains("live"))
            //{
            //    dict = new NSMutableDictionary
            //    {
            //        {Xamarin.PayPal.iOS.Constants.PayPalEnvironmentProduction, new NSString("clientId")}
            //    };
            //}
            //else
            //{
            dict = new NSMutableDictionary
            {
                {
                    Constants.PayPalEnvironmentSandbox, new NSString("ASI_ZzQqUEU_v5QFwOeMxb2d03doX0qOLxCmtYNbxuNfmpFn_cZaHdJpVP_jiJ_ZAUsEK_jgjr6kIcnL")
                }
            };
            //}

            PayPalMobile.InitializeWithClientIdsForEnvironments(dict);


            Config = new PayPalConfiguration
            {
                AcceptCreditCards           = true,
                MerchantName                = "Stadium",
                MerchantPrivacyPolicyURL    = new NSUrl("https://www.example.com/privacy"),
                MerchantUserAgreementURL    = new NSUrl("https://www.example.com/legal"),
                LanguageOrLocale            = NSLocale.PreferredLanguages[0],
                PayPalShippingAddressOption = PayPalShippingAddressOption.Provided
            };
        }
Esempio n. 2
0
        public static void Prepare()
        {
            //if (AppData.Instance.PaypalConfig.Environment.Contains("live"))
            //    PayPalMobile.PreconnectWithEnvironment(Xam.PayPal.iOS.Constants.PayPalEnvironmentProduction);
            //else
            PayPalMobile.PreconnectWithEnvironment(Constants.PayPalEnvironmentSandbox);

            CardIOUtilities.Preload();
        }
        public void InitializeService(PayPalClientSettings payPalSettings)
        {
            PayPalMobile.WithClientIds(
                (NSString)payPalSettings.Credentials.ClientId,
                (NSString)payPalSettings.SandboxCredentials.ClientId);

            PayPalMobile.PreconnectWithEnvironment(payPalSettings.IsSandbox
                ? PayPalMobile.PayPalEnvironmentSandbox
                : PayPalMobile.PayPalEnvironmentProduction);
        }
Esempio n. 4
0
 partial void actFuturePaymentPurchase(NSObject sender)
 {
     // Display activity indicator...
     UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
     try
     {
         var correlationId = PayPalMobile.ApplicationCorrelationIDForEnvironment(Environment);
         var msg           = string.Format("Correlation Id for this pre-authorized purchase: {0}\n\nSend correlationId and transaction details to your server for processing with PayPal.", correlationId);
         (new UIAlertView("Future Purchase", msg, null, "Ok")).Show();
     }
     finally
     {
         UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
     }
 }
        /*public void PayPalPaymentDidCancel (PayPalPaymentViewController paymentViewController)
         * {
         *      throw new NotImplementedException ();
         * }
         * public void PayPalPaymentViewController (PayPalPaymentViewController paymentViewController, PayPalPayment completedPayment)
         * {
         *      throw new NotImplementedException ();
         * }*/

        #endregion

        public PayPalManager(string environmentProduction, string environmentSandbox)
        {
            PayPalMobile.InitializeWithClientIdsForEnvironments(NSDictionary.FromObjectsAndKeys(
                                                                    new NSObject[] {
                new NSString(environmentProduction),
                new NSString(environmentSandbox)
            }, new NSObject[] {
                Constants.PayPalEnvironmentProduction,
                Constants.PayPalEnvironmentSandbox
            }
                                                                    ));
            Environment       = Constants.PayPalEnvironmentNoNetwork.ToString();
            _payPalConfig     = new PayPalConfiguration();
            AcceptCreditCards = true;
            // Set up payPalConfig
            _payPalConfig.MerchantName                = "Awesome Shirts, Inc.";
            _payPalConfig.MerchantPrivacyPolicyURL    = new NSUrl("https://www.paypal.com/webapps/mpp/ua/privacy-full");
            _payPalConfig.MerchantUserAgreementURL    = new NSUrl("https://www.paypal.com/webapps/mpp/ua/useragreement-full");
            _payPalConfig.LanguageOrLocale            = NSLocale.PreferredLanguages [0];
            _payPalConfig.PayPalShippingAddressOption = PayPalShippingAddressOption.PayPal;

            Debug.WriteLine("PayPal iOS SDK Version: " + PayPalMobile.LibraryVersion);
        }
Esempio n. 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "PayPal iOS Library Demo";

            // Initialize PayPal
            PayPalMobile.WithClientIds(_productionPayPalClientId, _sandboxPayPalClientId);

            _payPalConfig = new PayPalConfiguration
            {
                AcceptCreditCards        = AcceptCreditCards,
                LanguageOrLocale         = "en",
                MerchantName             = @"Awesome Shirts, Inc.",
                MerchantPrivacyPolicyURL = new NSUrl(@"https://www.paypal.com/webapps/mpp/ua/privacy-full"),
                MerchantUserAgreementURL = new NSUrl(@"https://www.paypal.com/webapps/mpp/ua/useragreement-full")
            };

            successView.Hidden = true;

            Environment = _environment;
            Debug.WriteLine("PayPal iOS SDK version: {0}", PayPalMobile.LibraryVersion);
        }
Esempio n. 7
0
        public PayPalManager(PayPal.Forms.Abstractions.PayPalConfiguration xfconfig)
        {
            NSString key   = null;
            NSString value = new NSString(xfconfig.PayPalKey);
            string   env   = string.Empty;

            switch (xfconfig.Environment)
            {
            case PayPal.Forms.Abstractions.Enum.PayPalEnvironment.NoNetwork:
                key = Constants.PayPalEnvironmentNoNetwork;
                env = Constants.PayPalEnvironmentNoNetwork.ToString();
                break;

            case PayPal.Forms.Abstractions.Enum.PayPalEnvironment.Production:
                key = Constants.PayPalEnvironmentProduction;
                env = Constants.PayPalEnvironmentProduction.ToString();
                break;

            case PayPal.Forms.Abstractions.Enum.PayPalEnvironment.Sandbox:
                key = Constants.PayPalEnvironmentSandbox;
                env = Constants.PayPalEnvironmentSandbox.ToString();
                break;
            }

            PayPalMobile.InitializeWithClientIdsForEnvironments(NSDictionary.FromObjectsAndKeys(
                                                                    new NSObject[] {
                value,
                value,
                value
            }, new NSObject[] {
                key,
                Constants.PayPalEnvironmentProduction,
                Constants.PayPalEnvironmentSandbox
            }
                                                                    ));

            Environment = env;

            _payPalConfig     = new PayPalConfiguration();
            AcceptCreditCards = xfconfig.AcceptCreditCards;

            _payPalConfig.MerchantName             = xfconfig.MerchantName;
            _payPalConfig.MerchantPrivacyPolicyURL = new NSUrl(xfconfig.MerchantPrivacyPolicyUri);
            _payPalConfig.MerchantUserAgreementURL = new NSUrl(xfconfig.MerchantUserAgreementUri);
            _payPalConfig.LanguageOrLocale         = xfconfig.Language ?? NSLocale.PreferredLanguages[0];
            if (!String.IsNullOrEmpty(xfconfig.PhoneCountryCode))
            {
                _payPalConfig.DefaultUserPhoneCountryCode = xfconfig.PhoneCountryCode;
            }


            switch (xfconfig.ShippingAddressOption)
            {
            case Abstractions.Enum.ShippingAddressOption.Both:
                _payPalConfig.PayPalShippingAddressOption = PayPalShippingAddressOption.Both;
                break;

            case Abstractions.Enum.ShippingAddressOption.None:
                _payPalConfig.PayPalShippingAddressOption = PayPalShippingAddressOption.None;
                break;

            case Abstractions.Enum.ShippingAddressOption.PayPal:
                _payPalConfig.PayPalShippingAddressOption = PayPalShippingAddressOption.PayPal;
                break;

            case Abstractions.Enum.ShippingAddressOption.Provided:
                _payPalConfig.PayPalShippingAddressOption = PayPalShippingAddressOption.Provided;
                break;
            }

            Debug.WriteLine("PayPal iOS SDK Version: " + PayPalMobile.LibraryVersion);
        }
 public void PreconnectWithEnvironment(string enviroment)
 {
     PayPalMobile.PreconnectWithEnvironment(enviroment);
 }
Esempio n. 9
0
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(true);
     PayPalMobile.PreconnectWithEnvironment(Environment);
 }