导航菜单

页面标题

页面副标题

Mantra Counter v25.01 - MakePurchase.java 源代码

正在查看: Mantra Counter v25.01 应用的 MakePurchase.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.sweetedge.mantracounter.cashfree;

import android.content.Context;
import android.util.Log;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.cashfree.pg.api.CFPaymentGatewayService;
import com.cashfree.pg.core.api.CFSession;
import com.cashfree.pg.core.api.exception.CFException;
import com.cashfree.pg.core.api.webcheckout.CFWebCheckoutPayment;
import com.cashfree.pg.core.api.webcheckout.CFWebCheckoutTheme;
import com.sweetedge.mantracounter.Authentication.UserWebService;
import java.util.HashMap;
import java.util.Map;
import save_data.Const;
import sweetedge.extra.PLog;
import sweetedge.popup.PToast;
import sweetedge.preference.PSharedPreference;

public class MakePurchase {
    static String CreateOrderUrl = "https://davdapranav.com/AppWebServices/Mantra/cashfree/CashFree_Create_OrderNew.php";
    static String PaymentStatusUrl = "https://davdapranav.com/AppWebServices/Mantra/cashfree/SetPaymentDoneNew.php";

    public static void CreateOrder(final Context context, final String str, final int i) {
        Volley.newRequestQueue(context).add(new StringRequest(1, CreateOrderUrl, new Response.Listener<String>() {
            public void onResponse(String str2) {
                PLog.print(str2);
                PLog.print("Response = " + str2);
                NoAdsDialog.isPayClicked = false;
                if (str2.contains("OrderCreated")) {
                    PToast.showT(context, "Arranging Payment Interface");
                    String substring = str2.substring(str2.indexOf("♦") + 1);
                    PLog.print("Session = " + substring);
                    MakePurchase.makeDoPayment(context, substring);
                    return;
                }
                PToast.showT(context, "Please try after sometime");
            }
        }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError volleyError) {
                PToast.showT(context, "The server is down, Please try after some time!");
                Log.e("Response Error", "" + volleyError);
            }
        }) {
            protected Map<String, String> getParams() {
                HashMap hashMap = new HashMap();
                String str2 = "C" + System.currentTimeMillis();
                PSharedPreference.setString(context, "ORD", str2);
                hashMap.put("OrderId", str2);
                hashMap.put("U_Gmail", str);
                hashMap.put("PLAN_ID", String.valueOf(i));
                return hashMap;
            }
        });
    }

    public static void makeDoPayment(Context context, String str) {
        try {
            CFSession build = new CFSession.CFSessionBuilder().setEnvironment(CFSession.Environment.PRODUCTION).setPaymentSessionID(str).setOrderId(PSharedPreference.getString(context, "ORD", "null")).build();
            CFPaymentGatewayService.getInstance().doPayment(context, new CFWebCheckoutPayment.CFWebCheckoutPaymentBuilder().setSession(build).setCFWebCheckoutUITheme(new CFWebCheckoutTheme.CFWebCheckoutThemeBuilder().setNavigationBarBackgroundColor("#90622b").setNavigationBarTextColor("#ffffff").build()).build());
        } catch (CFException e) {
            e.printStackTrace();
        }
    }

    public static void SetPaymentStatus(final Context context, final String str, final String str2) {
        Volley.newRequestQueue(context).add(new StringRequest(1, PaymentStatusUrl, new Response.Listener<String>() {
            public void onResponse(String str3) {
                NoAdsDialog.checkandFetchPaymentData(context);
                PToast.showT(context, str3);
                if (str2.equals("Success")) {
                    UserWebService.Prime = "1";
                }
            }
        }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError volleyError) {
                PToast.showT(context, "The server is down, Please try after some time!");
                Log.e("Response Error", "" + volleyError);
            }
        }) {
            protected Map<String, String> getParams() {
                HashMap hashMap = new HashMap();
                hashMap.put("orderID", str);
                hashMap.put("u_gmail", PSharedPreference.getString(context, Const.GMAIL, "null"));
                hashMap.put("status", str2);
                return hashMap;
            }
        });
    }
}