正在查看: RummyCircle v11000.89 应用的 RPPaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: RummyCircle v11000.89 应用的 RPPaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.games24x7.pgpayment.sdk.razorpay;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;
import com.games24x7.pgpayment.PaymentConstants;
import com.games24x7.pgpayment.R;
import com.games24x7.pgpayment.model.razorpay.RPPaymentActivityResult;
import com.games24x7.pgpayment.util.PaymentUtils;
import com.google.gson.d;
import com.razorpay.PaymentData;
import com.razorpay.PaymentResultWithDataListener;
import com.razorpay.Razorpay;
import com.razorpay.RazorpayWebViewClient;
import org.json.JSONException;
import org.json.JSONObject;
public class RPPaymentActivity extends AppCompatActivity {
public static final int REQUEST_CODE = 112;
private JSONObject checkoutData;
private String merchantKey;
private Razorpay razorpay;
private WebView webView;
public boolean startCheckout = true;
private final String TAG = "RPPaymentActivity";
public PaymentResultWithDataListener paymentResultWithDataListener = new PaymentResultWithDataListener() {
public void onPaymentError(int i, String str, PaymentData paymentData) {
RPPaymentActivity.this.returnPaymentResult(new RPPaymentActivityResult(false, paymentData.getOrderId(), paymentData.getPaymentId(), paymentData.getSignature(), str, i + "", paymentData.getData().toString()));
}
public void onPaymentSuccess(String str, PaymentData paymentData) {
RPPaymentActivity.this.returnPaymentResult(new RPPaymentActivityResult(true, paymentData.getOrderId(), str, paymentData.getSignature(), null, null, paymentData.getData().toString()));
}
};
private void extractData() {
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey(PaymentConstants.KEY_MERCHANT_KEY) && extras.containsKey(PaymentConstants.KEY_CHECKOUT_DATA)) {
try {
this.checkoutData = new JSONObject(extras.getString(PaymentConstants.KEY_CHECKOUT_DATA));
} catch (JSONException e) {
e.printStackTrace();
returnFailure("Json Exception on parsing checkout data - " + e.getMessage());
}
String string = extras.getString(PaymentConstants.KEY_MERCHANT_KEY);
this.merchantKey = string;
if (TextUtils.isEmpty(string)) {
returnFailure("Empty Merchant Key Passed");
}
}
}
private void returnFailure(String str) {
this.startCheckout = false;
returnPaymentResult(new RPPaymentActivityResult(false, null, null, null, str, null, null));
}
public void returnPaymentResult(RPPaymentActivityResult rPPaymentActivityResult) {
Bundle bundle = new Bundle();
bundle.putString(PaymentConstants.KEY_RP_PAYMENT_RESULT, new d().s(rPPaymentActivityResult));
Intent intent = new Intent();
intent.putExtras(bundle);
setResult(-1, intent);
finish();
}
private void startCheckout() {
this.startCheckout = false;
this.razorpay = new Razorpay(this, this.merchantKey);
this.webView = (WebView) findViewById(R.id.wvRazorpay);
WebViewClient webViewClient = new RazorpayWebViewClient(this.razorpay) {
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
Log.d("RPPaymentActivity", "onRenderProcessGone");
PaymentUtils.INSTANCE.removeWebViewFromParent(webView);
return true;
}
};
this.webView.setWebViewClient(webViewClient);
this.razorpay.setWebView(this.webView);
this.razorpay.setWebviewClient(webViewClient);
this.webView.setVisibility(4);
try {
this.razorpay.submit(this.checkoutData, this.paymentResultWithDataListener);
} catch (Exception e) {
e.printStackTrace();
returnFailure("Exception on performing RP checkout - " + e.getMessage());
}
}
public void onActivityResult(int i, int i2, Intent intent) {
super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
Razorpay razorpay = this.razorpay;
if (razorpay != null) {
razorpay.onActivityResult(i, i2, intent);
}
}
public void onBackPressed() {
super/*androidx.activity.ComponentActivity*/.onBackPressed();
}
public void onCreate(Bundle bundle) {
super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
setContentView(R.layout.activity_rppayment);
extractData();
if (this.startCheckout) {
startCheckout();
}
}
public void onDestroy() {
PaymentUtils.INSTANCE.removeWebViewFromParent(this.webView);
super.onDestroy();
}
}