RzpGpayMerged.smali

.class Lcom/razorpay/RzpGpayMerged;
.super Ljava/lang/Object;
.source "RzpGpayMerged.java"

# interfaces
.implements Lcom/google/android/gms/tasks/OnCompleteListener;
.implements Lcom/razorpay/RzpPlugin;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/google/android/gms/tasks/OnCompleteListener<",
        "Ljava/lang/Boolean;",
        ">;",
        "Lcom/razorpay/RzpPlugin;"
    }
.end annotation


# static fields
.field private static LOAD_PAYMENT_DATA_REQUEST_CODE:I = 0x1


# instance fields
.field private apiResponse:Lorg/json/JSONObject;

.field private cardsTask:Lcom/google/android/gms/tasks/Task;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/google/android/gms/tasks/Task<",
            "Ljava/lang/Boolean;",
            ">;"
        }
    .end annotation
.end field

.field private isUpiOnly:Z

.field private mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

.field private registerCallback:Lcom/razorpay/RzpPluginRegisterCallback;

.field private rzpInternalCallback:Lcom/razorpay/RzpInternalCallback;

.field private upiTask:Lcom/google/android/gms/tasks/Task;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/google/android/gms/tasks/Task<",
            "Ljava/lang/Boolean;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .registers 0

    return-void
.end method

.method constructor <init>()V
    .registers 2

    .line 25
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 32
    iput-boolean v0, p0, Lcom/razorpay/RzpGpayMerged;->isUpiOnly:Z

    const/4 v0, 0x0

    .line 33
    iput-object v0, p0, Lcom/razorpay/RzpGpayMerged;->cardsTask:Lcom/google/android/gms/tasks/Task;

    .line 34
    iput-object v0, p0, Lcom/razorpay/RzpGpayMerged;->upiTask:Lcom/google/android/gms/tasks/Task;

    return-void
.end method

.method static synthetic access$002(Lcom/razorpay/RzpGpayMerged;Z)Z
    .registers 2

    .line 25
    iput-boolean p1, p0, Lcom/razorpay/RzpGpayMerged;->isUpiOnly:Z

    return p1
.end method

.method static synthetic access$102(Lcom/razorpay/RzpGpayMerged;Lorg/json/JSONObject;)Lorg/json/JSONObject;
    .registers 2

    .line 25
    iput-object p1, p0, Lcom/razorpay/RzpGpayMerged;->apiResponse:Lorg/json/JSONObject;

    return-object p1
.end method

.method static synthetic access$200(Lcom/razorpay/RzpGpayMerged;Ljava/lang/String;ILjava/lang/String;)V
    .registers 4

    .line 25
    invoke-direct {p0, p1, p2, p3}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void
.end method

.method static synthetic access$300()I
    .registers 1

    .line 25
    sget v0, Lcom/razorpay/RzpGpayMerged;->LOAD_PAYMENT_DATA_REQUEST_CODE:I

    return v0
.end method

.method static synthetic access$400(Lcom/razorpay/RzpGpayMerged;)Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;
    .registers 1

    .line 25
    iget-object p0, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    return-object p0
.end method

.method private genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V
    .registers 6

    .line 308
    iget-boolean v0, p0, Lcom/razorpay/RzpGpayMerged;->isUpiOnly:Z

    const/4 v1, 0x5

    if-eqz v0, :cond_f

    .line 309
    iget-object p2, p0, Lcom/razorpay/RzpGpayMerged;->rzpInternalCallback:Lcom/razorpay/RzpInternalCallback;

    invoke-static {p1, p3}, Lcom/razorpay/RzpGpayUtilMerged;->makeErrorPayload(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    invoke-interface {p2, v1, p1}, Lcom/razorpay/RzpInternalCallback;->onPaymentError(ILjava/lang/String;)V

    return-void

    .line 311
    :cond_f
    iget-object p1, p0, Lcom/razorpay/RzpGpayMerged;->rzpInternalCallback:Lcom/razorpay/RzpInternalCallback;

    iget-object v0, p0, Lcom/razorpay/RzpGpayMerged;->apiResponse:Lorg/json/JSONObject;

    invoke-static {v0, p2, p3}, Lcom/razorpay/RzpGpayUtilMerged;->makeMergedExternalSDKErrorPayload(Lorg/json/JSONObject;ILjava/lang/String;)Ljava/lang/String;

    move-result-object p2

    invoke-interface {p1, v1, p2}, Lcom/razorpay/RzpInternalCallback;->onPaymentError(ILjava/lang/String;)V

    return-void
.end method

.method private genericOnPaymentSuccess()V
    .registers 3

    .line 299
    iget-boolean v0, p0, Lcom/razorpay/RzpGpayMerged;->isUpiOnly:Z

    if-eqz v0, :cond_10

    .line 300
    iget-object v0, p0, Lcom/razorpay/RzpGpayMerged;->rzpInternalCallback:Lcom/razorpay/RzpInternalCallback;

    iget-object v1, p0, Lcom/razorpay/RzpGpayMerged;->apiResponse:Lorg/json/JSONObject;

    invoke-static {v1}, Lcom/razorpay/RzpGpayUtilMerged;->makeExternalSDKPayload(Lorg/json/JSONObject;)Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Lcom/razorpay/RzpInternalCallback;->onPaymentSuccess(Ljava/lang/String;)V

    return-void

    .line 303
    :cond_10
    iget-object v0, p0, Lcom/razorpay/RzpGpayMerged;->rzpInternalCallback:Lcom/razorpay/RzpInternalCallback;

    iget-object v1, p0, Lcom/razorpay/RzpGpayMerged;->apiResponse:Lorg/json/JSONObject;

    invoke-static {v1}, Lcom/razorpay/RzpGpayUtilMerged;->makeMergedExternalSDKPayload(Lorg/json/JSONObject;)Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Lcom/razorpay/RzpInternalCallback;->onPaymentSuccess(Ljava/lang/String;)V

    return-void
.end method

.method private handleResultStatusCode(I)V
    .registers 5

    const/16 v0, 0x195

    const/4 v1, 0x1

    const-string v2, "BAD_REQUEST_ERROR"

    if-eq p1, v0, :cond_17

    const/16 v0, 0x199

    if-eq p1, v0, :cond_11

    const-string p1, "An internal error has occurred"

    .line 206
    invoke-direct {p0, v2, v1, p1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void

    :cond_11
    const-string p1, "There is a problem with your Google Pay account."

    .line 197
    invoke-direct {p0, v2, v1, p1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void

    :cond_17
    const-string p1, "There is a problem with merchant\'s account."

    .line 200
    invoke-direct {p0, v2, v1, p1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void
.end method

.method private processPaymentResponse(Ljava/lang/String;)V
    .registers 4

    .line 265
    sget-object v0, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_VERIFY_PAYMENT_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {v0}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 266
    invoke-static {p1}, Lcom/razorpay/RzpGpayMerged;->verifyPaymentResponse(Ljava/lang/String;)Z

    move-result p1

    if-eqz p1, :cond_14

    .line 267
    sget-object p1, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_VERIFY_PAYMENT_SUCCESS_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p1}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 268
    invoke-direct {p0}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentSuccess()V

    return-void

    .line 270
    :cond_14
    sget-object p1, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_VERIFY_PAYMENT_ERROR_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p1}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    const/4 p1, 0x1

    const-string v0, "BAD_REQUEST_ERROR"

    const-string v1, "Payment was not successful."

    .line 271
    invoke-direct {p0, v0, p1, v1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void
.end method

.method private static verifyPaymentResponse(Ljava/lang/String;)Z
    .registers 4

    const/4 v0, 0x0

    .line 277
    :try_start_1
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, p0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string p0, "paymentMethodData"

    .line 278
    invoke-virtual {v1, p0}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object p0

    const-string v1, "tokenizationData"

    .line 279
    invoke-virtual {p0, v1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object p0

    const-string v1, "token"

    invoke-virtual {p0, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    if-nez p0, :cond_20

    .line 282
    sget-object p0, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_VERIFY_PAYMENT_EXCEPTION:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p0}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    return v0

    .line 286
    :cond_20
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, p0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 287
    new-instance p0, Lorg/json/JSONObject;

    const-string v2, "signedMessage"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, v1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string v1, "paymentMethodDetails"

    .line 289
    invoke-virtual {p0, v1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object p0

    const-string v1, "status"

    invoke-virtual {p0, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    if-eqz p0, :cond_48

    const-string v1, "SUCCESS"

    .line 290
    invoke-virtual {p0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0
    :try_end_44
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_44} :catch_49

    if-eqz p0, :cond_48

    const/4 p0, 0x1

    return p0

    :cond_48
    return v0

    .line 293
    :catch_49
    sget-object p0, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_VERIFY_PAYMENT_EXCEPTION:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p0}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    return v0
.end method


# virtual methods
.method public doesHandlePayload(Ljava/lang/String;Lorg/json/JSONObject;Landroid/app/Activity;)Z
    .registers 7

    const-string p1, "type"

    const-string p3, "method"

    const/4 v0, 0x1

    const/4 v1, 0x0

    if-eqz p2, :cond_2b

    .line 66
    :try_start_8
    invoke-virtual {p2, p3}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_2b

    .line 67
    invoke-virtual {p2, p3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p3

    const-string v2, "upi"

    invoke-virtual {p3, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p3

    if-eqz p3, :cond_2b

    const-string p3, "_[app]"

    .line 68
    invoke-virtual {p2, p3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p3

    const-string v2, "com.google.android.apps.nbu.paisa.user"

    invoke-virtual {p3, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p3

    if-eqz p3, :cond_2b

    return v0

    :catch_29
    move-exception p1

    goto :goto_4e

    :cond_2b
    if-eqz p2, :cond_51

    .line 73
    invoke-virtual {p2, p1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result p3

    if-eqz p3, :cond_51

    .line 74
    invoke-virtual {p2, p1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    const-string p3, "application"

    invoke-virtual {p1, p3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p1

    if-eqz p1, :cond_51

    const-string p1, "application_name"

    .line 75
    invoke-virtual {p2, p1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    const-string p2, "google_pay"

    invoke-virtual {p1, p2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p1
    :try_end_4b
    .catch Lorg/json/JSONException; {:try_start_8 .. :try_end_4b} :catch_29

    if-eqz p1, :cond_51

    return v0

    .line 80
    :goto_4e
    invoke-virtual {p1}, Lorg/json/JSONException;->printStackTrace()V

    :cond_51
    return v1
.end method

.method public isCompatible(Ljava/lang/String;ILjava/lang/String;)Lcom/razorpay/RzpPluginCompatibilityResponse;
    .registers 8

    const-string p3, "custom"

    .line 41
    invoke-virtual {p1, p3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    const/4 v1, 0x0

    const/4 v2, 0x1

    if-eqz v0, :cond_14

    const/16 v0, 0x1b

    if-le p2, v0, :cond_14

    .line 42
    new-instance p1, Lcom/razorpay/RzpPluginCompatibilityResponse;

    invoke-direct {p1, v2, v1}, Lcom/razorpay/RzpPluginCompatibilityResponse;-><init>(ZLjava/lang/String;)V

    return-object p1

    :cond_14
    const-string v0, "standard"

    .line 44
    invoke-virtual {p1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_26

    const/16 v3, 0x12

    if-le p2, v3, :cond_26

    .line 45
    new-instance p1, Lcom/razorpay/RzpPluginCompatibilityResponse;

    invoke-direct {p1, v2, v1}, Lcom/razorpay/RzpPluginCompatibilityResponse;-><init>(ZLjava/lang/String;)V

    return-object p1

    .line 48
    :cond_26
    invoke-virtual {p1, p3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p2

    if-eqz p2, :cond_2f

    const-string p1, "Razorpay\'s GooglePay plugin requires a min SDK Version 3.8.8 Please update."

    goto :goto_3a

    .line 51
    :cond_2f
    invoke-virtual {p1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p1

    if-eqz p1, :cond_38

    const-string p1, "Razorpay\'s GooglePay plugin requires a min SDK Version 1.5.6 Please update."

    goto :goto_3a

    :cond_38
    const-string p1, "Incompatible Razorpay sdk version. Please update the base sdk"

    .line 58
    :goto_3a
    new-instance p2, Lcom/razorpay/RzpPluginCompatibilityResponse;

    const/4 p3, 0x0

    invoke-direct {p2, p3, p1}, Lcom/razorpay/RzpPluginCompatibilityResponse;-><init>(ZLjava/lang/String;)V

    return-object p2
.end method

.method public isRegistered(Landroid/content/Context;)V
    .registers 6

    .line 235
    invoke-static {}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/Wallet;->getPaymentsClient()Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    move-result-object v0

    iput-object v0, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    .line 237
    sget-object v0, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_CHECK_REGISTER_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {v0}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    const/4 v0, 0x0

    .line 240
    :try_start_c
    sget-object v1, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_PAYMENT_IS_REGISTERED_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {v1}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 241
    iget-object v1, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    invoke-static {}, Lcom/razorpay/RzpGpayUtilMerged;->getIsReadyToPayRequest()Lorg/json/JSONObject;

    move-result-object v2

    invoke-static {v2}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lorg/json/JSONObject;

    invoke-virtual {v2}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, p1, v2}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;->isReadyToPay(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/tasks/Task;

    move-result-object v1
    :try_end_25
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_c .. :try_end_25} :catch_3c

    .line 242
    :try_start_25
    iget-object v2, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    invoke-static {}, Lcom/razorpay/RzpGpayUtilMerged;->getCardsIsReadyToPayRequest()Lorg/json/JSONObject;

    move-result-object v3

    invoke-static {v3}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lorg/json/JSONObject;

    invoke-virtual {v3}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, p1, v3}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;->isReadyToPay(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/tasks/Task;

    move-result-object v0
    :try_end_39
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_25 .. :try_end_39} :catch_3a

    goto :goto_4f

    :catch_3a
    move-exception p1

    goto :goto_3e

    :catch_3c
    move-exception p1

    move-object v1, v0

    .line 244
    :goto_3e
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p1}, Ljava/security/NoSuchAlgorithmException;->getMessage()Ljava/lang/String;

    move-result-object p1

    const-string v3, "error:exception"

    invoke-static {v2, v3, p1}, Lcom/razorpay/AnalyticsUtil;->reportError(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 247
    :goto_4f
    invoke-static {v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lcom/google/android/gms/tasks/Task;

    new-instance v0, Lcom/razorpay/j;

    invoke-direct {v0, p0}, Lcom/razorpay/j;-><init>(Lcom/razorpay/RzpGpayMerged;)V

    invoke-virtual {p1, v0}, Lcom/google/android/gms/tasks/Task;->addOnCompleteListener(Lcom/google/android/gms/tasks/OnCompleteListener;)Lcom/google/android/gms/tasks/Task;

    .line 255
    invoke-static {v1}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lcom/google/android/gms/tasks/Task;

    new-instance v0, Lcom/razorpay/k;

    invoke-direct {v0, p0}, Lcom/razorpay/k;-><init>(Lcom/razorpay/RzpGpayMerged;)V

    invoke-virtual {p1, v0}, Lcom/google/android/gms/tasks/Task;->addOnCompleteListener(Lcom/google/android/gms/tasks/OnCompleteListener;)Lcom/google/android/gms/tasks/Task;

    return-void
.end method

.method public isRegistered(Landroid/content/Context;Lcom/razorpay/RzpPluginRegisterCallback;)V
    .registers 4

    .line 214
    iput-object p2, p0, Lcom/razorpay/RzpGpayMerged;->registerCallback:Lcom/razorpay/RzpPluginRegisterCallback;

    .line 215
    sget-object p2, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_CHECK_REGISTER_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p2}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 218
    :try_start_7
    invoke-static {}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/Wallet;->getPaymentsClient()Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    move-result-object p2

    iput-object p2, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    .line 219
    sget-object p2, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_PAYMENT_IS_REGISTERED_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p2}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 220
    iget-object p2, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    invoke-static {}, Lcom/razorpay/RzpGpayUtilMerged;->getIsReadyToPayRequest()Lorg/json/JSONObject;

    move-result-object v0

    invoke-static {v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/json/JSONObject;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, p1, v0}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;->isReadyToPay(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/tasks/Task;

    move-result-object p2

    iput-object p2, p0, Lcom/razorpay/RzpGpayMerged;->upiTask:Lcom/google/android/gms/tasks/Task;

    .line 221
    iget-object p2, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    invoke-static {}, Lcom/razorpay/RzpGpayUtilMerged;->getCardsIsReadyToPayRequest()Lorg/json/JSONObject;

    move-result-object v0

    invoke-static {v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/json/JSONObject;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, p1, v0}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;->isReadyToPay(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/tasks/Task;

    move-result-object p1

    iput-object p1, p0, Lcom/razorpay/RzpGpayMerged;->cardsTask:Lcom/google/android/gms/tasks/Task;
    :try_end_3e
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_7 .. :try_end_3e} :catch_3f

    goto :goto_51

    :catch_3f
    move-exception p1

    .line 223
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object p2

    invoke-virtual {p2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1}, Ljava/security/NoSuchAlgorithmException;->getMessage()Ljava/lang/String;

    move-result-object p1

    const-string v0, "error:exception"

    invoke-static {p2, v0, p1}, Lcom/razorpay/AnalyticsUtil;->reportError(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 226
    :goto_51
    iget-object p1, p0, Lcom/razorpay/RzpGpayMerged;->cardsTask:Lcom/google/android/gms/tasks/Task;

    invoke-static {p1}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lcom/google/android/gms/tasks/Task;

    invoke-virtual {p1, p0}, Lcom/google/android/gms/tasks/Task;->addOnCompleteListener(Lcom/google/android/gms/tasks/OnCompleteListener;)Lcom/google/android/gms/tasks/Task;

    .line 227
    iget-object p1, p0, Lcom/razorpay/RzpGpayMerged;->upiTask:Lcom/google/android/gms/tasks/Task;

    invoke-static {p1}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lcom/google/android/gms/tasks/Task;

    invoke-virtual {p1, p0}, Lcom/google/android/gms/tasks/Task;->addOnCompleteListener(Lcom/google/android/gms/tasks/OnCompleteListener;)Lcom/google/android/gms/tasks/Task;

    return-void
.end method

.method public onActivityResult(Ljava/lang/String;IILandroid/content/Intent;)V
    .registers 5

    .line 174
    sget p1, Lcom/razorpay/RzpGpayMerged;->LOAD_PAYMENT_DATA_REQUEST_CODE:I

    if-ne p2, p1, :cond_33

    const/4 p1, -0x1

    if-eq p3, p1, :cond_27

    if-eqz p3, :cond_19

    const/4 p1, 0x1

    if-eq p3, p1, :cond_d

    goto :goto_33

    :cond_d
    const/16 p1, 0x8

    const-string p2, "errorCode"

    .line 182
    invoke-virtual {p4, p2, p1}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result p1

    .line 183
    invoke-direct {p0, p1}, Lcom/razorpay/RzpGpayMerged;->handleResultStatusCode(I)V

    return-void

    .line 186
    :cond_19
    sget-object p1, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_PAYMENT_CALLBACK_CANCELLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p1}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    const/4 p1, 0x0

    const-string p2, "BAD_REQUEST_ERROR"

    const-string p3, "Payment canceled."

    .line 187
    invoke-direct {p0, p2, p1, p3}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    goto :goto_33

    .line 177
    :cond_27
    sget-object p1, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_PAYMENT_CALLBACK_SUCCESS:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p1}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 178
    invoke-static {p4}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/WalletUtils;->getPaymentDataFromIntent(Landroid/content/Intent;)Ljava/lang/String;

    move-result-object p1

    .line 179
    invoke-direct {p0, p1}, Lcom/razorpay/RzpGpayMerged;->processPaymentResponse(Ljava/lang/String;)V

    :cond_33
    :goto_33
    return-void
.end method

.method public onComplete(Lcom/google/android/gms/tasks/Task;)V
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/google/android/gms/tasks/Task<",
            "Ljava/lang/Boolean;",
            ">;)V"
        }
    .end annotation

    .line 318
    invoke-virtual {p1}, Lcom/google/android/gms/tasks/Task;->getResult()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    .line 319
    iget-object v1, p0, Lcom/razorpay/RzpGpayMerged;->cardsTask:Lcom/google/android/gms/tasks/Task;

    invoke-virtual {p1, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_1b

    .line 320
    invoke-static {v0}, Lcom/razorpay/BaseUtils;->setIsGpayCardsUpiRegistered(Z)V

    .line 321
    iget-object p1, p0, Lcom/razorpay/RzpGpayMerged;->registerCallback:Lcom/razorpay/RzpPluginRegisterCallback;

    invoke-interface {p1, v0}, Lcom/razorpay/RzpPluginRegisterCallback;->onResponse(Z)V

    return-void

    .line 323
    :cond_1b
    invoke-static {v0}, Lcom/razorpay/BaseUtils;->setCompatibleWithGooglePay(Z)V

    return-void
.end method

.method public processPayment(Ljava/lang/String;Lorg/json/JSONObject;Landroid/app/Activity;Lcom/razorpay/RzpInternalCallback;)V
    .registers 10

    const-string p1, "An internal error has occurred"

    const-string v0, "url_data"

    const-string v1, "type"

    const-string v2, "error:exception"

    const-string v3, "BAD_REQUEST_ERROR"

    const/4 v4, 0x1

    .line 92
    :try_start_b
    iput-object p4, p0, Lcom/razorpay/RzpGpayMerged;->rzpInternalCallback:Lcom/razorpay/RzpInternalCallback;

    .line 93
    invoke-static {}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/Wallet;->getPaymentsClient()Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    move-result-object p4

    iput-object p4, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    .line 94
    sget-object p4, Lcom/razorpay/AnalyticsEvent;->GOOGLEPAY_PROCESS_PAYMENT_CALLED:Lcom/razorpay/AnalyticsEvent;

    invoke-static {p4}, Lcom/razorpay/AnalyticsUtil;->trackEvent(Lcom/razorpay/AnalyticsEvent;)V

    .line 100
    invoke-virtual {p2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result p4

    if-eqz p4, :cond_63

    invoke-virtual {p2, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p4

    const-string v1, "application"

    invoke-virtual {p4, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p4

    if-eqz p4, :cond_63

    .line 101
    iput-object p2, p0, Lcom/razorpay/RzpGpayMerged;->apiResponse:Lorg/json/JSONObject;

    const-string p1, "request"

    .line 102
    invoke-virtual {p2, p1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object p1

    const-string p2, "content"

    invoke-virtual {p1, p2}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object p1

    const/4 p2, 0x0

    invoke-virtual {p1, p2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object p1
    :try_end_3d
    .catch Ljava/lang/Exception; {:try_start_b .. :try_end_3d} :catch_bc

    .line 104
    :try_start_3d
    iget-object p2, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    invoke-virtual {p1}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object p1

    sget p4, Lcom/razorpay/RzpGpayMerged;->LOAD_PAYMENT_DATA_REQUEST_CODE:I

    invoke-virtual {p2, p3, p1, p4}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;->loadPaymentData(Landroid/app/Activity;Ljava/lang/String;I)V
    :try_end_48
    .catch Ljava/lang/Exception; {:try_start_3d .. :try_end_48} :catch_49

    return-void

    :catch_49
    move-exception p1

    .line 106
    :try_start_4a
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object p2

    invoke-virtual {p2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object p2

    const-string p3, "S0"

    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object p1

    invoke-static {p2, p3, p1}, Lcom/razorpay/AnalyticsUtil;->reportError(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    const-string p1, "BAD_REQUEST"

    const-string p2, "An internal error has occured"

    .line 107
    invoke-direct {p0, p1, v4, p2}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void

    .line 113
    :cond_63
    invoke-virtual {p2, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result p4

    if-eqz p4, :cond_a1

    .line 114
    iput-boolean v4, p0, Lcom/razorpay/RzpGpayMerged;->isUpiOnly:Z
    :try_end_6b
    .catch Ljava/lang/Exception; {:try_start_4a .. :try_end_6b} :catch_bc

    .line 116
    :try_start_6b
    invoke-virtual {p2, v0}, Lorg/json/JSONObject;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p4

    invoke-virtual {p4}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object p4
    :try_end_73
    .catch Ljava/lang/Exception; {:try_start_6b .. :try_end_73} :catch_8d

    .line 119
    :try_start_73
    invoke-static {p4}, Lcom/razorpay/RzpGpayUtilMerged;->getUpiData(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v0

    iput-object v0, p0, Lcom/razorpay/RzpGpayMerged;->apiResponse:Lorg/json/JSONObject;

    .line 120
    iget-object v0, p0, Lcom/razorpay/RzpGpayMerged;->mPaymentClient:Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;

    invoke-static {p4, p2}, Lcom/razorpay/RzpGpayUtilMerged;->getPaymentRequestData(Ljava/lang/String;Lorg/json/JSONObject;)Ljava/lang/String;

    move-result-object p2

    sget p4, Lcom/razorpay/RzpGpayMerged;->LOAD_PAYMENT_DATA_REQUEST_CODE:I

    invoke-virtual {v0, p3, p2, p4}, Lcom/google/android/apps/nbu/paisa/inapp/client/api/PaymentsClient;->loadPaymentData(Landroid/app/Activity;Ljava/lang/String;I)V
    :try_end_84
    .catch Ljava/lang/Exception; {:try_start_73 .. :try_end_84} :catch_85

    goto :goto_a0

    :catch_85
    move-exception p2

    .line 123
    :try_start_86
    invoke-virtual {p2}, Ljava/lang/Exception;->printStackTrace()V

    .line 124
    invoke-direct {p0, v3, v4, p1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V
    :try_end_8c
    .catch Ljava/lang/Exception; {:try_start_86 .. :try_end_8c} :catch_8d

    return-void

    :catch_8d
    move-exception p2

    .line 129
    :try_start_8e
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object p3

    invoke-virtual {p3}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object p3

    invoke-virtual {p2}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object p2

    invoke-static {p3, v2, p2}, Lcom/razorpay/AnalyticsUtil;->reportError(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 130
    invoke-direct {p0, v3, v4, p1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    :goto_a0
    return-void

    .line 137
    :cond_a1
    new-instance p1, Ljava/util/HashMap;

    invoke-direct {p1}, Ljava/util/HashMap;-><init>()V

    const-string p4, "Content-Type"

    const-string v0, "application/x-www-form-urlencoded"

    .line 138
    invoke-interface {p1, p4, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    const-string p4, "https://api.razorpay.com/v1/payments/create/ajax"

    .line 140
    invoke-static {p2}, Lcom/razorpay/RzpGpayUtilMerged;->makeApiPayload(Lorg/json/JSONObject;)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Lcom/razorpay/i;

    invoke-direct {v1, p0, p3, p2}, Lcom/razorpay/i;-><init>(Lcom/razorpay/RzpGpayMerged;Landroid/app/Activity;Lorg/json/JSONObject;)V

    invoke-static {p4, v0, p1, v1}, Lcom/razorpay/i_$z_;->a(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Lcom/razorpay/Callback;)Landroid/os/AsyncTask;
    :try_end_bb
    .catch Ljava/lang/Exception; {:try_start_8e .. :try_end_bb} :catch_bc

    return-void

    :catch_bc
    move-exception p1

    .line 166
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object p2

    invoke-virtual {p2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object p1

    invoke-static {p2, v2, p1}, Lcom/razorpay/AnalyticsUtil;->reportError(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    const-string p1, "An internal error has occurred."

    .line 167
    invoke-direct {p0, v3, v4, p1}, Lcom/razorpay/RzpGpayMerged;->genericOnPaymentFailure(Ljava/lang/String;ILjava/lang/String;)V

    return-void
.end method