正在查看: Mint v5.7.3 应用的 SubscriptionCheckOutPage.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mint v5.7.3 应用的 SubscriptionCheckOutPage.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.htmedia.mint.razorpay.ui;
import android.R;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.databinding.DataBindingUtil;
import com.android.billingclient.api.SkuDetails;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.CheckSubscriptionFromLocal;
import com.htmedia.mint.htsubscription.ConvertFreeTrialIntoDays;
import com.htmedia.mint.htsubscription.ConvertMintPlanIntoZSPlan;
import com.htmedia.mint.htsubscription.GetSubscriptionIntent;
import com.htmedia.mint.htsubscription.GetUserSubscriptionDetail;
import com.htmedia.mint.htsubscription.MSError;
import com.htmedia.mint.htsubscription.ParseSubscriptionDetail;
import com.htmedia.mint.htsubscription.SnowplowSubscriptionAnalytices;
import com.htmedia.mint.htsubscription.SubscriptionConverter;
import com.htmedia.mint.htsubscription.SubscriptionPlanSingleton;
import com.htmedia.mint.htsubscription.SubscriptionTrigger;
import com.htmedia.mint.htsubscription.SyncPurchaseWithSession;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.htsubscription.ZSErrorCodeHandling;
import com.htmedia.mint.htsubscription.ZohoInAppConfig;
import com.htmedia.mint.htsubscription.subsutils.RenewalAppConstant;
import com.htmedia.mint.piano.PianoResponse;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.Razorpay;
import com.htmedia.mint.pojo.mintsubscribenowmodel.SubscribeNowPerant;
import com.htmedia.mint.pojo.planpage.PaymentMethod;
import com.htmedia.mint.pojo.planpage.PianoPlan;
import com.htmedia.mint.pojo.razorpay.CreateOrder;
import com.htmedia.mint.pojo.razorpay.Hostedpage;
import com.htmedia.mint.pojo.subscription.ErrorCode;
import com.htmedia.mint.pojo.subscription.PlanInterval;
import com.htmedia.mint.pojo.subscription.SubscriptionError;
import com.htmedia.mint.pojo.subscription.SubscriptionSource;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.MintPlan;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.MintPlanWithZSPlan;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.MintServerPlan;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.PlanDiscountMS;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.Plans;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.SubsPlans;
import com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail;
import com.htmedia.mint.razorpay.JWTTokenBuilder;
import com.htmedia.mint.razorpay.presenter.OrderCreatePresenter;
import com.htmedia.mint.razorpay.presenter.OrderCreatePresenterInterface;
import com.htmedia.mint.razorpay.presenter.OrderCreateViewInterface;
import com.htmedia.mint.razorpay.presenter.PaymentValidationPresenter;
import com.htmedia.mint.razorpay.presenter.PaymentValidationPresenterInterface;
import com.htmedia.mint.razorpay.presenter.PaymentValidationViewInterface;
import com.htmedia.mint.ui.activity.HomeActivity;
import com.htmedia.mint.utils.f0;
import com.htmedia.mint.utils.n;
import com.htmedia.mint.utils.o0;
import com.htmedia.mint.utils.q;
import com.htmedia.mint.utils.s0;
import com.htmedia.sso.activities.LoginRegisterActivity;
import com.razorpay.Checkout;
import com.razorpay.PaymentData;
import com.razorpay.PaymentResultWithDataListener;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import com.snowplowanalytics.snowplow.tracker.constants.TrackerConstants;
import com.taboola.android.global_components.eventsmanager.TBLEventType;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import com.zoho.zsm.inapppurchase.core.ZSInAppPurchaseKit;
import com.zoho.zsm.inapppurchase.interfaces.PlanDetailsListener;
import com.zoho.zsm.inapppurchase.interfaces.PurchaseUpdationListener;
import com.zoho.zsm.inapppurchase.model.ZSCustomField;
import com.zoho.zsm.inapppurchase.model.ZSError;
import com.zoho.zsm.inapppurchase.model.ZSPlan;
import com.zoho.zsm.inapppurchase.model.ZSPlanInterval;
import com.zoho.zsm.inapppurchase.model.ZSSuscriptionDetail;
import f6.d;
import in.juspay.hyper.constants.LogCategory;
import in.juspay.hypersdk.core.PaymentConstants;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import k6.c1;
import k6.d1;
import n4.b;
import n4.e;
import org.json.JSONException;
import org.json.JSONObject;
import x4.m;
public class SubscriptionCheckOutPage extends com.htmedia.mint.ui.activity.a implements View.OnClickListener, PaymentResultWithDataListener, OrderCreateViewInterface, GetUserSubscriptionDetail.OnSubscriptionDetail, PurchaseUpdationListener, PaymentValidationViewInterface, d1, PlanDetailsListener {
private static final int SIGN_IN_REQUEST = 1001;
private m activityCheckoutPageBinding;
private double campaignDeviceIdPlanPrice;
private Content content;
private boolean isFromRenewalJouney;
private boolean isOneMonthPlan;
private boolean isOpenThroughCampaignDeviceIdPage;
private boolean isOpenThroughCouponPage;
private boolean isSelected;
private boolean isSubscribeNowButtonClick;
private boolean isTwoYearPlan;
private MintPlan mintPlan;
private MintPlanWithZSPlan mintPlanWithZSPlan;
private MintSubscriptionDetail mintSubscriptionDetail;
private OrderCreatePresenterInterface orderCreatePresenterInterface;
private String orderId;
private ProgressDialog pDialog;
private String partnerCouponCode;
private String partnerPlanCode;
private String partnerPlanType;
private List<String> paymentOption;
private PaymentValidationPresenterInterface paymentValidationPresenterInterface;
private String premiumStory;
private String strCreditCardAutoRecurring;
private String strDefaultPaymentSelection;
private String strUpiAutoRecurring;
private SubsPlans subsPlans;
private q.g0 subsscreen;
private ZSPlan zsPlan;
private String lastAccessUrl = "https://www.livemint.com";
private String funnelName = BuildConfig.FLAVOR;
private String pianoExp = BuildConfig.FLAVOR;
private List<String> checkoutOption = new ArrayList();
private final RadioButton[] radioButtons = new RadioButton[CardIndex.values().length];
static class AnonymousClass1 {
static final int[] $SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex;
static {
int[] iArr = new int[CardIndex.values().length];
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex = iArr;
try {
iArr[CardIndex.FREE_CREDIT_CARD.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[CardIndex.FREE_GOOGLE_PLAY.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[CardIndex.UPI.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[CardIndex.GOOGLE_PLAY.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[CardIndex.NETBANKING.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[CardIndex.CREDIT_CARD.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[CardIndex.WALLET.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}
private enum CardIndex {
FREE_CREDIT_CARD,
FREE_GOOGLE_PLAY,
UPI,
GOOGLE_PLAY,
NETBANKING,
CREDIT_CARD,
WALLET
}
private void autoCheckoutForNewSubscription() {
q.g0 g0Var = this.subsscreen;
if ((g0Var == q.g0.NEW_PLAN_PAGE || g0Var == q.g0.ADVANCE_RENEWAL || g0Var == q.g0.UPGRADE_PLAN_PAGE) && this.mintPlanWithZSPlan.isCouponApplied() && this.mintPlanWithZSPlan.getDiscountPercent() == 100.0d && this.mintPlanWithZSPlan.getDiscountPrice() == 0.0d) {
checkOut();
}
}
private boolean checkCouponForAdvanceRenewal() {
Uri parse;
Set<String> queryParameterNames;
Config g = AppController.j().g();
boolean z = (g == null || g.getSubscription() == null || !g.getSubscription().isCouponEnabled()) ? false : true;
if (!z) {
return z;
}
if (this.subsscreen == q.g0.ADVANCE_RENEWAL) {
MintSubscriptionDetail l = AppController.j().l();
this.mintSubscriptionDetail = l;
String invoiceUrl = l.getInvoiceUrl();
String discountCouponExpiresAt = this.mintSubscriptionDetail.getDiscountCouponExpiresAt();
if (!TextUtils.isEmpty(invoiceUrl) && !TextUtils.isEmpty(discountCouponExpiresAt) && isCouponValidForAdvanceRenewal(discountCouponExpiresAt) && (queryParameterNames = (parse = Uri.parse(invoiceUrl)).getQueryParameterNames()) != null && !queryParameterNames.isEmpty()) {
String queryParameter = parse.getQueryParameter("coupon");
this.partnerCouponCode = queryParameter;
if (!TextUtils.isEmpty(queryParameter)) {
this.isOpenThroughCouponPage = true;
this.partnerPlanCode = this.mintSubscriptionDetail.getPlanCode();
this.partnerPlanType = this.mintSubscriptionDetail.getPlanType();
fetchCouponPlanFromServer();
return true;
}
}
}
return false;
}
private CardIndex checkDefaultFromEnum(String str) {
for (CardIndex cardIndex : CardIndex.values()) {
if (str.equalsIgnoreCase(cardIndex.name())) {
return cardIndex;
}
}
return null;
}
private void checkOut() {
createOrderRequest();
initProgressDialogAndShow();
}
private void checkPaymentMethodForAutoRecurring(MintPlanWithZSPlan mintPlanWithZSPlan) {
q.g0 g0Var = this.subsscreen;
if (g0Var == null || g0Var != q.g0.NEW_PLAN_PAGE) {
return;
}
PianoPlan pianoPlan = mintPlanWithZSPlan != null ? mintPlanWithZSPlan.getPianoPlan() : null;
if (pianoPlan != null) {
this.strDefaultPaymentSelection = pianoPlan.getDefaultPaymentMethod();
List<PaymentMethod> paymentMethod = pianoPlan.getPaymentMethod();
if (paymentMethod == null || paymentMethod.isEmpty()) {
return;
}
Iterator<PaymentMethod> it = paymentMethod.iterator();
while (it.hasNext()) {
PaymentMethod next = it.next();
String str = BuildConfig.FLAVOR;
String type = next != null ? next.getType() : BuildConfig.FLAVOR;
if (!TextUtils.isEmpty(type)) {
q.v valueOf = q.v.valueOf(type);
if (valueOf == q.v.UPI) {
if (next != null) {
str = next.getAutoRecurring();
}
this.strUpiAutoRecurring = str;
} else if (valueOf == q.v.CREDIT_CARD) {
if (next != null) {
str = next.getAutoRecurring();
}
this.strCreditCardAutoRecurring = str;
}
}
}
}
}
private void checkUserLoginStatus() {
if (TextUtils.isEmpty(f0.G1(this, "userToken"))) {
openLoginPage();
} else {
checkUserSubscriptionDetail();
}
}
private void checkUserSubscriptionDetail() {
new GetUserSubscriptionDetail(this, this).fetchUserSubscriptionDetail("subscribenowbutton", q.f0.HT_SUBSCRIPTION, true);
}
private void checkViewFromConfig(View view, View view2, String str) {
List<String> list = this.paymentOption;
if (list == null || list.isEmpty()) {
if (view != null) {
view.setVisibility(0);
view2.setVisibility(0);
return;
}
return;
}
if (view != null) {
if (this.paymentOption.contains(str)) {
view.setVisibility(0);
view2.setVisibility(0);
} else {
view.setVisibility(8);
view2.setVisibility(8);
}
}
}
private void convertMintPlanIntoZOHOPlan(List<SubsPlans> list) {
Config g = AppController.j().g();
String str = BuildConfig.FLAVOR;
if (g != null && g.getSso() != null) {
str = g.getAdFreeSubscription().getAdFreeValue();
}
MintPlanWithZSPlan convertMintPlanIntoZSPlan = ConvertMintPlanIntoZSPlan.convertMintPlanIntoZSPlan(str, this.partnerPlanCode, list);
this.mintPlanWithZSPlan = convertMintPlanIntoZSPlan;
if (convertMintPlanIntoZSPlan == null || convertMintPlanIntoZSPlan.getSubsPlans() == null || this.mintPlanWithZSPlan.getSubsPlans().getPlanDiscount() == null) {
Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try again", 0).show();
goBack();
return;
}
this.mintPlanWithZSPlan.setCouponApplied(true);
this.mintPlanWithZSPlan.setCouponCode(this.partnerCouponCode);
this.mintPlanWithZSPlan.setAdFreePlan(true);
SubscriptionPlanSingleton.getInstance().setMintPlanWithZSPlan(this.mintPlanWithZSPlan);
double priceAfterDiscount = this.mintPlanWithZSPlan.getSubsPlans().getPlanDiscount().getPriceAfterDiscount();
String currencySymbol = this.mintPlanWithZSPlan.getSubsPlans().getCurrencySymbol();
this.mintPlanWithZSPlan.setDiscountPrice(priceAfterDiscount);
this.mintPlanWithZSPlan.setFormatedDiscountPrice(currencySymbol + priceAfterDiscount);
initPage();
if (priceAfterDiscount == 0.0d) {
checkOut();
}
}
private void createOrderRequest() {
String str;
SubsPlans subsPlans = this.subsPlans;
if (subsPlans == null || TextUtils.isEmpty(subsPlans.getPlanCode()) || this.mintSubscriptionDetail == null) {
return;
}
try {
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
String mobile = this.mintSubscriptionDetail.getMobile();
boolean isEmpty = TextUtils.isEmpty(mobile);
String str2 = BuildConfig.FLAVOR;
if (!isEmpty && mobile.contains("+")) {
mobile = mobile.replace("+", BuildConfig.FLAVOR).trim();
}
jSONObject2.put(TBLEventType.DEFAULT, mobile);
jSONObject2.put("displayName", this.mintSubscriptionDetail.getDisplayName());
jSONObject2.put("salutation", this.mintSubscriptionDetail.getSalutation());
jSONObject2.put("firstName", this.mintSubscriptionDetail.getFirstName());
jSONObject2.put("lastName", this.mintSubscriptionDetail.getLastName());
jSONObject2.put("email", this.mintSubscriptionDetail.getEmail());
jSONObject2.put("id", this.mintSubscriptionDetail.getId());
jSONObject2.put("lastAccessUrl", this.lastAccessUrl);
if (this.subsscreen == q.g0.DEVICE_ID_OFFER && this.isOpenThroughCampaignDeviceIdPage) {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("platform", "Android");
jSONObject3.put("device_id", d.b(this));
jSONObject3.put("device_type", "Android");
jSONObject2.put("device_details", jSONObject3);
jSONObject.put("creationMode", "campaign");
}
jSONObject.put("customer", jSONObject2);
if (SubscriptionConverter.isSubscriptionUpgradeOrRenewal(this.subsscreen)) {
jSONObject.put("subscriptionId", this.mintSubscriptionDetail.getSubscriptionID());
}
jSONObject.put("planCode", this.subsPlans.getPlanCode());
if (this.mintPlanWithZSPlan.isCouponApplied()) {
jSONObject.put("couponCode", this.mintPlanWithZSPlan.getCouponCode());
}
jSONObject.put(LogCategory.ACTION, getAction());
boolean isRecurring = isRecurring();
if (isRecurring && this.activityCheckoutPageBinding.M.isChecked()) {
jSONObject.put("paymentMethod", PaymentConstants.WIDGET_UPI);
}
jSONObject.put("recurring", isRecurring ? 1 : 0);
jSONObject.put("countryCode", "IN");
jSONObject.put("city", "others");
jSONObject.put("platform", "Android");
jSONObject.put("sourcePlatform", "ANDROID_RAZORPAY");
jSONObject.put("paymentSource", "Razorpay");
jSONObject.put("redirectionUrl", "https://www.livemint.com");
String generateToken = JWTTokenBuilder.generateToken(this.mintSubscriptionDetail.getId() + "~" + this.mintSubscriptionDetail.getEmail());
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("ProductId", getResources().getString(2131952728));
hashMap.put("SubscriptionAuth", generateToken);
Config g = AppController.j().g();
Razorpay razorpay = g != null ? g.getRazorpay() : null;
String domain = razorpay != null ? razorpay.getDomain() : BuildConfig.FLAVOR;
String orderid = razorpay != null ? razorpay.getOrderid() : BuildConfig.FLAVOR;
if (SubscriptionConverter.isSubscriptionUpgradeOrRenewal(this.subsscreen)) {
if (razorpay != null) {
str2 = razorpay.getChangeplan();
}
orderid = str2;
}
if (orderid.startsWith("http")) {
str = orderid;
} else {
str = domain + orderid;
}
if (SubscriptionConverter.isSubscriptionNew(this.subsscreen)) {
this.orderCreatePresenterInterface.createOrder(1, "OrderApi", str, jSONObject, hashMap, false, false);
} else if (SubscriptionConverter.isSubscriptionUpgradeOrRenewal(this.subsscreen)) {
this.orderCreatePresenterInterface.createOrder(4, "ChangePlan", str, jSONObject, hashMap, false, false);
}
} catch (JSONException unused) {
}
}
private void defaultCheckRadioButton() {
if (this.activityCheckoutPageBinding.y.getVisibility() == 0) {
if (this.activityCheckoutPageBinding.z.getVisibility() == 0) {
setRadioChecked(CardIndex.FREE_CREDIT_CARD.ordinal());
return;
} else if (this.activityCheckoutPageBinding.A.getVisibility() == 0) {
setRadioChecked(CardIndex.FREE_GOOGLE_PLAY.ordinal());
return;
} else {
setIndexAccordingtoConfig();
return;
}
}
List<String> list = this.paymentOption;
if (list != null && list.size() == 1) {
String str = this.paymentOption.get(0);
CardIndex cardIndex = CardIndex.GOOGLE_PLAY;
if (str.equalsIgnoreCase(cardIndex.name())) {
setRadioChecked(cardIndex.ordinal());
return;
}
}
setIndexAccordingtoConfig();
}
private void fetchCouponPlanFromServer() {
JSONObject jSONObject;
String str;
Config g = AppController.j().g();
Razorpay razorpay = g != null ? g.getRazorpay() : null;
String str2 = BuildConfig.FLAVOR;
String couponAPI = razorpay != null ? razorpay.getCouponAPI() : BuildConfig.FLAVOR;
if (this.subsscreen == q.g0.ADVANCE_RENEWAL) {
str = couponAPI + String.format("%1$s?action=advance_renew", this.partnerCouponCode);
JSONObject jSONObject2 = new JSONObject();
try {
jSONObject2.put("displayName", this.mintSubscriptionDetail.getDisplayName());
jSONObject2.put("salutation", this.mintSubscriptionDetail.getSalutation());
jSONObject2.put("firstName", this.mintSubscriptionDetail.getFirstName());
jSONObject2.put("lastName", this.mintSubscriptionDetail.getLastName());
jSONObject2.put("email", this.mintSubscriptionDetail.getEmail());
jSONObject2.put("id", this.mintSubscriptionDetail.getId());
jSONObject2.put("lastAccessUrl", "https://www.livemint.com");
jSONObject2.put("subscriptionId", this.mintSubscriptionDetail.getSubscriptionID());
} catch (Exception unused) {
}
jSONObject = jSONObject2;
} else {
jSONObject = null;
str = couponAPI + String.format("%1$s/IN?plan=%2$s", this.partnerCouponCode, this.partnerPlanCode);
}
if (!str.startsWith("http")) {
if (g.getRazorpay() != null) {
str2 = g.getRazorpay().getDomain();
}
str = str2 + str;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("ProductId", getResources().getString(2131952728));
hashMap.put("Content-Type", TrackerConstants.POST_CONTENT_TYPE);
new c1(this, this).a(4, "FetchCouponPlan", str, hashMap, jSONObject, false, true, this.isOpenThroughCouponPage, this.partnerPlanType);
}
private void fetchPlan() {
if (this.mintPlanWithZSPlan == null) {
this.mintPlanWithZSPlan = SubscriptionPlanSingleton.getInstance().getMintPlanWithZSPlan();
}
if (this.mintPlanWithZSPlan != null) {
initPlanInfo();
return;
}
q.g0 g0Var = this.subsscreen;
if (g0Var == q.g0.ADVANCE_RENEWAL || g0Var == q.g0.PARTNER_PAGE) {
fetchPlanFromServer();
} else {
planNotFetchGoBack();
}
}
private void fetchPlanFromServer() {
initProgressDialogAndShow();
Config g = AppController.j().g();
String str = (g.getSso() != null ? g.getSso().getPlanFetch() : BuildConfig.FLAVOR) + "?device=android&country=IN";
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("ProductId", getResources().getString(2131952728));
new c1(this, this).a(0, "FetchPlan", str, hashMap, null, false, false, this.isOpenThroughCouponPage, BuildConfig.FLAVOR);
}
private MintPlanWithZSPlan filterUserCurrentPlan(ArrayList<MintPlanWithZSPlan> arrayList) {
String planCode = this.mintSubscriptionDetail.getPlanCode();
Iterator<MintPlanWithZSPlan> it = arrayList.iterator();
while (it.hasNext()) {
MintPlanWithZSPlan next = it.next();
SubsPlans subsPlans = next.getSubsPlans();
ZSPlan zsPlan = next.getZsPlan();
if (subsPlans != null && zsPlan != null) {
String planCode2 = subsPlans.getPlanCode();
if (!TextUtils.isEmpty(planCode2) && planCode2.equalsIgnoreCase(planCode)) {
return next;
}
}
}
return null;
}
private String getAction() {
MintSubscriptionDetail mintSubscriptionDetail;
MintPlanWithZSPlan mintPlanWithZSPlan;
q.g0 g0Var = this.subsscreen;
if (g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE) {
return "trial";
}
if (g0Var == q.g0.NEW_PLAN_PAGE && (mintPlanWithZSPlan = this.mintPlanWithZSPlan) != null && mintPlanWithZSPlan.isTrialCoupon() && this.mintPlanWithZSPlan.isCouponApplied()) {
return TextUtils.isEmpty(this.mintPlanWithZSPlan.getDiscountType()) ? "trial" : this.mintPlanWithZSPlan.getDiscountType();
}
if ((this.mintSubscriptionDetail == null && this.activityCheckoutPageBinding.I.isChecked()) || ((mintSubscriptionDetail = this.mintSubscriptionDetail) != null && !mintSubscriptionDetail.isTrialTaken() && this.activityCheckoutPageBinding.I.isChecked())) {
return "trial";
}
q.g0 g0Var2 = this.subsscreen;
if (g0Var2 == q.g0.MANAGE_PLAN_PAGE) {
return "change";
}
if (g0Var2 != q.g0.ADVANCE_RENEWAL) {
return g0Var2 == q.g0.UPGRADE_PLAN_PAGE ? "upgrade" : "subscribe";
}
MintSubscriptionDetail mintSubscriptionDetail2 = this.mintSubscriptionDetail;
return (mintSubscriptionDetail2 == null || !mintSubscriptionDetail2.isSubscriptionActive()) ? "post_expiry" : "advance_renew";
}
private CardIndex getCardIndex(int i) {
return CardIndex.values()[i];
}
private CardIndex getCardIndexWithNull(int i) {
int length = CardIndex.values().length;
for (int i2 = 0; i2 < length; i2++) {
if (i2 == i) {
return CardIndex.values()[i2];
}
}
return null;
}
private int getFreeTrailDays(String str) {
return ConvertFreeTrialIntoDays.parse(str);
}
private int getSelectedIndex() {
int i = 0;
while (true) {
RadioButton[] radioButtonArr = this.radioButtons;
if (i >= radioButtonArr.length) {
return CardIndex.CREDIT_CARD.ordinal();
}
if (radioButtonArr[i].isChecked()) {
return i;
}
i++;
}
}
private String getSubscribeNowBtnCta() {
return this.subsscreen == q.g0.MANAGE_PLAN_PAGE ? "Change Plan Subscribe Now Click" : "Payment Initiated";
}
private String getUserSubscriptionStatus() {
q.g0 g0Var = this.subsscreen;
return (g0Var == q.g0.NEW_PLAN_PAGE || g0Var == q.g0.PARTNER_PAGE || g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE) ? "new" : (g0Var == q.g0.MANAGE_PLAN_PAGE || g0Var == q.g0.UPGRADE_PLAN_PAGE) ? "upgraded" : g0Var == q.g0.ADVANCE_RENEWAL ? "advance_renew" : BuildConfig.FLAVOR;
}
private HashMap<String, String> getValueFromErrorMessage(HashMap<String, String> hashMap, JSONObject jSONObject, String str) {
hashMap.put("code", jSONObject.optString("code"));
hashMap.put(Parameters.CD_DESCRIPTION, jSONObject.optString(Parameters.CD_DESCRIPTION));
hashMap.put("source", jSONObject.optString("source"));
hashMap.put("step", jSONObject.optString("step"));
hashMap.put("reason", jSONObject.optString("reason"));
JSONObject optJSONObject = jSONObject.optJSONObject("metadata");
hashMap.put("razorpay_payment_id", optJSONObject != null ? optJSONObject.optString("payment_id") : BuildConfig.FLAVOR);
String optString = optJSONObject != null ? optJSONObject.optString(PaymentConstants.ORDER_ID) : str;
if (!TextUtils.isEmpty(str)) {
str = optString;
}
hashMap.put("razorpay_order_id", str);
return hashMap;
}
private boolean getVisibleAndCheckedOption() {
int i = 0;
while (true) {
RadioButton[] radioButtonArr = this.radioButtons;
if (i >= radioButtonArr.length) {
i = -1;
break;
}
if (radioButtonArr[i].isChecked()) {
break;
}
i++;
}
CardIndex cardIndexWithNull = getCardIndexWithNull(i);
if (cardIndexWithNull != null) {
switch (AnonymousClass1.$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[cardIndexWithNull.ordinal()]) {
case 1:
if (this.activityCheckoutPageBinding.z.getVisibility() == 0) {
return true;
}
break;
case 2:
if (this.activityCheckoutPageBinding.A.getVisibility() == 0) {
return true;
}
break;
case 3:
if (this.activityCheckoutPageBinding.D.getVisibility() == 0) {
return true;
}
break;
case 4:
if (this.activityCheckoutPageBinding.B.getVisibility() == 0) {
return true;
}
break;
case 5:
if (this.activityCheckoutPageBinding.C.getVisibility() == 0) {
return true;
}
break;
case 6:
if (this.activityCheckoutPageBinding.x.getVisibility() == 0) {
return true;
}
break;
case 7:
if (this.activityCheckoutPageBinding.E.getVisibility() == 0) {
return true;
}
break;
}
}
return false;
}
private void goBack() {
if ((getIntent().getExtras() != null && getIntent().getExtras().containsKey("isNotification") && getIntent().getExtras().getInt("isNotification") > q.m.SPLASH.ordinal()) || this.subsscreen == q.g0.PARTNER_PAGE) {
startActivity(new Intent((Context) this, (Class<?>) HomeActivity.class));
}
setSubscriptionIntent();
finish();
}
private void goBackWithoutSubscription() {
if ((getIntent().getExtras() != null && getIntent().getExtras().containsKey("isNotification") && getIntent().getExtras().getInt("isNotification") > q.m.SPLASH.ordinal()) || this.subsscreen == q.g0.PARTNER_PAGE) {
startActivity(new Intent((Context) this, (Class<?>) HomeActivity.class));
}
finish();
}
private void handlePartnerPages() {
Bundle extras = getIntent().getExtras();
if (extras == null || !extras.containsKey("urlkey") || !extras.containsKey("FromPartner")) {
initPage();
return;
}
String string = extras.getString("urlkey", BuildConfig.FLAVOR);
if (TextUtils.isEmpty(string)) {
return;
}
Uri parse = Uri.parse(string);
parse.getHost();
parse.getScheme();
if (!parse.getPath().equalsIgnoreCase(s0.PARTNER_PLANS.b())) {
goBack();
return;
}
Set<String> queryParameterNames = parse.getQueryParameterNames();
if (queryParameterNames == null || queryParameterNames.isEmpty()) {
goBack();
return;
}
this.partnerPlanCode = parse.getQueryParameter("code");
this.partnerPlanType = parse.getQueryParameter(Parameters.UT_CATEGORY);
this.partnerCouponCode = parse.getQueryParameter("coupon");
if (TextUtils.isEmpty(this.partnerPlanCode) || TextUtils.isEmpty(this.partnerPlanType) || TextUtils.isEmpty(this.partnerCouponCode)) {
goBack();
} else {
this.isOpenThroughCouponPage = true;
checkUserLoginStatus();
}
}
private void initCheckoutPage() {
if (this.subsscreen == q.g0.NEW_PLAN_PAGE) {
MintSubscriptionDetail mintSubscriptionDetail = this.mintSubscriptionDetail;
if (mintSubscriptionDetail == null || !((mintSubscriptionDetail == null || mintSubscriptionDetail.isTrialTaken()) && this.mintSubscriptionDetail.isSubscriptionActive())) {
Config g = AppController.j().g();
if (!((g == null || g.getRazorpay() == null || !g.getRazorpay().isTrialPaymentEnabled()) ? false : true)) {
this.activityCheckoutPageBinding.y.setVisibility(8);
this.activityCheckoutPageBinding.z.setVisibility(8);
}
} else {
this.activityCheckoutPageBinding.y.setVisibility(8);
this.activityCheckoutPageBinding.A.setVisibility(8);
this.activityCheckoutPageBinding.B.setVisibility(8);
this.activityCheckoutPageBinding.f.setVisibility(8);
}
if (this.isTwoYearPlan) {
this.activityCheckoutPageBinding.e.setVisibility(8);
this.activityCheckoutPageBinding.A.setVisibility(8);
this.activityCheckoutPageBinding.B.setVisibility(8);
this.activityCheckoutPageBinding.f.setVisibility(8);
} else if (this.isOneMonthPlan) {
this.activityCheckoutPageBinding.e.setVisibility(8);
this.activityCheckoutPageBinding.A.setVisibility(8);
this.activityCheckoutPageBinding.B.setVisibility(8);
this.activityCheckoutPageBinding.f.setVisibility(8);
this.activityCheckoutPageBinding.E.setVisibility(8);
this.activityCheckoutPageBinding.i.setVisibility(8);
this.activityCheckoutPageBinding.C.setVisibility(8);
this.activityCheckoutPageBinding.g.setVisibility(8);
this.activityCheckoutPageBinding.x.setVisibility(8);
this.activityCheckoutPageBinding.h.setVisibility(8);
}
} else {
this.activityCheckoutPageBinding.y.setVisibility(8);
this.activityCheckoutPageBinding.A.setVisibility(8);
this.activityCheckoutPageBinding.B.setVisibility(8);
this.activityCheckoutPageBinding.f.setVisibility(8);
}
if (this.activityCheckoutPageBinding.z.getVisibility() == 8 && this.activityCheckoutPageBinding.A.getVisibility() == 8) {
this.activityCheckoutPageBinding.y.setVisibility(8);
}
m mVar = this.activityCheckoutPageBinding;
mVar.d(Boolean.valueOf(mVar.y.getVisibility() == 0));
}
private void initCheckoutPoints() {
Config g = AppController.j().g();
this.checkoutOption = (g == null || g.getRazorpay() == null) ? null : g.getRazorpay().getCheckoutPagePoints();
LayoutInflater from = LayoutInflater.from(this);
this.activityCheckoutPageBinding.G.removeAllViews();
List<String> list = this.checkoutOption;
if (list != null) {
for (String str : list) {
if (!TextUtils.isEmpty(str)) {
View inflate = from.inflate(2131624749, (ViewGroup) null, false);
((TextView) inflate.findViewById(2131431686)).setText(Html.fromHtml(str));
this.activityCheckoutPageBinding.G.addView(inflate);
}
}
}
}
private void initPage() {
setClickListener();
setUserInfo();
fetchPlan();
autoCheckoutForNewSubscription();
}
private void initPaymentOptions() {
Config g = AppController.j().g();
q.g0 g0Var = this.subsscreen;
List<String> list = null;
if (g0Var != null && (g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE)) {
if (g != null && g.getRazorpay() != null) {
list = g.getRazorpay().getDeviceIdpaymentOption();
}
this.paymentOption = list;
} else if (g0Var == null || g0Var != q.g0.NEW_PLAN_PAGE) {
if (g != null && g.getRazorpay() != null) {
list = g.getRazorpay().getPaymentOption();
}
this.paymentOption = list;
} else {
List<String> paymentOptions = SubscriptionPlanSingleton.getInstance().getPaymentOptions();
this.paymentOption = paymentOptions;
if (paymentOptions == null || (paymentOptions != null && paymentOptions.isEmpty())) {
if (g != null && g.getRazorpay() != null) {
list = g.getRazorpay().getPaymentOption();
}
this.paymentOption = list;
}
}
initRadioButton();
if (this.isFromRenewalJouney) {
return;
}
initCheckoutPoints();
}
private void initPlanInfo() {
MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
if (mintPlanWithZSPlan != null) {
checkPaymentMethodForAutoRecurring(mintPlanWithZSPlan);
this.zsPlan = this.mintPlanWithZSPlan.getZsPlan();
this.subsPlans = this.mintPlanWithZSPlan.getSubsPlans();
this.activityCheckoutPageBinding.h(Boolean.valueOf(isUPIRecurring()));
q.g0 g0Var = this.subsscreen;
if (g0Var == null || !(g0Var == q.g0.NEW_PLAN_PAGE || g0Var == q.g0.ADVANCE_RENEWAL || g0Var == q.g0.UPGRADE_PLAN_PAGE)) {
this.activityCheckoutPageBinding.c(Boolean.FALSE);
this.activityCheckoutPageBinding.d.setVisibility(8);
} else {
boolean isCCDCRecurring = isCCDCRecurring();
this.activityCheckoutPageBinding.c(Boolean.valueOf(isCCDCRecurring));
if (isCCDCRecurring) {
this.activityCheckoutPageBinding.d.setVisibility(0);
} else {
this.activityCheckoutPageBinding.d.setVisibility(8);
}
}
setPlanName();
}
this.isTwoYearPlan = isTwoYearPlan(this.subsPlans);
initCheckoutPage();
defaultCheckRadioButton();
setupToolbarAndDrawer("payment options".toUpperCase());
setFreeTrialExpryDate();
}
private void initProgressDialogAndShow() {
ProgressDialog progressDialog = this.pDialog;
if (progressDialog != null && !progressDialog.isShowing()) {
this.pDialog.show();
return;
}
if (this.pDialog == null) {
ProgressDialog progressDialog2 = new ProgressDialog(this);
this.pDialog = progressDialog2;
progressDialog2.setMessage("Please wait...!");
this.pDialog.setCancelable(false);
if (this.pDialog.isShowing()) {
return;
}
this.pDialog.show();
}
}
private void initRadioButton() {
for (int i = 0; i < this.radioButtons.length; i++) {
CardIndex cardIndex = getCardIndex(i);
switch (AnonymousClass1.$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[cardIndex.ordinal()]) {
case 1:
RadioButton[] radioButtonArr = this.radioButtons;
m mVar = this.activityCheckoutPageBinding;
radioButtonArr[i] = mVar.I;
checkViewFromConfig(mVar.z, mVar.e, cardIndex.name());
break;
case 2:
RadioButton[] radioButtonArr2 = this.radioButtons;
m mVar2 = this.activityCheckoutPageBinding;
radioButtonArr2[i] = mVar2.J;
checkViewFromConfig(mVar2.A, mVar2.e, cardIndex.name());
break;
case 3:
RadioButton[] radioButtonArr3 = this.radioButtons;
m mVar3 = this.activityCheckoutPageBinding;
radioButtonArr3[i] = mVar3.M;
checkViewFromConfig(mVar3.D, mVar3.h, cardIndex.name());
break;
case 4:
RadioButton[] radioButtonArr4 = this.radioButtons;
m mVar4 = this.activityCheckoutPageBinding;
radioButtonArr4[i] = mVar4.K;
checkViewFromConfig(mVar4.B, mVar4.f, cardIndex.name());
break;
case 5:
RadioButton[] radioButtonArr5 = this.radioButtons;
m mVar5 = this.activityCheckoutPageBinding;
radioButtonArr5[i] = mVar5.L;
checkViewFromConfig(mVar5.C, mVar5.g, cardIndex.name());
break;
case 6:
RadioButton[] radioButtonArr6 = this.radioButtons;
m mVar6 = this.activityCheckoutPageBinding;
radioButtonArr6[i] = mVar6.H;
checkViewFromConfig(mVar6.x, mVar6.h, cardIndex.name());
break;
case 7:
RadioButton[] radioButtonArr7 = this.radioButtons;
m mVar7 = this.activityCheckoutPageBinding;
radioButtonArr7[i] = mVar7.N;
checkViewFromConfig(mVar7.E, mVar7.i, cardIndex.name());
break;
}
}
isFreeTrialOptionVisible();
}
private void initVar() {
this.orderCreatePresenterInterface = new OrderCreatePresenter(this, this);
this.paymentValidationPresenterInterface = new PaymentValidationPresenter(this, this);
this.lastAccessUrl = TextUtils.isEmpty(SubscriptionPlanSingleton.getInstance().getLastAccessUrl()) ? this.lastAccessUrl : SubscriptionPlanSingleton.getInstance().getLastAccessUrl();
this.funnelName = SubscriptionPlanSingleton.getInstance().getFunnelName();
this.premiumStory = SubscriptionPlanSingleton.getInstance().getPremiumStory();
this.subsscreen = SubscriptionPlanSingleton.getInstance().getSubsscreen();
this.pianoExp = SubscriptionPlanSingleton.getInstance().getPianoExpName();
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("campaigndeviceid")) {
this.isOpenThroughCampaignDeviceIdPage = extras.getBoolean("campaigndeviceid", false);
}
if (extras != null && extras.containsKey("KeyPlanPrice")) {
this.campaignDeviceIdPlanPrice = extras.getDouble("KeyPlanPrice", 0.0d);
}
initPaymentOptions();
this.activityCheckoutPageBinding.e(Boolean.valueOf(!SubscriptionConverter.isSubscriptionUpgrade(this.subsscreen)));
}
private void initiatePayment(MintSubscriptionDetail mintSubscriptionDetail) {
subscribeButtonReset();
ZSPlan zSPlan = this.zsPlan;
if (zSPlan != null) {
SnowplowSubscriptionAnalytices.trackSubscribeNowButtonClick(zSPlan.code.startsWith("wsj_"), this.zsPlan);
String storeOrderId = (mintSubscriptionDetail == null || mintSubscriptionDetail.getSource() == null || mintSubscriptionDetail.getSource() != SubscriptionSource.playstore) ? BuildConfig.FLAVOR : mintSubscriptionDetail.getStoreOrderId();
String str = TextUtils.isEmpty(storeOrderId) ? BuildConfig.FLAVOR : storeOrderId;
if (str.equalsIgnoreCase("unknown")) {
return;
}
ZohoInAppConfig.getInAppPurchaseKit();
ArrayList<ZSCustomField> arrayList = new ArrayList<>();
arrayList.add(new ZSCustomField("cf_localized_currency", this.zsPlan.getSkuDetails().d()));
arrayList.add(new ZSCustomField("cf_eco_new_app", "yes"));
ZSInAppPurchaseKit.getInstance().initiateNewPurchase(this, this.zsPlan, str, arrayList, this);
}
}
private boolean isCCDCRecurring() {
q.g0 g0Var = this.subsscreen;
if (g0Var != null && g0Var == q.g0.NEW_PLAN_PAGE && !TextUtils.isEmpty(this.strCreditCardAutoRecurring)) {
return "1".equalsIgnoreCase(this.strCreditCardAutoRecurring.trim()) || "true".equalsIgnoreCase(this.strCreditCardAutoRecurring.trim());
}
Config g = AppController.j().g();
return (g == null || g.getRazorpay() == null || !g.getRazorpay().isCCDCRecurring()) ? false : true;
}
private boolean isCouponValidForAdvanceRenewal(String str) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
return !simpleDateFormat.parse(simpleDateFormat.format(Calendar.getInstance().getTime())).after(simpleDateFormat.parse(str));
} catch (Exception unused) {
return false;
}
}
private void isFreeTrialOptionVisible() {
if (this.activityCheckoutPageBinding.z.getVisibility() == 0 || this.activityCheckoutPageBinding.A.getVisibility() == 0) {
this.activityCheckoutPageBinding.y.setVisibility(0);
} else {
this.activityCheckoutPageBinding.y.setVisibility(8);
}
}
private boolean isOneMonthPlan(SubsPlans subsPlans) {
if (subsPlans != null) {
return subsPlans.getInterval() == 1 && SubscriptionConverter.setPlanInterval(subsPlans.getIntervalUnit()) == PlanInterval.months;
}
return false;
}
private boolean isPayFromGooglePlay() {
return (this.activityCheckoutPageBinding.B.getVisibility() == 0 && this.activityCheckoutPageBinding.K.isChecked()) || (this.activityCheckoutPageBinding.A.getVisibility() == 0 && this.activityCheckoutPageBinding.J.isChecked());
}
private SubsPlans isPlanActiveOnMintServer(String str, List<SubsPlans> list) {
if (list == null || list.size() <= 0) {
return null;
}
for (SubsPlans subsPlans : list) {
if (str.equalsIgnoreCase(subsPlans.getPlanCode()) && "active".equalsIgnoreCase(subsPlans.getStatus())) {
return subsPlans;
}
}
return null;
}
private boolean isPlanHasFreeTrial(ZSPlan zSPlan) {
SkuDetails skuDetails;
return (zSPlan == null || (skuDetails = zSPlan.skuDetails) == null || TextUtils.isEmpty(skuDetails.b())) ? false : true;
}
private boolean isRecurring() {
q.g0 g0Var = this.subsscreen;
if (g0Var != null && (g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE)) {
return true;
}
if (this.activityCheckoutPageBinding.I.isChecked()) {
Config g = AppController.j().g();
return (g == null || g.getRazorpay() == null || !g.getRazorpay().isCCDCRecurring()) ? false : true;
}
if (this.activityCheckoutPageBinding.H.isChecked()) {
return isUserSelectCCDCRecurring();
}
if (this.activityCheckoutPageBinding.M.isChecked()) {
return isUPIRecurring();
}
return false;
}
private boolean isTwoYearPlan(SubsPlans subsPlans) {
if (subsPlans == null) {
return false;
}
long interval = subsPlans.getInterval();
PlanInterval planInterval = SubscriptionConverter.setPlanInterval(subsPlans.getIntervalUnit());
return (interval == 2 && planInterval == PlanInterval.years) || (interval == 24 && planInterval == PlanInterval.months);
}
private boolean isUPIRecurring() {
SubsPlans subsPlans = this.subsPlans;
if (subsPlans != null && subsPlans.getRecurringPrice() >= 5000.0d) {
return false;
}
q.g0 g0Var = this.subsscreen;
if (g0Var != null && g0Var == q.g0.NEW_PLAN_PAGE && !TextUtils.isEmpty(this.strUpiAutoRecurring)) {
return "1".equalsIgnoreCase(this.strUpiAutoRecurring.trim()) || "true".equalsIgnoreCase(this.strUpiAutoRecurring.trim());
}
Config g = AppController.j().g();
return (g == null || g.getRazorpay() == null || !g.getRazorpay().isUPIRecurring()) ? false : true;
}
private boolean isUserSelectCCDCRecurring() {
return isCCDCRecurring() && (this.activityCheckoutPageBinding.d.getVisibility() == 0) && this.activityCheckoutPageBinding.d.isChecked();
}
private ArrayList<MintPlanWithZSPlan> mapZOHOActivePlanWithMintPlan(MintPlan mintPlan, ArrayList<ZSPlan> arrayList) {
ZSCustomField zSCustomFieldWRTKey;
ArrayList<MintPlanWithZSPlan> arrayList2 = new ArrayList<>();
Plans plans = mintPlan != null ? mintPlan.getPlans() : null;
Iterator<ZSPlan> it = arrayList.iterator();
while (it.hasNext()) {
ZSPlan next = it.next();
String status = next.getStatus();
Objects.requireNonNull(status);
if (status.equalsIgnoreCase("active") && (zSCustomFieldWRTKey = SubscriptionConverter.getZSCustomFieldWRTKey("cf_plan_category", next.getCustomFields())) != null) {
String value = zSCustomFieldWRTKey.getValue();
String planCategory = SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory();
String planCategory2 = SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory();
if (value.equalsIgnoreCase(planCategory) || value.equalsIgnoreCase(planCategory2)) {
if (plans != null) {
List<SubsPlans> mintOnly = plans.getMintOnly();
List<SubsPlans> mintWsj = plans.getMintWsj();
String code = next.getCode();
SubsPlans isPlanActiveOnMintServer = isPlanActiveOnMintServer(code, mintOnly);
if (isPlanActiveOnMintServer == null) {
isPlanActiveOnMintServer = isPlanActiveOnMintServer(code, mintWsj);
}
if (isPlanActiveOnMintServer != null) {
MintPlanWithZSPlan mintPlanWithZSPlan = new MintPlanWithZSPlan();
mintPlanWithZSPlan.setZsPlan(next);
mintPlanWithZSPlan.setSubsPlans(isPlanActiveOnMintServer);
arrayList2.add(mintPlanWithZSPlan);
}
}
}
}
}
if (plans != null) {
Config g = AppController.j().g();
String str = BuildConfig.FLAVOR;
if (g != null && g.getSso() != null) {
str = g.getAdFreeSubscription().getAdFreeValue();
}
MintPlanWithZSPlan convertMintPlanIntoZSPlan = ConvertMintPlanIntoZSPlan.convertMintPlanIntoZSPlan(str, ConvertMintPlanIntoZSPlan.MINT_PLAN_CODES.LM_BI.getPlan(), plans.getMintOnly());
if (convertMintPlanIntoZSPlan != null) {
arrayList2.add(convertMintPlanIntoZSPlan);
}
MintPlanWithZSPlan convertMintPlanIntoZSPlan2 = ConvertMintPlanIntoZSPlan.convertMintPlanIntoZSPlan(str, ConvertMintPlanIntoZSPlan.MINT_PLAN_CODES.WSJ_BI.getPlan(), plans.getMintWsj());
if (convertMintPlanIntoZSPlan2 != null) {
arrayList2.add(convertMintPlanIntoZSPlan2);
}
}
return arrayList2;
}
private void openOnboardingFlow() {
SubscriptionTrigger.openOnBoardJourneyVideo(this);
}
private JSONObject parseErrorJson(String str, String str2, JSONObject jSONObject) {
HashMap<String, String> valueFromErrorMessage;
HashMap<String, String> hashMap = new HashMap<>();
if (!str.contains("=")) {
if (!TextUtils.isEmpty(str)) {
try {
JSONObject jSONObject2 = new JSONObject(str);
JSONObject optJSONObject = jSONObject2.optJSONObject("error");
valueFromErrorMessage = optJSONObject == null ? getValueFromErrorMessage(hashMap, jSONObject2, str2) : getValueFromErrorMessage(hashMap, optJSONObject, str2);
} catch (JSONException e) {
e.printStackTrace();
}
}
return setErrorValueOnJsonObject(hashMap, jSONObject);
}
String[] split = str.split("=");
if (split != null && split.length > 1) {
String str3 = split[1];
if (!TextUtils.isEmpty(str3)) {
try {
JSONObject jSONObject3 = new JSONObject(str3);
JSONObject optJSONObject2 = jSONObject3.optJSONObject("error");
valueFromErrorMessage = optJSONObject2 == null ? getValueFromErrorMessage(hashMap, jSONObject3, str2) : getValueFromErrorMessage(hashMap, optJSONObject2, str2);
} catch (JSONException e2) {
e2.printStackTrace();
}
}
}
return setErrorValueOnJsonObject(hashMap, jSONObject);
hashMap = valueFromErrorMessage;
return setErrorValueOnJsonObject(hashMap, jSONObject);
}
private void payViaGooglePlay() {
new GetUserSubscriptionDetail(this, this).fetchUserSubscriptionDetail("subscribenowbutton", q.f0.ZOHO_VALIDATION, true);
}
private void planNotFetchGoBack() {
dismissProgressDialog();
if (this.mintPlanWithZSPlan == null) {
goBack();
Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later", 0).show();
}
}
private void setClickListener() {
this.activityCheckoutPageBinding.a.setOnClickListener(this);
this.activityCheckoutPageBinding.B.setOnClickListener(this);
this.activityCheckoutPageBinding.x.setOnClickListener(this);
this.activityCheckoutPageBinding.C.setOnClickListener(this);
this.activityCheckoutPageBinding.D.setOnClickListener(this);
this.activityCheckoutPageBinding.A.setOnClickListener(this);
this.activityCheckoutPageBinding.z.setOnClickListener(this);
this.activityCheckoutPageBinding.E.setOnClickListener(this);
this.activityCheckoutPageBinding.g0.setOnClickListener(this);
}
private JSONObject setErrorValueOnJsonObject(HashMap<String, String> hashMap, JSONObject jSONObject) {
for (String str : hashMap.keySet()) {
try {
jSONObject.put(str, hashMap.get(str));
} catch (JSONException unused) {
}
}
return jSONObject;
}
private void setFreeTrialExpryDate() {
ZSPlan zSPlan = this.zsPlan;
if (zSPlan != null) {
String N2 = f0.N2(zSPlan.getSkuDetails().d());
Calendar calendar = Calendar.getInstance();
Config g = AppController.j().g();
int i = 0;
if (g != null && g.getSubscription() != null) {
i = g.getSubscription().getSubscriptionTrialDays();
}
calendar.add(6, i);
String format = new SimpleDateFormat("dd MMM yyyy").format(calendar.getTime());
String str = "We will continue your plan & charge <b><font color='black'>" + N2 + "</b> on <b><font color='black'>" + format + "</b> through your Debit or Credit Card untill you cancel your plan";
if (AppController.j().E()) {
str = "We will continue your plan & charge <b><font color='#ffffff'>" + N2 + "</b> on <b><font color='#ffffff'>" + format + "</b> through your Debit or Credit Card untill you cancel your plan";
}
this.activityCheckoutPageBinding.X.setText(Html.fromHtml(str), TextView.BufferType.SPANNABLE);
}
}
private void setIndexAccordingtoConfig() {
List<String> list;
List<String> list2;
Config g = AppController.j().g();
String defaultPaymentOptionSelected = (g == null || g.getRazorpay() == null) ? BuildConfig.FLAVOR : g.getRazorpay().getDefaultPaymentOptionSelected();
boolean isUPIRecurring = isUPIRecurring();
if (!TextUtils.isEmpty(this.strDefaultPaymentSelection) && checkDefaultFromEnum(this.strDefaultPaymentSelection) != null && (list2 = this.paymentOption) != null && !list2.isEmpty() && this.paymentOption.contains(this.strDefaultPaymentSelection)) {
CardIndex valueOf = CardIndex.valueOf(this.strDefaultPaymentSelection);
if (valueOf != null) {
setRadioChecked(valueOf.ordinal());
return;
} else if (isUPIRecurring) {
setRadioChecked(CardIndex.UPI.ordinal());
return;
} else {
setRadioChecked(CardIndex.CREDIT_CARD.ordinal());
return;
}
}
if (TextUtils.isEmpty(defaultPaymentOptionSelected) || checkDefaultFromEnum(defaultPaymentOptionSelected) == null || (list = this.paymentOption) == null || list.isEmpty() || !this.paymentOption.contains(defaultPaymentOptionSelected)) {
if (isUPIRecurring) {
setRadioChecked(CardIndex.UPI.ordinal());
return;
} else {
setRadioChecked(CardIndex.CREDIT_CARD.ordinal());
return;
}
}
CardIndex valueOf2 = CardIndex.valueOf(defaultPaymentOptionSelected);
if (valueOf2 != null) {
setRadioChecked(valueOf2.ordinal());
} else if (isUPIRecurring) {
setRadioChecked(CardIndex.UPI.ordinal());
} else {
setRadioChecked(CardIndex.CREDIT_CARD.ordinal());
}
}
private void setMonthlyAmount(double d, int i, String str) {
int ceil = (int) Math.ceil(d / i);
if (i > 1) {
this.activityCheckoutPageBinding.S.setText(str + ceil + "/month x " + i + " months");
return;
}
this.activityCheckoutPageBinding.S.setText(str + ceil + "/month x " + i + " month");
}
private void setPlanName() {
if (this.subsPlans != null) {
this.activityCheckoutPageBinding.T.setText(this.subsPlans.getName() + " " + this.subsPlans.getDescription());
}
}
private void setRadioButtonTheme() {
ColorStateList colorStateList = new ColorStateList(new int[][]{new int[]{-16842912}, new int[]{R.attr.state_checked}}, new int[]{Color.parseColor("#979797"), Color.parseColor("#F7941D")});
this.activityCheckoutPageBinding.J.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.K.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.H.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.L.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.M.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.I.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.N.setButtonTintList(colorStateList);
this.activityCheckoutPageBinding.J.invalidate();
this.activityCheckoutPageBinding.K.invalidate();
this.activityCheckoutPageBinding.H.invalidate();
this.activityCheckoutPageBinding.M.invalidate();
this.activityCheckoutPageBinding.I.invalidate();
this.activityCheckoutPageBinding.L.invalidate();
this.activityCheckoutPageBinding.N.invalidate();
}
@SuppressLint({"DefaultLocale"})
private void setRadioChecked(int i) {
updatePriceOnTextView(i);
if (i == CardIndex.FREE_CREDIT_CARD.ordinal()) {
Config g = AppController.j().g();
int subscriptionTrialDays = (g == null || g.getSubscription() == null) ? 0 : g.getSubscription().getSubscriptionTrialDays();
if (subscriptionTrialDays > 0) {
this.activityCheckoutPageBinding.a.setText(String.format("Start %1$s Days Trial", Integer.valueOf(subscriptionTrialDays)));
} else {
this.activityCheckoutPageBinding.a.setText(2131952583);
}
} else if (i == CardIndex.FREE_GOOGLE_PLAY.ordinal()) {
ZSPlan zSPlan = this.zsPlan;
if (zSPlan != null && zSPlan.getSkuDetails() != null) {
if (isPlanHasFreeTrial(this.zsPlan)) {
this.activityCheckoutPageBinding.a.setText(String.format("Start %1$s days free trial", Integer.valueOf(getFreeTrailDays(this.zsPlan.getSkuDetails().b()))));
} else {
this.activityCheckoutPageBinding.a.setText(2131952583);
}
}
} else {
this.activityCheckoutPageBinding.a.setText("Pay now");
}
if (this.isSelected) {
return;
}
this.isSelected = true;
int i2 = 0;
while (true) {
RadioButton[] radioButtonArr = this.radioButtons;
if (i2 >= radioButtonArr.length) {
this.isSelected = false;
return;
}
if (i2 == i) {
if (i == CardIndex.GOOGLE_PLAY.ordinal()) {
this.activityCheckoutPageBinding.d0.setVisibility(0);
} else if (i != CardIndex.UPI.ordinal()) {
this.activityCheckoutPageBinding.U.setVisibility(8);
this.activityCheckoutPageBinding.d0.setVisibility(8);
} else if (isUPIRecurring()) {
this.activityCheckoutPageBinding.U.setVisibility(0);
} else {
this.activityCheckoutPageBinding.U.setVisibility(8);
}
this.radioButtons[i2].setChecked(true);
} else {
radioButtonArr[i2].setChecked(false);
}
i2++;
}
}
private void setSubscriptionIntent() {
if (GetSubscriptionIntent.getSubscriptionIntent() != null) {
setResult(-1, GetSubscriptionIntent.getSubscriptionIntent());
}
}
private void setUserInfo() {
MintSubscriptionDetail mintSubscriptionDetail = SubscriptionPlanSingleton.getInstance().getMintSubscriptionDetail();
this.mintSubscriptionDetail = mintSubscriptionDetail;
if (mintSubscriptionDetail == null) {
this.mintSubscriptionDetail = new MintSubscriptionDetail();
}
this.mintSubscriptionDetail.setId(f0.G1(this, "userClient"));
String G1 = f0.G1(this, "userName");
this.mintSubscriptionDetail.setEmail(f0.F1(this));
this.mintSubscriptionDetail.setSalutation(BuildConfig.FLAVOR);
if (TextUtils.isEmpty(G1)) {
this.mintSubscriptionDetail.setDisplayName(BuildConfig.FLAVOR);
this.mintSubscriptionDetail.setFirstName(BuildConfig.FLAVOR);
this.mintSubscriptionDetail.setLastName(BuildConfig.FLAVOR);
} else {
this.mintSubscriptionDetail.setDisplayName(G1);
if (G1.contains(" ")) {
String substring = G1.substring(G1.lastIndexOf(" "));
if (!TextUtils.isEmpty(substring)) {
substring = substring.trim();
}
this.mintSubscriptionDetail.setFirstName(G1.substring(0, G1.lastIndexOf(" ")));
this.mintSubscriptionDetail.setLastName(substring);
} else {
this.mintSubscriptionDetail.setFirstName(G1);
this.mintSubscriptionDetail.setLastName(G1);
}
}
String G12 = f0.G1(this, "userPhoneNumber");
if (!TextUtils.isEmpty(G12) && !G12.contains("+")) {
G12 = "+" + G12;
}
if (TextUtils.isEmpty(G12)) {
this.mintSubscriptionDetail.setMobile(BuildConfig.FLAVOR);
} else {
this.mintSubscriptionDetail.setMobile(G12);
}
}
private void setValueForEventLabel4() {
String planName;
SubsPlans subsPlans;
MintSubscriptionDetail l = AppController.j().l();
String str = BuildConfig.FLAVOR;
if (l == null) {
RenewalAppConstant.eventLabele4Value = "fresh";
RenewalAppConstant.planNameBeforeRenewal = BuildConfig.FLAVOR;
} else {
if (l.getCreatedAt() == null) {
RenewalAppConstant.eventLabele4Value = "fresh";
RenewalAppConstant.planNameBeforeRenewal = BuildConfig.FLAVOR;
} else {
RenewalAppConstant.eventLabele4Value = "renewal";
if (TextUtils.isEmpty(l.getPlanDescription())) {
StringBuilder sb2 = new StringBuilder();
sb2.append(" ");
sb2.append(l);
planName = (sb2.toString() == null || TextUtils.isEmpty(l.getPlanName())) ? BuildConfig.FLAVOR : l.getPlanName();
} else {
planName = l.getPlanDescription();
}
RenewalAppConstant.planNameBeforeRenewal = planName;
RenewalAppConstant.subscriptionNumber = !TextUtils.isEmpty(l.getSubscriptionNumber()) ? l.getSubscriptionNumber() : BuildConfig.FLAVOR;
}
RenewalAppConstant.amountPaidBeforePlan = l.getUpgradedPlanActualPrice();
}
MintPlanWithZSPlan mintPlanWithZSPlan = SubscriptionPlanSingleton.getInstance().getMintPlanWithZSPlan();
if (mintPlanWithZSPlan == null || (subsPlans = mintPlanWithZSPlan.getSubsPlans()) == null) {
return;
}
String renewalDiscount = subsPlans.getPlanDiscount() != null ? subsPlans.getPlanDiscount().getRenewalDiscount() : "0";
if (TextUtils.isEmpty(renewalDiscount)) {
RenewalAppConstant.renewalDiscountForBE = "0";
} else {
RenewalAppConstant.renewalDiscountForBE = renewalDiscount;
}
if (l != null) {
str = e.b(l);
}
RenewalAppConstant.renewalExpiryPeriod = str;
double recurringPrice = subsPlans.getRecurringPrice();
String planCode = subsPlans.getPlanCode();
if (l != null) {
RenewalAppConstant.renewalType = e.g(planCode, l.getPlanCode(), l.getRecurringPrice(), recurringPrice);
}
}
private void setupToolbarAndDrawer(String str) {
Toolbar findViewById = findViewById(2131430942);
findViewById.setContentInsetStartWithNavigation(0);
setSupportActionBar(findViewById);
ActionBar supportActionBar = getSupportActionBar();
Objects.requireNonNull(supportActionBar);
supportActionBar.setDisplayShowTitleEnabled(false);
findViewById.setTitle("back");
this.activityCheckoutPageBinding.e0.setText(str);
if (AppController.j().E()) {
getWindow().setStatusBarColor(-16777216);
getWindow().getDecorView().setSystemUiVisibility(0);
findViewById.setBackgroundColor(getResources().getColor(2131100008));
findViewById.setTitleTextColor(getResources().getColor(2131101002));
findViewById.setNavigationIcon(2131231333);
this.activityCheckoutPageBinding.e0.setTextColor(getResources().getColor(2131101009));
return;
}
getWindow().setStatusBarColor(-1);
getWindow().getDecorView().setSystemUiVisibility(8192);
findViewById.setBackgroundColor(getResources().getColor(2131101002));
findViewById.setTitleTextColor(-16777216);
findViewById.setNavigationIcon(2131231330);
this.activityCheckoutPageBinding.e0.setTextColor(getResources().getColor(2131101008));
}
private void subscribeButtonReset() {
this.isSubscribeNowButtonClick = false;
}
private void syncPaymentWithServer(com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail r20, boolean r21) {
throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.razorpay.ui.SubscriptionCheckOutPage.syncPaymentWithServer(com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail, boolean):void");
}
private void syncSubscriptionSuccess(MintSubscriptionDetail mintSubscriptionDetail) {
q.g0 g0Var;
MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null && ((g0Var = this.subsscreen) == q.g0.NEW_PLAN_PAGE || g0Var == q.g0.ADVANCE_RENEWAL || g0Var == q.g0.PARTNER_PAGE || g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE)) {
CheckSubscriptionFromLocal.updateAdFreeUserFromPlan(mintSubscriptionDetail, this.mintPlanWithZSPlan.getSubsPlans(), this);
}
syncPaymentWithServer(mintSubscriptionDetail, true);
}
private void updatePriceOnTextView(int i) {
String str;
PlanDiscountMS planDiscountMS;
q.g0 g0Var = this.subsscreen;
if (g0Var != null && g0Var == q.g0.MANAGE_PLAN_PAGE) {
this.activityCheckoutPageBinding.F.setVisibility(8);
return;
}
if (g0Var != null && g0Var == q.g0.UPGRADE_PLAN_PAGE) {
if (this.mintPlanWithZSPlan.isCouponApplied()) {
MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
if (mintPlanWithZSPlan != null) {
planDiscountMS = mintPlanWithZSPlan.getPlanCouponDiscountMS();
}
planDiscountMS = null;
} else {
MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
if (mintPlanWithZSPlan2 != null) {
planDiscountMS = mintPlanWithZSPlan2.getPlanDiscountMS();
}
planDiscountMS = null;
}
int toBePaid = planDiscountMS != null ? planDiscountMS.getToBePaid() : 0;
if (toBePaid == 0) {
this.activityCheckoutPageBinding.F.setVisibility(8);
return;
}
MintPlanWithZSPlan mintPlanWithZSPlan3 = this.mintPlanWithZSPlan;
SubsPlans subsPlans = mintPlanWithZSPlan3 != null ? mintPlanWithZSPlan3.getSubsPlans() : null;
if (subsPlans == null) {
this.activityCheckoutPageBinding.F.setVisibility(8);
return;
}
int interval = (int) this.mintPlanWithZSPlan.getSubsPlans().getInterval();
if ("years".equalsIgnoreCase(this.mintPlanWithZSPlan.getSubsPlans().getIntervalUnit())) {
interval *= 12;
}
this.activityCheckoutPageBinding.R.setText("Amount to pay : " + subsPlans.getCurrencySymbol() + toBePaid);
int monthlyPrice = planDiscountMS != null ? planDiscountMS.getMonthlyPrice() : 0;
if (monthlyPrice <= 0) {
setMonthlyAmount(toBePaid, interval, subsPlans.getCurrencySymbol());
return;
}
String currencySymbol = subsPlans.getCurrencySymbol();
if (interval > 1) {
this.activityCheckoutPageBinding.S.setText(currencySymbol + monthlyPrice + "/month x " + interval + " months");
return;
}
this.activityCheckoutPageBinding.S.setText(currencySymbol + monthlyPrice + "/month x " + interval + " month");
return;
}
if (g0Var != null && (g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE)) {
this.activityCheckoutPageBinding.R.setText("Amount to pay : ₹" + ((int) this.campaignDeviceIdPlanPrice) + BuildConfig.FLAVOR);
this.activityCheckoutPageBinding.S.setVisibility(8);
return;
}
this.activityCheckoutPageBinding.S.setVisibility(0);
if (i == CardIndex.FREE_GOOGLE_PLAY.ordinal() || i == CardIndex.GOOGLE_PLAY.ordinal()) {
ZSPlan zSPlan = this.zsPlan;
if (zSPlan == null || zSPlan.getSkuDetails() == null) {
return;
}
String N2 = f0.N2(this.zsPlan.getSkuDetails().d());
this.activityCheckoutPageBinding.R.setText("Amount to pay : " + N2);
int interval2 = this.zsPlan.getInterval();
ZSPlanInterval intervalUnit = this.zsPlan.getIntervalUnit();
if (intervalUnit != null && intervalUnit == ZSPlanInterval.Yearly) {
interval2 *= 12;
}
setMonthlyAmount(this.zsPlan.getSkuDetails().e() / 1000000.0d, interval2, !TextUtils.isEmpty(N2) ? N2.substring(0, 1) : this.zsPlan.getSkuDetails().f());
return;
}
if (this.subsPlans != null) {
int interval3 = (int) this.mintPlanWithZSPlan.getSubsPlans().getInterval();
if ("years".equalsIgnoreCase(this.mintPlanWithZSPlan.getSubsPlans().getIntervalUnit())) {
interval3 *= 12;
}
double recurringPrice = this.subsPlans.getRecurringPrice();
if (this.mintPlanWithZSPlan.isCouponApplied()) {
TextView textView = this.activityCheckoutPageBinding.R;
StringBuilder sb2 = new StringBuilder();
sb2.append("Amount to pay : ");
if (this.mintPlanWithZSPlan.isTrialCoupon()) {
str = "₹1";
} else {
str = this.subsPlans.getCurrencySymbol() + ((int) this.mintPlanWithZSPlan.getDiscountPrice());
}
sb2.append(str);
textView.setText(sb2.toString());
if (this.mintPlanWithZSPlan.isTrialCoupon()) {
this.activityCheckoutPageBinding.S.setVisibility(8);
} else {
recurringPrice = this.mintPlanWithZSPlan.getDiscountPrice();
}
} else {
String str2 = this.subsPlans.getCurrencySymbol() + this.subsPlans.getRecurringPrice();
this.activityCheckoutPageBinding.R.setText("Amount to pay : " + str2);
}
setMonthlyAmount(recurringPrice, interval3, this.subsPlans.getCurrencySymbol());
}
}
private void validateUserSubscriptionAndInitatePayment(MintSubscriptionDetail mintSubscriptionDetail) {
if (mintSubscriptionDetail == null || !mintSubscriptionDetail.isSubscriptionActive()) {
if (this.isOpenThroughCouponPage) {
fetchCouponPlanFromServer();
return;
} else {
initiatePayment(mintSubscriptionDetail);
return;
}
}
AppController.j().V(mintSubscriptionDetail);
f0.c4(this, mintSubscriptionDetail);
subscribeButtonReset();
if (this.isOpenThroughCouponPage) {
goBack();
}
}
private void verifyPayment(boolean z, String str, PaymentData paymentData) {
String str2;
try {
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("email", this.mintSubscriptionDetail.getEmail());
jSONObject2.put("id", this.mintSubscriptionDetail.getId());
jSONObject.put("customer", jSONObject2);
JSONObject jSONObject3 = new JSONObject();
if (z) {
jSONObject3.put("status", "payment_captured");
if (paymentData != null) {
jSONObject3.put("razorpay_payment_id", paymentData.getPaymentId());
jSONObject3.put("razorpay_order_id", paymentData.getOrderId());
jSONObject3.put(PaymentConstants.SIGNATURE, paymentData.getSignature());
}
} else {
jSONObject3.put("status", "payment_failed");
jSONObject3 = parseErrorJson(str, this.orderId, jSONObject3);
if (TextUtils.isEmpty(jSONObject3.optString("razorpay_payment_id"))) {
subscribeButtonReset();
Toast.makeText((Context) this, (CharSequence) "Payment cancelled", 0).show();
dismissProgressDialog();
return;
}
}
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put("platform", "Android");
String s = AppController.j().s();
if (TextUtils.isEmpty(s)) {
s = "_ABTestGroup_COOKIE_NOT_FOUND";
}
if ("premium".equalsIgnoreCase(this.premiumStory)) {
jSONObject4.put("articleType", "Premium");
} else {
jSONObject4.put("articleType", "Free");
}
jSONObject4.put("vendor", s);
jSONObject4.put("paywallReason", this.premiumStory);
jSONObject4.put("userSubscriptionStatus", getUserSubscriptionStatus());
jSONObject4.put("userLoggedInStatus", WebEngageAnalytices.getUserState());
jSONObject4.put("funnelEntry", this.funnelName);
jSONObject4.put("experiment1", this.pianoExp);
String ltsPiano = PianoResponse.getLtsPiano();
if (!TextUtils.isEmpty(ltsPiano)) {
jSONObject4.put("pianoLTS", ltsPiano);
}
String g = b.g();
if (!TextUtils.isEmpty(g)) {
jSONObject4.put("experiment2", g);
}
int premiumStroyCounter = WebEngageAnalytices.getPremiumStroyCounter();
if (premiumStroyCounter > -1) {
jSONObject4.put("articleCount", premiumStroyCounter);
}
boolean isEmpty = TextUtils.isEmpty(WebEngageAnalytices.VALUE_CAMPAIGN_NAME);
String str3 = BuildConfig.FLAVOR;
if (isEmpty) {
jSONObject4.put("campaignName", BuildConfig.FLAVOR);
} else {
jSONObject4.put("campaignName", WebEngageAnalytices.VALUE_CAMPAIGN_NAME);
}
if (TextUtils.isEmpty(WebEngageAnalytices.VALUE_CAMPAIGN_SOURCE)) {
jSONObject4.put("campaignSource", BuildConfig.FLAVOR);
} else {
jSONObject4.put("campaignSource", WebEngageAnalytices.VALUE_CAMPAIGN_SOURCE);
}
if (TextUtils.isEmpty(WebEngageAnalytices.VALUE_CAMPAIGN_MEDIUM)) {
jSONObject4.put("campaignMedium", BuildConfig.FLAVOR);
} else {
jSONObject4.put("campaignMedium", WebEngageAnalytices.VALUE_CAMPAIGN_MEDIUM);
}
String str4 = WebEngageAnalytices.VALUE_CAMPAIGN_MEDIUM;
if (!TextUtils.isEmpty(str4)) {
jSONObject4.put("campaignReason", str4);
}
String pageReason = SubscriptionPlanSingleton.getInstance().getPageReason();
if (!TextUtils.isEmpty(pageReason)) {
jSONObject4.put("managePlanPageReason", pageReason);
}
String str5 = RenewalAppConstant.renewalExpiryPeriod;
if (!TextUtils.isEmpty(str5)) {
jSONObject4.put("expiryPeriod", e.a(str5));
}
jSONObject4.put("renewalDiscount", RenewalAppConstant.renewalDiscountForBE);
String str6 = TextUtils.isEmpty(RenewalAppConstant.renewalType) ? BuildConfig.FLAVOR : RenewalAppConstant.renewalType;
RenewalAppConstant.renewalType = str6;
jSONObject4.put("renewalType", str6);
MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
PlanDiscountMS planCouponDiscountMS = mintPlanWithZSPlan != null ? mintPlanWithZSPlan.getPlanCouponDiscountMS() : null;
if (planCouponDiscountMS != null) {
MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
boolean z2 = mintPlanWithZSPlan2 != null && mintPlanWithZSPlan2.isCouponApplied();
int couponDiscount = planCouponDiscountMS.getCouponDiscount() != 0 ? planCouponDiscountMS.getCouponDiscount() : 0;
if (couponDiscount > 0 && z2) {
jSONObject4.put("renewalDiscountAmount", couponDiscount);
}
}
jSONObject4.put("planAmountBeforeUpgrade", RenewalAppConstant.amountPaidBeforePlan);
jSONObject4.put("currentPlanMonthUsed", e.c(this.mintSubscriptionDetail));
MintPlanWithZSPlan mintPlanWithZSPlan3 = this.mintPlanWithZSPlan;
double recurringPrice = (mintPlanWithZSPlan3 == null || mintPlanWithZSPlan3.getSubsPlans() == null) ? 0.0d : this.mintPlanWithZSPlan.getSubsPlans().getRecurringPrice();
if (recurringPrice > 0.0d) {
jSONObject4.put("upgradePlanAmount", recurringPrice);
}
try {
jSONObject4 = SyncPurchaseWithSession.getStoryContent(jSONObject4, SubscriptionPlanSingleton.getInstance().getContent());
} catch (Exception unused) {
}
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put("eventData", jSONObject4);
jSONObject5.put("customerId", this.mintSubscriptionDetail.getId());
jSONObject5.put("email", this.mintSubscriptionDetail.getEmail());
jSONObject.put("subscriptionEvent", jSONObject5);
jSONObject3.put("gateway", "Razorpay");
jSONObject.put("payment", jSONObject3);
jSONObject.put(PaymentConstants.ORDER_ID, this.orderId);
String generateToken = JWTTokenBuilder.generateToken(this.mintSubscriptionDetail.getId() + "~" + this.mintSubscriptionDetail.getEmail());
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("ProductId", getResources().getString(2131952728));
hashMap.put("SubscriptionAuth", generateToken);
Config g2 = AppController.j().g();
Razorpay razorpay = g2 != null ? g2.getRazorpay() : null;
String domain = razorpay != null ? razorpay.getDomain() : BuildConfig.FLAVOR;
if (razorpay != null) {
str3 = razorpay.getValidatepayment();
}
if (str3.startsWith("http")) {
str2 = str3;
} else {
str2 = domain + str3;
}
this.paymentValidationPresenterInterface.checkPayment(1, "OrderApi", str2, this.subsscreen, this.subsPlans, jSONObject, hashMap, false, false);
} catch (JSONException unused2) {
}
}
public void dismissProgressDialog() {
try {
ProgressDialog progressDialog = this.pDialog;
if (progressDialog != null && progressDialog.isShowing()) {
this.pDialog.dismiss();
}
} catch (IllegalArgumentException unused) {
} catch (Throwable th) {
this.pDialog = null;
throw th;
}
this.pDialog = null;
}
@Override
public void getMintPlan(MintPlan mintPlan) {
this.mintPlan = mintPlan;
if (this.isOpenThroughCouponPage) {
convertMintPlanIntoZOHOPlan(mintPlan.getPlans().getPartnerPlan());
} else {
ZohoInAppConfig.getInAppPurchaseKit().getPlans(this);
}
}
@Override
public void getMintServerPlan(MintServerPlan mintServerPlan) {
}
@Override
public void getPremiumPlan(SubscribeNowPerant subscribeNowPerant) {
}
public void getUserSubscriptionDetail(MintSubscriptionDetail mintSubscriptionDetail) {
validateUserSubscriptionAndInitatePayment(mintSubscriptionDetail);
}
protected void onActivityResult(int i, int i2, @Nullable Intent intent) {
super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
if (i == 1002 && i2 == -1) {
openOnboardingFlow();
return;
}
boolean z = false;
if (i == 1003 && i2 == -1) {
if (this.subsscreen == q.g0.MANAGE_PLAN_PAGE) {
openOnboardingFlow();
return;
}
Intent intent2 = getIntent();
if (intent2 != null && intent2.getExtras() != null && intent2.getExtras().containsKey("needSetPassword")) {
z = intent2.getExtras().getBoolean("needSetPassword");
}
if (z) {
Intent intent3 = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
intent3.putExtra("origin", "Subscription After");
intent3.setFlags(603979776);
startActivityForResult(intent3, 1002);
return;
}
if (f0.R0(this) == q.n.BOTH) {
openOnboardingFlow();
return;
}
Intent intent4 = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
intent4.putExtra("origin", "Linking");
intent4.putExtra("linkingType", f0.R0(this).ordinal());
intent4.setFlags(603979776);
startActivityForResult(intent4, 1002);
return;
}
if (i != SIGN_IN_REQUEST || i2 != -1) {
if (i == 1004 && i2 == -1) {
goBack();
return;
}
return;
}
if (intent != null && intent.hasExtra("isSignUp")) {
boolean booleanExtra = intent.getBooleanExtra("isSignUp", false);
getIntent().putExtra("needSetPassword", booleanExtra);
SubscriptionPlanSingleton.getInstance().setmNeedToSetPassword(booleanExtra);
}
HashMap hashMap = new HashMap();
String F1 = f0.F1(this);
if (F1 != null) {
hashMap.put("userEmail", F1);
}
if (f0.G1(this, "userName") != null) {
hashMap.put("userName", f0.G1(this, "userName"));
}
if (hashMap.isEmpty()) {
goBack();
} else {
o0.i(hashMap);
checkUserSubscriptionDetail();
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case 2131427752:
if (!this.isSubscribeNowButtonClick) {
this.isSubscribeNowButtonClick = true;
String subscribeNowBtnCta = getSubscribeNowBtnCta();
if (!isPayFromGooglePlay()) {
if (!getVisibleAndCheckedOption()) {
subscribeButtonReset();
Toast.makeText((Context) this, (CharSequence) "Please select payment option", 0).show();
break;
} else {
SubscriptionPlanSingleton subscriptionPlanSingleton = SubscriptionPlanSingleton.getInstance();
WebEngageAnalytices.PAYMENTSTORE paymentstore = WebEngageAnalytices.PAYMENTSTORE.RAZOR_PAY;
subscriptionPlanSingleton.setPaymentMethod(paymentstore.getStore());
q.g0 g0Var = this.subsscreen;
if (g0Var == q.g0.DEVICE_ID_OFFER) {
WebEngageAnalytices.trackPaymentStatus("Pay 1Rs Clicked", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore.getStore(), isRecurring());
b.N(subscribeNowBtnCta + " Device Id Campaign", true, this.campaignDeviceIdPlanPrice, (MintSubscriptionDetail) null, this.mintPlanWithZSPlan, (MSError) null, this.funnelName, BuildConfig.FLAVOR, paymentstore.getStore());
} else if (g0Var == q.g0.PARTNER_COUPON_PAGE) {
WebEngageAnalytices.trackPaymentStatus("Pay 1Rs Clicked", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore.getStore(), isRecurring());
b.N(subscribeNowBtnCta + " Partner Coupon", true, this.campaignDeviceIdPlanPrice, (MintSubscriptionDetail) null, this.mintPlanWithZSPlan, (MSError) null, this.funnelName, BuildConfig.FLAVOR, paymentstore.getStore());
} else {
WebEngageAnalytices.trackPaymentStatus("Pay Full Amount Clicked", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore.getStore(), isRecurring());
WebEngageAnalytices.trackPaymentStatus(subscribeNowBtnCta, (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore.getStore(), isRecurring());
}
WebEngageAnalytices.trackPaymentStatus("Pay Button Clicked", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore.getStore(), isRecurring());
checkOut();
n.A(this, "payment_page_proceed_to_pay_clicked", "payment_page", n.v0, SubscriptionPlanSingleton.getInstance().getContent(), null);
break;
}
} else {
SubscriptionPlanSingleton subscriptionPlanSingleton2 = SubscriptionPlanSingleton.getInstance();
WebEngageAnalytices.PAYMENTSTORE paymentstore2 = WebEngageAnalytices.PAYMENTSTORE.PLAY_STORE;
subscriptionPlanSingleton2.setPaymentMethod(paymentstore2.getStore());
WebEngageAnalytices.trackPaymentStatus("Pay Button Clicked", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore2.getStore(), true);
WebEngageAnalytices.trackPaymentStatus("Pay Full Amount Clicked", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore2.getStore(), true);
WebEngageAnalytices.trackPaymentStatus(subscribeNowBtnCta, (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, (ZSError) null, this.funnelName, (String) null, paymentstore2.getStore(), true);
payViaGooglePlay();
n.A(this, "payment_page_proceed_to_pay_clicked", "payment_page", n.v0, SubscriptionPlanSingleton.getInstance().getContent(), null);
break;
}
}
break;
case 2131429278:
setRadioChecked(CardIndex.CREDIT_CARD.ordinal());
break;
case 2131429288:
setRadioChecked(CardIndex.FREE_CREDIT_CARD.ordinal());
break;
case 2131429289:
setRadioChecked(CardIndex.FREE_GOOGLE_PLAY.ordinal());
break;
case 2131429293:
setRadioChecked(CardIndex.GOOGLE_PLAY.ordinal());
break;
case 2131429317:
setRadioChecked(CardIndex.NETBANKING.ordinal());
break;
case 2131429371:
setRadioChecked(CardIndex.UPI.ordinal());
break;
case 2131429376:
setRadioChecked(CardIndex.WALLET.ordinal());
break;
case 2131431756:
if (this.activityCheckoutPageBinding.X.getVisibility() != 0) {
this.activityCheckoutPageBinding.X.setVisibility(0);
this.activityCheckoutPageBinding.t.setImageResource(2131231311);
this.activityCheckoutPageBinding.g0.setText("view less");
break;
} else {
this.activityCheckoutPageBinding.X.setVisibility(8);
this.activityCheckoutPageBinding.t.setImageResource(2131231306);
this.activityCheckoutPageBinding.g0.setText("view more");
break;
}
}
}
public void onConfigurationChanged(@NonNull Configuration configuration) {
super.onConfigurationChanged(configuration);
AppController.e(getIntent(), this);
}
protected void onCreate(@Nullable Bundle bundle) {
super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
this.activityCheckoutPageBinding = DataBindingUtil.setContentView(this, 2131623971);
Checkout.preload(getApplicationContext());
this.activityCheckoutPageBinding.f(Boolean.valueOf(AppController.j().E()));
this.activityCheckoutPageBinding.g(getResources());
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("isFromRenewPage") && extras.getBoolean("isFromRenewPage")) {
this.isFromRenewalJouney = true;
}
setValueForEventLabel4();
setRadioButtonTheme();
initVar();
handlePartnerPages();
WebEngageAnalytices.trackCheckoutPage(this.mintPlanWithZSPlan);
Content content = SubscriptionPlanSingleton.getInstance().getContent();
this.content = content;
n.A(this, n.q1, "payment_page", n.v0, content, null);
}
@Override
public void onCreateOrder(CreateOrder createOrder) {
boolean z;
double d;
createOrder.getCode();
String message = createOrder.getMessage();
this.orderId = createOrder.getOrderId();
String currencyCode = this.subsPlans.getCurrencyCode();
MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
double recurringPrice = (mintPlanWithZSPlan == null || !mintPlanWithZSPlan.isCouponApplied()) ? this.subsPlans.getRecurringPrice() : this.mintPlanWithZSPlan.getDiscountPrice();
if (createOrder.getSubscription() != null && createOrder.getSubscription().getPlan() != null) {
if (!TextUtils.isEmpty(createOrder.getSubscription().getPlan().getCurrencyCode())) {
currencyCode = createOrder.getSubscription().getPlan().getCurrencyCode();
}
recurringPrice = createOrder.getSubscription().getPlan().getPrice();
}
String str = currencyCode;
boolean isEmpty = TextUtils.isEmpty(this.orderId);
String str2 = BuildConfig.FLAVOR;
if (isEmpty) {
String status = createOrder.getSubscription() != null ? createOrder.getSubscription().getStatus() : BuildConfig.FLAVOR;
if (TextUtils.isEmpty(status) || !("live".equalsIgnoreCase(status) || "future".equalsIgnoreCase(status))) {
subscribeButtonReset();
Toast.makeText((Context) this, (CharSequence) message, 1).show();
} else {
MintSubscriptionDetail parseCouponSubscriptionObject = ParseSubscriptionDetail.parseCouponSubscriptionObject(createOrder.getSubscription());
Hostedpage hostedpage = createOrder.getHostedpage();
if (hostedpage != null) {
str2 = hostedpage.getHostedpageId();
}
this.orderId = str2;
syncSubscriptionSuccess(parseCouponSubscriptionObject);
}
dismissProgressDialog();
return;
}
this.mintPlanWithZSPlan.setTrialDaysDiscountPrice(this.subsPlans.getCurrencySymbol() + ((int) recurringPrice));
boolean isRecurring = isRecurring();
q.g0 g0Var = this.subsscreen;
if (g0Var == null || !(g0Var == q.g0.DEVICE_ID_OFFER || g0Var == q.g0.PARTNER_COUPON_PAGE)) {
z = isRecurring;
d = recurringPrice;
} else {
String recurring = createOrder.getRecurring();
boolean z2 = !TextUtils.isEmpty(recurring) && "1".equalsIgnoreCase(recurring);
d = this.campaignDeviceIdPlanPrice;
z = z2;
}
startPayment(this.orderId, TextUtils.isEmpty(createOrder.getRazorpayCustomerId()) ? BuildConfig.FLAVOR : createOrder.getRazorpayCustomerId(), str, d, z, CardIndex.values()[getSelectedIndex()]);
}
@Override
public void onError(int i, String str) {
subscribeButtonReset();
Toast.makeText((Context) this, (CharSequence) str, 1).show();
dismissProgressDialog();
}
@Override
public void onError(ZSError zSError) {
subscribeButtonReset();
o0.e(zSError.getCode().getDescription(), zSError.getMessage(), getClass().getName());
WebEngageAnalytices.trackPaymentStatus(this.subsscreen == q.g0.MANAGE_PLAN_PAGE ? "Change Plan Payment Failed" : "Payment Failed", (ZSSuscriptionDetail) null, this.mintPlanWithZSPlan, zSError, this.funnelName, this.premiumStory, WebEngageAnalytices.PAYMENTSTORE.PLAY_STORE.getStore(), true);
f0.M(this);
ZSErrorCodeHandling.zsErrorCodeHandling(this, zSError.getCode());
MintPlanWithZSPlan mintPlanWithZSPlan = SubscriptionPlanSingleton.getInstance().getMintPlanWithZSPlan();
if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getSubsPlans() == null || mintPlanWithZSPlan.getSubsPlans().getPlanType() == null) {
return;
}
String planType = mintPlanWithZSPlan.getSubsPlans().getPlanType();
if (SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.i1, "plan_page", n.u0, this.content, null, null, zSError);
return;
}
if (SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.j1, "plan_page", n.u0, this.content, null, null, zSError);
return;
}
if (SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.m1, "plan_page", n.u0, this.content, null, null, zSError);
} else if (SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.k1, "plan_page", n.u0, this.content, null, null, zSError);
} else if (SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.l1, "plan_page", n.u0, this.content, null, null, zSError);
}
}
@Override
public void onError(String str) {
subscribeButtonReset();
Toast.makeText((Context) this, (CharSequence) str, 1).show();
dismissProgressDialog();
}
@Override
public void onError(String str, String str2) {
subscribeButtonReset();
dismissProgressDialog();
planNotFetchGoBack();
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() != 16908332) {
return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
}
goBackWithoutSubscription();
return true;
}
@Override
public void onPaymentError(int i, String str, PaymentData paymentData) {
MSError mSError = new MSError();
mSError.setCode(i + BuildConfig.FLAVOR);
mSError.setMessage(str);
WebEngageAnalytices.trackPaymentStatus(this.subsscreen == q.g0.MANAGE_PLAN_PAGE ? "Change Plan Payment Failed" : "Payment Failed", (MintSubscriptionDetail) null, this.mintPlanWithZSPlan, mSError, this.funnelName, this.premiumStory, WebEngageAnalytices.PAYMENTSTORE.RAZOR_PAY.getStore(), CardIndex.values()[getSelectedIndex()].name(), isRecurring());
MintPlanWithZSPlan mintPlanWithZSPlan = SubscriptionPlanSingleton.getInstance().getMintPlanWithZSPlan();
if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null && mintPlanWithZSPlan.getSubsPlans().getPlanType() != null) {
String planType = mintPlanWithZSPlan.getSubsPlans().getPlanType();
if (SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.i1, "plan_page", n.u0, this.content, null, mSError, null);
} else if (SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.j1, "plan_page", n.u0, this.content, null, mSError, null);
} else if (SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.m1, "plan_page", n.u0, this.content, null, mSError, null);
} else if (SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.k1, "plan_page", n.u0, this.content, null, mSError, null);
} else if (SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory().equalsIgnoreCase(planType)) {
n.x(this, n.l1, "plan_page", n.u0, this.content, null, mSError, null);
}
}
verifyPayment(false, str, paymentData);
}
@Override
public void onPaymentSuccess(String str, PaymentData paymentData) {
verifyPayment(true, BuildConfig.FLAVOR, paymentData);
}
@Override
public void onPlanDetailsFetched(ArrayList<ZSPlan> arrayList) {
dismissProgressDialog();
if (arrayList.size() <= 0) {
planNotFetchGoBack();
return;
}
ArrayList<MintPlanWithZSPlan> mapZOHOActivePlanWithMintPlan = mapZOHOActivePlanWithMintPlan(this.mintPlan, arrayList);
if (mapZOHOActivePlanWithMintPlan.isEmpty()) {
planNotFetchGoBack();
return;
}
MintPlanWithZSPlan filterUserCurrentPlan = filterUserCurrentPlan(mapZOHOActivePlanWithMintPlan);
this.mintPlanWithZSPlan = filterUserCurrentPlan;
if (filterUserCurrentPlan != null) {
initPlanInfo();
} else {
planNotFetchGoBack();
}
}
@Override
public void onPurchaseSyncedWithServer(ZSSuscriptionDetail zSSuscriptionDetail) {
dismissProgressDialog();
MintSubscriptionDetail convertZSSubsDetailWithMintSubs = GetUserSubscriptionDetail.convertZSSubsDetailWithMintSubs(zSSuscriptionDetail);
SyncPurchaseWithSession.syncPurchaseWithSession(this, convertZSSubsDetailWithMintSubs);
syncPaymentWithServer(convertZSSubsDetailWithMintSubs, false);
}
@Override
public void onStorePurchaseCompleted() {
f0.w3(this, "issubscribedmint", true);
Toast.makeText((Context) this, (CharSequence) "Purchase Completed Successfully.", 0).show();
initProgressDialogAndShow();
}
public void onSubscriptionError(SubscriptionError subscriptionError) {
if (subscriptionError.getErrorCode() == ErrorCode.TOKEN_API_FAILED || subscriptionError.getErrorCode() == ErrorCode.UNKNOWN_ERROR) {
Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later.", 0).show();
} else if (subscriptionError.getErrorCode() == ErrorCode.ITEM_ALREADY_PURCHASED) {
Toast.makeText((Context) this, (CharSequence) "You are already subscribed with your existing Playstore ID.", 1).show();
}
subscribeButtonReset();
o0.e(subscriptionError.getErrorCode().name(), subscriptionError.getMessage(), getClass().getName());
}
public void openLoginPage() {
Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
intent.putExtra("origin", "Subscription Funnel");
if ("premium".equalsIgnoreCase(this.premiumStory)) {
intent.putExtra("premiumStory", true);
}
intent.putExtra("isDiscountCoupon", true);
intent.setFlags(603979776);
startActivityForResult(intent, SIGN_IN_REQUEST);
}
@Override
public void paymentSuccess(MintSubscriptionDetail mintSubscriptionDetail) {
syncSubscriptionSuccess(mintSubscriptionDetail);
}
public void startPayment(String str, String str2, String str3, double d, boolean z, CardIndex cardIndex) {
Razorpay razorpay;
?? r1;
Exception e;
?? r12 = this;
?? checkout = new Checkout();
Config g = AppController.j().g();
String str4 = BuildConfig.FLAVOR;
if (g != null && g.getRazorpay() != null) {
str4 = g.getRazorpay().getRazorPayId();
}
if (!TextUtils.isEmpty(str4)) {
checkout.setKeyID(str4);
}
if (g != null) {
try {
razorpay = g.getRazorpay();
} catch (Exception e2) {
e = e2;
r1 = r12;
subscribeButtonReset();
Toast.makeText((Context) r1, "Error in payment: " + e.getMessage(), 0).show();
e.printStackTrace();
}
} else {
razorpay = null;
}
String name = r12.subsPlans.getName();
String description = r12.subsPlans.getDescription();
if (razorpay != null && !r12.isFromRenewalJouney) {
name = TextUtils.isEmpty(razorpay.getCheckoutName()) ? r12.subsPlans.getName() : razorpay.getCheckoutName();
description = TextUtils.isEmpty(razorpay.getCheckoutDesc()) ? r12.subsPlans.getDescription() : razorpay.getCheckoutDesc();
}
JSONObject jSONObject = new JSONObject();
jSONObject.put("name", name);
jSONObject.put(Parameters.CD_DESCRIPTION, description);
jSONObject.put("image", "https://images.livemint.com/icons/mintfavi.svg");
jSONObject.put("send_sms_hash", true);
jSONObject.put("allow_rotation", false);
jSONObject.put(PaymentConstants.ORDER_ID, str);
if (z && !TextUtils.isEmpty(str2)) {
jSONObject.put(PaymentConstants.CUSTOMER_ID, str2);
}
jSONObject.put("currency", str3);
jSONObject.put(PaymentConstants.AMOUNT, d);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("enabled", false);
jSONObject2.put("max_count", 4);
jSONObject.put("retry", jSONObject2);
JSONObject jSONObject3 = new JSONObject();
String displayName = r12.mintSubscriptionDetail.getDisplayName();
String email = r12.mintSubscriptionDetail.getEmail();
String mobile = r12.mintSubscriptionDetail.getMobile();
if (!TextUtils.isEmpty(displayName)) {
jSONObject3.put("name", r12.mintSubscriptionDetail.getDisplayName());
}
if (!TextUtils.isEmpty(email)) {
jSONObject3.put("email", r12.mintSubscriptionDetail.getEmail());
}
if (TextUtils.isEmpty(mobile)) {
jSONObject3.put("contact", "0000000000");
} else {
jSONObject3.put("contact", r12.mintSubscriptionDetail.getMobile());
}
JSONObject jSONObject4 = new JSONObject();
int i = AnonymousClass1.$SwitchMap$com$htmedia$mint$razorpay$ui$SubscriptionCheckOutPage$CardIndex[cardIndex.ordinal()];
try {
if (i == 3) {
jSONObject3.put("method", PaymentConstants.WIDGET_UPI);
jSONObject4.put("netbanking", "0");
jSONObject4.put("card", "0");
jSONObject4.put(PaymentConstants.WIDGET_UPI, "1");
jSONObject4.put("wallet", "0");
} else if (i == 5) {
jSONObject3.put("method", "netbanking");
jSONObject4.put("netbanking", "1");
jSONObject4.put("card", "0");
jSONObject4.put(PaymentConstants.WIDGET_UPI, "0");
jSONObject4.put("wallet", "0");
} else if (i != 7) {
jSONObject3.put("method", "card");
jSONObject4.put("netbanking", "0");
jSONObject4.put("card", "1");
jSONObject4.put(PaymentConstants.WIDGET_UPI, "0");
jSONObject4.put("wallet", "0");
} else {
jSONObject3.put("method", "wallet");
jSONObject4.put("netbanking", "0");
jSONObject4.put("card", "0");
jSONObject4.put(PaymentConstants.WIDGET_UPI, "0");
jSONObject4.put("wallet", "1");
}
jSONObject.put("prefill", jSONObject3);
jSONObject.put("recurring", z);
jSONObject.put("remember_customer", true);
jSONObject.put("theme.color", "#f7941e");
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put("email", false);
jSONObject5.put("contact", false);
jSONObject5.put("name", false);
jSONObject.put("readonly", jSONObject5);
jSONObject.put("method", jSONObject4);
r12 = this;
checkout.open(r12, jSONObject);
} catch (Exception e3) {
e = e3;
r1 = this;
subscribeButtonReset();
Toast.makeText((Context) r1, "Error in payment: " + e.getMessage(), 0).show();
e.printStackTrace();
}
}
}