private void CreateAndAddWalletFragment() {
            var walletFragmentStyle = new WalletFragmentStyle()
                .SetMaskedWalletDetailsTextAppearance (
                    Resource.Style.BikestoreWalletFragmentDetailsTextAppearance)
                .SetMaskedWalletDetailsHeaderTextAppearance (
                    Resource.Style.BikestoreWalletFragmentDetailsHeaderTextAppearance)
                .SetMaskedWalletDetailsBackgroundColor(
                    Resources.GetColor (Resource.Color.bikestore_white))
                .SetMaskedWalletDetailsButtonBackgroundResource(
                    Resource.Drawable.bikestore_btn_default_holo_light);

            var walletFragmentOptions = WalletFragmentOptions.NewBuilder ()
                .SetEnvironment (Constants.WALLET_ENVIRONMENT)
                .SetFragmentStyle (walletFragmentStyle)
                .SetTheme (WalletConstants.ThemeLight)
                .SetMode (WalletFragmentMode.SelectionDetails)
                .Build ();
            mWalletFragment = SupportWalletFragment.NewInstance (walletFragmentOptions);

            // Now initialize the Wallet Fragment
            var accountName = ((BikestoreApplication) Application).AccountName;

            var startParamsBuilder = WalletFragmentInitParams.NewBuilder ()
                .SetMaskedWallet (mMaskedWallet)
                .SetMaskedWalletRequestCode (REQUEST_CODE_CHANGE_MASKED_WALLET)
                .SetAccountName (accountName);
            mWalletFragment.Initialize (startParamsBuilder.Build ());

            // add Wallet fragment to the UI
            SupportFragmentManager.BeginTransaction ()
                .Replace (Resource.Id.dynamic_wallet_masked_wallet_fragment, mWalletFragment)
                .Commit ();
        }
        void CreateWalletFragment()
        {
            var walletStyle = new WalletFragmentStyle()
                              .SetBuyButtonText(WalletFragmentStyle.BuyButtonText.LogoOnly)
                              .SetBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.AndroidPayLightWithBorder)
                              .SetBuyButtonWidth(WalletFragmentStyle.Dimension.MatchParent);

            var options = WalletFragmentOptions.NewBuilder()
                          .SetEnvironment(WalletEnvironment)
                          .SetTheme(WalletConstants.ThemeDark)
                          .SetFragmentStyle(walletStyle)
                          .SetMode(WalletFragmentMode.BuyButton)
                          .Build();

            var parameters = PaymentMethodTokenizationParameters.NewBuilder()
                             .SetPaymentMethodTokenizationType(PaymentMethodTokenizationType.NetworkToken)
                             .AddParameter("publicKey", Resources.GetString(Resource.String.public_key))
                             .Build();

            _walletFragment = SupportWalletFragment.NewInstance(options);

            var walletRequest = Android.Gms.Wallet.MaskedWalletRequest.NewBuilder()
                                .SetMerchantName(Resources.GetString(Resource.String.app_name))
                                .SetCurrencyCode(_judo.Currency)
                                .SetEstimatedTotalPrice(_judo.Amount.ToString())
                                .SetPaymentMethodTokenizationParameters(parameters)
                                .SetCart(Cart.NewBuilder()
                                         .SetCurrencyCode(_judo.Currency)
                                         .SetTotalPrice(_judo.Amount.ToString())
                                         .Build())
                                .Build();

            var startParams = WalletFragmentInitParams.NewBuilder()
                              .SetMaskedWalletRequest(walletRequest)
                              .SetMaskedWalletRequestCode(MaskedWalletRequest)
                              .Build();

            _walletFragment.Initialize(startParams);

            SupportFragmentManager.BeginTransaction()
            .Add(Resource.Id.container, _walletFragment)
            .Commit();
        }
        private void createAndAddWalletFragment()
        {
            var walletFragmentStyle = new WalletFragmentStyle()
                                      .SetBuyButtonText(BuyButtonText.BuyWithGoogle)
                                      .SetBuyButtonAppearance(BuyButtonAppearance.Classic)
                                      .SetBuyButtonWidth(Dimension.MatchParent);

            var walletFragmentOptions = WalletFragmentOptions.NewBuilder()
                                        .SetEnvironment(Constants.WALLET_ENVIRONMENT)
                                        .SetFragmentStyle(walletFragmentStyle)
                                        .SetTheme(WalletConstants.ThemeLight)
                                        .SetMode(WalletFragmentMode.BuyButton)
                                        .Build();

            mWalletFragment = SupportWalletFragment.NewInstance(walletFragmentOptions);

            // Now initialize the Wallet Fragment
            var accountName = ((BikestoreApplication)Application).AccountName;
            MaskedWalletRequest maskedWalletRequest;

            if (mPaymentMethodParameters != null)
            {
                maskedWalletRequest = WalletUtil.CreateStripeMaskedWalletRequest(Constants.ITEMS_FOR_SALE[mItemId],
                                                                                 mPaymentMethodParameters);
            }
            else
            {
                maskedWalletRequest = WalletUtil.CreateMaskedWalletRequest(Constants.ITEMS_FOR_SALE[mItemId]);
            }

            var startParamsBuilder = WalletFragmentInitParams.NewBuilder()
                                     .SetMaskedWalletRequest(maskedWalletRequest)
                                     .SetMaskedWalletRequestCode(REQUEST_CODE_MASKED_WALLET)
                                     .SetAccountName(accountName);

            mWalletFragment.Initialize(startParamsBuilder.Build());

            // add Wallet fragment to the UI
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.dynamic_wallet_button_fragment, mWalletFragment)
            .Commit();
        }
Exemple #4
0
        private void CreateAndAddWalletFragment()
        {
            var walletFragmentStyle = new WalletFragmentStyle()
                                      .SetMaskedWalletDetailsTextAppearance(
                Resource.Style.BikestoreWalletFragmentDetailsTextAppearance)
                                      .SetMaskedWalletDetailsHeaderTextAppearance(
                Resource.Style.BikestoreWalletFragmentDetailsHeaderTextAppearance)
                                      .SetMaskedWalletDetailsBackgroundColor(
                Resources.GetColor(Resource.Color.bikestore_white))
                                      .SetMaskedWalletDetailsButtonBackgroundResource(
                Resource.Drawable.bikestore_btn_default_holo_light);

            var walletFragmentOptions = WalletFragmentOptions.NewBuilder()
                                        .SetEnvironment(Constants.WALLET_ENVIRONMENT)
                                        .SetFragmentStyle(walletFragmentStyle)
                                        .SetTheme(WalletConstants.ThemeLight)
                                        .SetMode(WalletFragmentMode.SelectionDetails)
                                        .Build();

            mWalletFragment = SupportWalletFragment.NewInstance(walletFragmentOptions);

            // Now initialize the Wallet Fragment
            var accountName = ((BikestoreApplication)Application).AccountName;

            var startParamsBuilder = WalletFragmentInitParams.NewBuilder()
                                     .SetMaskedWallet(mMaskedWallet)
                                     .SetMaskedWalletRequestCode(REQUEST_CODE_CHANGE_MASKED_WALLET)
                                     .SetAccountName(accountName);

            mWalletFragment.Initialize(startParamsBuilder.Build());

            // add Wallet fragment to the UI
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.dynamic_wallet_masked_wallet_fragment, mWalletFragment)
            .Commit();
        }
		void CreateWalletFragment()
		{
			var walletStyle = new WalletFragmentStyle()
				.SetBuyButtonText(WalletFragmentStyle.BuyButtonText.LogoOnly)
				.SetBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.AndroidPayLightWithBorder)
				.SetBuyButtonWidth(WalletFragmentStyle.Dimension.MatchParent);

			var options = WalletFragmentOptions.NewBuilder()
											   .SetEnvironment(WalletEnvironment)
											   .SetTheme(WalletConstants.ThemeDark)
											   .SetFragmentStyle(walletStyle)
											   .SetMode(WalletFragmentMode.BuyButton)
											   .Build();

			var parameters = PaymentMethodTokenizationParameters.NewBuilder()
																.SetPaymentMethodTokenizationType(PaymentMethodTokenizationType.NetworkToken)
																.AddParameter("publicKey", Resources.GetString(Resource.String.public_key))
																.Build();

			_walletFragment = SupportWalletFragment.NewInstance(options);

			var walletRequest = Android.Gms.Wallet.MaskedWalletRequest.NewBuilder()
												   .SetMerchantName(Resources.GetString(Resource.String.app_name))
			                           .SetCurrencyCode(_judo.Currency)
			                           .SetEstimatedTotalPrice(_judo.Amount.ToString())
												   .SetPaymentMethodTokenizationParameters(parameters)
												   .SetCart(Cart.NewBuilder()
			                                                .SetCurrencyCode(_judo.Currency)
			                                                .SetTotalPrice(_judo.Amount.ToString())
															.Build())
													.Build();

			var startParams = WalletFragmentInitParams.NewBuilder()
					.SetMaskedWalletRequest(walletRequest)
					.SetMaskedWalletRequestCode(MaskedWalletRequest)
					.Build();

			_walletFragment.Initialize(startParams);

			SupportFragmentManager.BeginTransaction()
				.Add(Resource.Id.container, _walletFragment)
				.Commit();
		}
        private void createAndAddWalletFragment() {
            var walletFragmentStyle = new WalletFragmentStyle ()
                .SetBuyButtonText (BuyButtonText.BuyWithGoogle)
                .SetBuyButtonAppearance (BuyButtonAppearance.Classic)
                .SetBuyButtonWidth(Dimension.MatchParent);

            var walletFragmentOptions = WalletFragmentOptions.NewBuilder ()
                .SetEnvironment (Constants.WALLET_ENVIRONMENT)
                .SetFragmentStyle (walletFragmentStyle)
                .SetTheme (WalletConstants.ThemeLight)
                .SetMode (WalletFragmentMode.BuyButton)
                .Build();
            mWalletFragment = SupportWalletFragment.NewInstance (walletFragmentOptions);

            // Now initialize the Wallet Fragment
            var accountName = ((BikestoreApplication) Application).AccountName;
            MaskedWalletRequest maskedWalletRequest;
            if (mPaymentMethodParameters != null) {
                maskedWalletRequest = WalletUtil.CreateStripeMaskedWalletRequest (Constants.ITEMS_FOR_SALE[mItemId],
                    mPaymentMethodParameters);
            } else {
                maskedWalletRequest = WalletUtil.CreateMaskedWalletRequest (Constants.ITEMS_FOR_SALE[mItemId]);
            }

            var startParamsBuilder = WalletFragmentInitParams.NewBuilder ()
                .SetMaskedWalletRequest (maskedWalletRequest)
                .SetMaskedWalletRequestCode(REQUEST_CODE_MASKED_WALLET)
                .SetAccountName(accountName);

            mWalletFragment.Initialize (startParamsBuilder.Build ());

            // add Wallet fragment to the UI
            SupportFragmentManager.BeginTransaction ()
                .Replace (Resource.Id.dynamic_wallet_button_fragment, mWalletFragment)
                .Commit();
        }