Beispiel #1
0
        public async Task <bool> Show(XPayRequest request)
        {
            WalletClass.WalletOptions walletOptions = new WalletClass.WalletOptions.Builder()
                                                      .SetEnvironment(WalletConstants.EnvironmentTest)
                                                      .Build();

            GoogleApiClient client = new GoogleApiClient.Builder(AndroidApp.Application.Context)
                                     .AddApi(WalletClass.API)
                                     .Build();

            BooleanResult boolResult = await WalletClass.Payments.IsReadyToPayAsync(client);

            if (!boolResult.Value)
            {
                throw new NotSupportedException();
            }



            return(true);
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AndroidPay);

            _judo = JsonConvert.DeserializeObject <Judo>(Intent.GetStringExtra(JudoExtra));

            _paymentService = new PaymentService(_judo);

            if (savedInstanceState == null)
            {
                var walletOptions = new WalletClass.WalletOptions.Builder().SetEnvironment(WalletEnvironment).Build();

                _googleApiClient = new GoogleApiClient.Builder(this)
                                   .AddApi(WalletClass.API, walletOptions)
                                   .EnableAutoManage(this, this)
                                   .Build();

                CreateWalletFragment();
                CheckGooglePayAvailable();
            }
        }
Beispiel #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.Main);

            FindViewById <Button>(Resource.Id.buttonCard).Click += delegate {
                StartActivity(typeof(CardInputActivity));
            };

            var b = new WalletClass.WalletOptions.Builder()
                    .SetEnvironment(WalletConstants.EnvironmentSandbox)
                    .SetTheme(WalletConstants.ThemeLight)
                    .Build();

            googleApiClient = new GoogleApiClientBuilder(this)
                              .AddConnectionCallbacks(this)
                              .AddOnConnectionFailedListener(this)
                              .AddApi(WalletClass.API, b)
                              .Build();


            var walletFragment = SupportWalletFragment.NewInstance(WalletFragmentOptions.NewBuilder()
                                                                   .SetEnvironment(WalletConstants.EnvironmentSandbox)
                                                                   .SetMode(WalletFragmentMode.BuyButton)
                                                                   .SetTheme(WalletConstants.ThemeLight)
                                                                   .SetFragmentStyle(new WalletFragmentStyle()
                                                                                     .SetBuyButtonText(BuyButtonText.BuyWithGoogle)
                                                                                     .SetBuyButtonAppearance(BuyButtonAppearance.Classic)
                                                                                     .SetBuyButtonWidth(Dimension.MatchParent))
                                                                   .Build());

            var maskedWalletRequest = MaskedWalletRequest.NewBuilder()

                                      // Request credit card tokenization with Stripe by specifying tokenization parameters:
                                      .SetPaymentMethodTokenizationParameters(PaymentMethodTokenizationParameters.NewBuilder()
                                                                              .SetPaymentMethodTokenizationType(PaymentMethodTokenizationType.PaymentGateway)
                                                                              .AddParameter("gateway", "stripe")
                                                                              .AddParameter("stripe:publishableKey", STRIPE_PUBLISHABLE_KEY)
                                                                              .AddParameter("stripe:version", "1.15.1")
                                                                              .Build())

                                      // You want the shipping address:
                                      .SetShippingAddressRequired(true)

                                      .SetMerchantName("Llamanators")
                                      .SetPhoneNumberRequired(true)
                                      .SetShippingAddressRequired(true)

                                      // Price set as a decimal:
                                      .SetEstimatedTotalPrice("20.00")
                                      .SetCurrencyCode("USD")

                                      .Build();

            // Set the parameters:
            var initParams = WalletFragmentInitParams.NewBuilder()
                             .SetMaskedWalletRequest(maskedWalletRequest)
                             .SetMaskedWalletRequestCode(LOAD_MASKED_WALLET_REQ_CODE)
                             .Build();

            // Initialize the fragment:
            walletFragment.Initialize(initParams);

            SupportFragmentManager.BeginTransaction().Replace(Resource.Id.frameFragment, walletFragment).Commit();
        }
Beispiel #4
0
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.Main);

            FindViewById<Button>(Resource.Id.buttonCard).Click += delegate {
                StartActivity (typeof (CardInputActivity));
            };

            var b = new WalletClass.WalletOptions.Builder ()
                .SetEnvironment (WalletConstants.EnvironmentSandbox)
                .SetTheme (WalletConstants.ThemeLight)
                .Build ();
            
            googleApiClient = new GoogleApiClientBuilder (this)
                .AddConnectionCallbacks (this)
                .AddOnConnectionFailedListener (this)
                .AddApi (WalletClass.API, b)
                .Build ();


            var walletFragment = SupportWalletFragment.NewInstance (WalletFragmentOptions.NewBuilder ()
                .SetEnvironment (WalletConstants.EnvironmentSandbox)
                .SetMode (WalletFragmentMode.BuyButton)
                .SetTheme (WalletConstants.ThemeLight)
                .SetFragmentStyle (new WalletFragmentStyle ()
                    .SetBuyButtonText (BuyButtonText.BuyWithGoogle)
                    .SetBuyButtonAppearance (BuyButtonAppearance.Classic)
                    .SetBuyButtonWidth (Dimension.MatchParent))
                .Build ());
            
            var maskedWalletRequest = MaskedWalletRequest.NewBuilder ()

                // Request credit card tokenization with Stripe by specifying tokenization parameters:
                .SetPaymentMethodTokenizationParameters (PaymentMethodTokenizationParameters.NewBuilder ()
                    .SetPaymentMethodTokenizationType (PaymentMethodTokenizationType.PaymentGateway)
                    .AddParameter ("gateway", "stripe")
                    .AddParameter ("stripe:publishableKey", STRIPE_PUBLISHABLE_KEY)
                    .AddParameter ("stripe:version", "1.15.1")
                    .Build ())

                // You want the shipping address:
                .SetShippingAddressRequired (true)

                .SetMerchantName ("Llamanators")
                .SetPhoneNumberRequired (true)
                .SetShippingAddressRequired (true)

                // Price set as a decimal:
                .SetEstimatedTotalPrice ("20.00")
                .SetCurrencyCode ("USD")

                .Build();

            // Set the parameters:  
            var initParams = WalletFragmentInitParams.NewBuilder ()
                .SetMaskedWalletRequest (maskedWalletRequest)
                .SetMaskedWalletRequestCode (LOAD_MASKED_WALLET_REQ_CODE)
                .Build ();
                           
            // Initialize the fragment:
            walletFragment.Initialize (initParams);

            SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.frameFragment, walletFragment).Commit ();
        }