protected override void OnActivityResult(int requestCode, Android.App.Result resultCode, Android.Content.Intent data) { switch (requestCode) { case REQUEST_CODE_CHANGE_MASKED_WALLET: if (resultCode == Android.App.Result.Ok && data.HasExtra(WalletConstants.ExtraMaskedWallet)) { mMaskedWallet = data.GetParcelableExtra(WalletConstants.ExtraMaskedWallet).JavaCast <MaskedWallet> (); ((FullWalletConfirmationButtonFragment)ResultTargetFragment) .UpdateMaskedWallet(mMaskedWallet); } // you may also want to use the new masked wallet data here, say to recalculate // shipping or taxes if shipping address changed break; case WalletConstants.ResultError: int errorCode = data.GetIntExtra(WalletConstants.ExtraErrorCode, 0); HandleError(errorCode); break; default: base.OnActivityResult(requestCode, resultCode, data); break; } }
public override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (savedInstanceState != null) { mRetryCounter = savedInstanceState.GetInt(KEY_RETRY_COUNTER); mRetryLoadFullWalletCount = savedInstanceState.GetInt(KEY_RETRY_FULL_WALLET_COUNTER); mHandleFullWalletWhenReady = savedInstanceState.GetBoolean(KEY_HANDLE_FULL_WALLET_WHEN_READY); } mActivityLaunchIntent = Activity.Intent; mItemId = mActivityLaunchIntent.GetIntExtra(Constants.EXTRA_ITEM_ID, 0); mMaskedWallet = mActivityLaunchIntent.GetParcelableExtra(Constants.EXTRA_MASKED_WALLET).JavaCast <MaskedWallet> (); var accountName = ((BikestoreApplication)Activity.Application).AccountName; // Set up an API client; mGoogleApiClient = new GoogleApiClient.Builder(Activity) .AddConnectionCallbacks(this) .AddOnConnectionFailedListener(this) .SetAccountName(accountName) .AddApi(WalletClass.API, new WalletClass.WalletOptions.Builder() .SetEnvironment(Constants.WALLET_ENVIRONMENT) .SetTheme(WalletConstants.ThemeLight) .Build()) .Build(); mRetryHandler = new RetryHandler(this); }
public override void OnCreate (Android.OS.Bundle savedInstanceState) { base.OnCreate (savedInstanceState); if (savedInstanceState != null) { mRetryCounter = savedInstanceState.GetInt (KEY_RETRY_COUNTER); mRetryLoadFullWalletCount = savedInstanceState.GetInt (KEY_RETRY_FULL_WALLET_COUNTER); mHandleFullWalletWhenReady = savedInstanceState.GetBoolean (KEY_HANDLE_FULL_WALLET_WHEN_READY); } mActivityLaunchIntent = Activity.Intent; mItemId = mActivityLaunchIntent.GetIntExtra (Constants.EXTRA_ITEM_ID, 0); mMaskedWallet = mActivityLaunchIntent.GetParcelableExtra (Constants.EXTRA_MASKED_WALLET).JavaCast<MaskedWallet> (); var accountName = ((BikestoreApplication) Activity.Application).AccountName; // Set up an API client; mGoogleApiClient = new GoogleApiClient.Builder (Activity) .AddConnectionCallbacks (this) .AddOnConnectionFailedListener (this) .SetAccountName (accountName) .AddApi (WalletClass.API, new WalletClass.WalletOptions.Builder () .SetEnvironment (Constants.WALLET_ENVIRONMENT) .SetTheme (WalletConstants.ThemeLight) .Build ()) .Build (); mRetryHandler = new RetryHandler (this); }
public override void OnActivityResult(int requestCode, int resultCode, Android.Content.Intent data) { mProgressDialog.Hide(); // retrieve the error code, if available int errorCode = -1; if (data != null) { errorCode = data.GetIntExtra(WalletConstants.ExtraErrorCode, -1); } switch (requestCode) { case REQUEST_CODE_RESOLVE_ERR: if (resultCode == (int)Result.Ok) { mGoogleApiClient.Connect(); } else { handleUnrecoverableGoogleWalletError(errorCode); } break; case REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET: switch (resultCode) { case (int)Result.Ok: if (data.HasExtra(WalletConstants.ExtraFullWallet)) { FullWallet fullWallet = data.GetParcelableExtra(WalletConstants.ExtraFullWallet).JavaCast <FullWallet> (); // the full wallet can now be used to process the customer's payment // send the wallet info up to server to process, and to get the result // for sending a transaction status fetchTransactionStatus(fullWallet); } else if (data.HasExtra(WalletConstants.ExtraMaskedWallet)) { // re-launch the activity with new masked wallet information mMaskedWallet = data.GetParcelableExtra(WalletConstants.ExtraMaskedWallet).JavaCast <MaskedWallet> (); mActivityLaunchIntent.PutExtra(Constants.EXTRA_MASKED_WALLET, mMaskedWallet); StartActivity(mActivityLaunchIntent); } break; case (int)Result.Canceled: // nothing to do here break; default: handleError(errorCode); break; } break; } }
private void launchConfirmationPage(MaskedWallet maskedWallet) { var intent = new Intent(this, typeof(ConfirmationActivity)); intent.PutExtra(Constants.EXTRA_ITEM_ID, mItemId); intent.PutExtra(Constants.EXTRA_MASKED_WALLET, maskedWallet.JavaCast <IParcelable>()); StartActivity(intent); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); mMaskedWallet = Intent.GetParcelableExtra(Constants.EXTRA_MASKED_WALLET).JavaCast <MaskedWallet> (); SetContentView(Resource.Layout.activity_confirmation); CreateAndAddWalletFragment(); }
protected override void OnCreate (Android.OS.Bundle savedInstanceState) { base.OnCreate (savedInstanceState); mMaskedWallet = Intent.GetParcelableExtra (Constants.EXTRA_MASKED_WALLET).JavaCast<MaskedWallet> (); SetContentView (Resource.Layout.activity_confirmation); CreateAndAddWalletFragment(); }
void PerformFullWalletRequest(MaskedWallet maskedWallet) { var request = FullWalletRequest.NewBuilder() .SetGoogleTransactionId(maskedWallet.GoogleTransactionId) .SetCart(Cart.NewBuilder() .SetCurrencyCode(_judo.Currency) .SetTotalPrice(_judo.Amount.ToString()) .Build()) .Build(); WalletClass.Payments.LoadFullWallet(_googleApiClient, request, FullWalletRequestCode); }
protected override void OnActivityResult (int requestCode, Android.App.Result resultCode, Android.Content.Intent data) { switch (requestCode) { case REQUEST_CODE_CHANGE_MASKED_WALLET: if (resultCode == Android.App.Result.Ok && data.HasExtra (WalletConstants.ExtraMaskedWallet)) { mMaskedWallet = data.GetParcelableExtra (WalletConstants.ExtraMaskedWallet).JavaCast<MaskedWallet> (); ((FullWalletConfirmationButtonFragment) ResultTargetFragment) .UpdateMaskedWallet (mMaskedWallet); } // you may also want to use the new masked wallet data here, say to recalculate // shipping or taxes if shipping address changed break; case WalletConstants.ResultError: int errorCode = data.GetIntExtra (WalletConstants.ExtraErrorCode, 0); HandleError (errorCode); break; default: base.OnActivityResult (requestCode, resultCode, data); break; } }
void PerformFullWalletRequest(MaskedWallet maskedWallet) { var request = Android.Gms.Wallet.FullWalletRequest.NewBuilder() .SetGoogleTransactionId(maskedWallet.GoogleTransactionId) .SetCart(Cart.NewBuilder() .SetCurrencyCode(_judo.Currency) .SetTotalPrice(_judo.Amount.ToString()) .Build()) .Build(); WalletClass.Payments.LoadFullWallet(_googleApiClient, request, FullWalletRequest); }
public void UpdateMaskedWallet(MaskedWallet maskedWallet) { this.mMaskedWallet = maskedWallet; }
public void UpdateMaskedWallet (MaskedWallet maskedWallet) { this.mMaskedWallet = maskedWallet; }
public override void OnActivityResult (int requestCode, int resultCode, Android.Content.Intent data) { mProgressDialog.Hide (); // retrieve the error code, if available int errorCode = -1; if (data != null) errorCode = data.GetIntExtra (WalletConstants.ExtraErrorCode, -1); switch (requestCode) { case REQUEST_CODE_RESOLVE_ERR: if (resultCode == (int)Result.Ok) { mGoogleApiClient.Connect(); } else { handleUnrecoverableGoogleWalletError(errorCode); } break; case REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET: switch (resultCode) { case (int)Result.Ok: if (data.HasExtra(WalletConstants.ExtraFullWallet)) { FullWallet fullWallet = data.GetParcelableExtra (WalletConstants.ExtraFullWallet).JavaCast<FullWallet> (); // the full wallet can now be used to process the customer's payment // send the wallet info up to server to process, and to get the result // for sending a transaction status fetchTransactionStatus(fullWallet); } else if (data.HasExtra(WalletConstants.ExtraMaskedWallet)) { // re-launch the activity with new masked wallet information mMaskedWallet = data.GetParcelableExtra (WalletConstants.ExtraMaskedWallet).JavaCast<MaskedWallet> (); mActivityLaunchIntent.PutExtra (Constants.EXTRA_MASKED_WALLET, mMaskedWallet); StartActivity(mActivityLaunchIntent); } break; case (int)Result.Canceled: // nothing to do here break; default: handleError(errorCode); break; } break; } }
/** * Formats the payment descriptions in a {@code MaskedWallet} for display. * * @param maskedWallet The wallet that contains the payment descriptions. * @return The payment descriptions in a format suitable for display to the user. */ public static string FormatPaymentDescriptions(MaskedWallet maskedWallet) { return(string.Join("\n", maskedWallet.GetPaymentDescriptions())); }
/** * Formats the payment descriptions in a {@code MaskedWallet} for display. * * @param maskedWallet The wallet that contains the payment descriptions. * @return The payment descriptions in a format suitable for display to the user. */ public static string FormatPaymentDescriptions (MaskedWallet maskedWallet) { return string.Join ("\n", maskedWallet.GetPaymentDescriptions ()); }
private void launchConfirmationPage (MaskedWallet maskedWallet) { var intent = new Intent(this, typeof (ConfirmationActivity)); intent.PutExtra (Constants.EXTRA_ITEM_ID, mItemId); intent.PutExtra (Constants.EXTRA_MASKED_WALLET, maskedWallet); StartActivity (intent); }