public bool CanUseCardIO() { #if !CALLBOX return(CardIOActivity.CanReadCardWithCamera()); #else return(false); #endif }
public void OnActivityResult(int requestCode, Result resultCode, global::Android.Content.Intent data) { if (requestCode == PayPalManager.REQUEST_CODE_PAYMENT) { if (resultCode == Result.Ok) { PaymentConfirmation confirm = (PaymentConfirmation)data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation); if (confirm != null) { try { OnSuccess?.Invoke(confirm.ToJSONObject().ToString()); OnSuccess = null; } catch (JSONException e) { OnError?.Invoke("an extremely unlikely failure occurred: " + e.Message); OnError = null; System.Diagnostics.Debug.WriteLine("an extremely unlikely failure occurred: " + e.Message); } } OnError?.Invoke("Unknown Error"); OnError = null; } else if (resultCode == Result.Canceled) { OnCancelled?.Invoke(); OnCancelled = null; System.Diagnostics.Debug.WriteLine("The user canceled."); } else if ((int)resultCode == PaymentActivity.ResultExtrasInvalid) { OnError?.Invoke("An invalid Payment or PayPalConfiguration was submitted. Please see the docs."); OnError = null; System.Diagnostics.Debug.WriteLine( "An invalid Payment or PayPalConfiguration was submitted. Please see the docs."); } } else if (requestCode == REQUEST_CODE_FUTURE_PAYMENT) { if (resultCode == Result.Ok) { PayPalAuthorization auth = (PayPalAuthorization)data.GetParcelableExtra(PayPalFuturePaymentActivity.ExtraResultAuthorization); if (auth != null) { try { OnSuccess?.Invoke(auth.ToJSONObject().ToString()); OnSuccess = null; } catch (JSONException e) { System.Diagnostics.Debug.WriteLine("an extremely unlikely failure occurred: " + e.Message); } } OnError?.Invoke("Unknown Error"); OnError = null; } else if (resultCode == Result.Canceled) { OnCancelled?.Invoke(); OnCancelled = null; System.Diagnostics.Debug.WriteLine("The user canceled."); } else if ((int)resultCode == PayPalFuturePaymentActivity.ResultExtrasInvalid) { OnError?.Invoke("Probably the attempt to previously start the PayPalService had an invalid PayPalConfiguration. Please see the docs."); OnError = null; System.Diagnostics.Debug.WriteLine( "Probably the attempt to previously start the PayPalService had an invalid PayPalConfiguration. Please see the docs."); } } else if (requestCode == REQUEST_CODE_PROFILE_SHARING) { if (resultCode == Result.Ok) { PayPalAuthorization auth = (PayPalAuthorization)data.GetParcelableExtra(PayPalProfileSharingActivity.ExtraResultAuthorization); if (auth != null) { try { OnSuccess?.Invoke(auth.ToJSONObject().ToString()); OnSuccess = null; } catch (JSONException e) { System.Diagnostics.Debug.WriteLine("an extremely unlikely failure occurred: " + e.Message); } } OnError?.Invoke("Unknown Error"); OnError = null; } else if (resultCode == Result.Canceled) { OnCancelled?.Invoke(); OnCancelled = null; System.Diagnostics.Debug.WriteLine("The user canceled."); } else if ((int)resultCode == PayPalFuturePaymentActivity.ResultExtrasInvalid) { OnError?.Invoke("Probably the attempt to previously start the PayPalService had an invalid PayPalConfiguration. Please see the docs."); OnError = null; System.Diagnostics.Debug.WriteLine( "Probably the attempt to previously start the PayPalService had an invalid PayPalConfiguration. Please see the docs."); } } else if (requestCode == REQUEST_CODE_CARD_SCAN) { if (data == null) { RetrieveCardCancelled?.Invoke(); RetrieveCardCancelled = null; System.Diagnostics.Debug.WriteLine("The user canceled."); return; } var card = (CreditCard)data.GetParcelableExtra(CardIOActivity.ExtraScanResult); if (card != null) { RetrieveCardSuccess?.Invoke(card, CardIOActivity.GetCapturedCardImage(data)); RetrieveCardSuccess = null; } else { RetrieveCardCancelled?.Invoke(); RetrieveCardCancelled = null; System.Diagnostics.Debug.WriteLine("The user canceled."); } } }