-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
2,112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package com.ipay; | ||
|
||
import java.security.NoSuchAlgorithmException; | ||
import javax.crypto.Cipher; | ||
import javax.crypto.NoSuchPaddingException; | ||
import javax.crypto.spec.IvParameterSpec; | ||
import javax.crypto.spec.SecretKeySpec; | ||
|
||
public class DESProcessor { | ||
private String iv = ""; | ||
private IvParameterSpec ivspec; | ||
private SecretKeySpec keyspec; | ||
private Cipher cipher; | ||
private String SecretKey = ""; | ||
|
||
public DESProcessor() { | ||
this.ivspec = new IvParameterSpec(this.iv.getBytes()); | ||
this.keyspec = new SecretKeySpec(this.SecretKey.getBytes(), "AES"); | ||
|
||
try { | ||
this.cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | ||
} catch (NoSuchAlgorithmException var2) { | ||
var2.printStackTrace(); | ||
} catch (NoSuchPaddingException var3) { | ||
var3.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
public byte[] encrypt(String text) throws Exception { | ||
if (text != null && text.length() != 0) { | ||
Object var2 = null; | ||
|
||
try { | ||
this.cipher.init(1, this.keyspec, this.ivspec); | ||
byte[] encrypted = this.cipher.doFinal(padString(text).getBytes()); | ||
return encrypted; | ||
} catch (Exception var4) { | ||
throw new Exception("[encrypt] " + var4.getMessage()); | ||
} | ||
} else { | ||
throw new Exception("Empty string"); | ||
} | ||
} | ||
|
||
public byte[] decrypt(String code) throws Exception { | ||
if (code != null && code.length() != 0) { | ||
Object var2 = null; | ||
|
||
try { | ||
this.cipher.init(2, this.keyspec, this.ivspec); | ||
byte[] decrypted = this.cipher.doFinal(hexToBytes(code)); | ||
return decrypted; | ||
} catch (Exception var4) { | ||
throw new Exception("[decrypt] " + var4.getMessage()); | ||
} | ||
} else { | ||
throw new Exception("Empty string"); | ||
} | ||
} | ||
|
||
public static String bytesToHex(byte[] data) { | ||
if (data == null) { | ||
return null; | ||
} else { | ||
int len = data.length; | ||
String str = ""; | ||
|
||
for(int i = 0; i < len; ++i) { | ||
if ((data[i] & 255) < 16) { | ||
str = str + "0" + Integer.toHexString(data[i] & 255); | ||
} else { | ||
str = str + Integer.toHexString(data[i] & 255); | ||
} | ||
} | ||
|
||
return str; | ||
} | ||
} | ||
|
||
public static byte[] hexToBytes(String str) { | ||
if (str == null) { | ||
return null; | ||
} else if (str.length() < 2) { | ||
return null; | ||
} else { | ||
int len = str.length() / 2; | ||
byte[] buffer = new byte[len]; | ||
|
||
for(int i = 0; i < len; ++i) { | ||
buffer[i] = (byte)Integer.parseInt(str.substring(i * 2, i * 2 + 2), 16); | ||
} | ||
|
||
return buffer; | ||
} | ||
} | ||
|
||
private static String padString(String source) { | ||
char paddingChar = ' '; | ||
int size = 16; | ||
int x = source.length() % size; | ||
int padLength = size - x; | ||
|
||
for(int i = 0; i < padLength; ++i) { | ||
source = source + paddingChar; | ||
} | ||
|
||
return source; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.ipay; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import java.io.Serializable; | ||
|
||
public final class IPayIH { | ||
public static IPayIH _IPayIH; | ||
public static final int PAY_METHOD_CREDIT_CARD = 0; | ||
public static final int ENV_PRODUCTION = 1; | ||
public static final int ENV_DVL3 = 2; | ||
public static final int ENV_SANDBOX = 3; | ||
|
||
public static IPayIH getInstance() { | ||
IPayIHActivity._IPayIH = new IPayIH(); | ||
return IPayIHActivity._IPayIH; | ||
} | ||
|
||
public final Intent checkout(IPayIHPayment IPayIHPayment, Context paramContext, IPayIHResultDelegate paramPayPalResultDelegate, int iPayMethod) { | ||
Intent paramContext2 = (new Intent(paramContext, IPayIHActivity.class)).putExtra("com.ipay.android.IPAY_PAYMENT", IPayIHPayment); | ||
paramContext2.putExtra("com.paypal.android.RESULT_DELEGATE", (Serializable)paramPayPalResultDelegate); | ||
paramContext2.putExtra("com.ipay.android.IPAY_METHOD", iPayMethod); | ||
return paramContext2; | ||
} | ||
|
||
public final Intent requery(IPayIHR r, Context paramContext, IPayIHResultDelegate paramPayPalResultDelegate) { | ||
Intent paramContext2 = (new Intent(paramContext, IPayIHAcitivityR.class)).putExtra("rrr", r); | ||
paramContext2.putExtra("com.paypal.android.RESULT_DELEGATE", (Serializable)paramPayPalResultDelegate); | ||
return paramContext2; | ||
} | ||
|
||
public final Intent selectPaymentMethod(IPayIHPayment IPayIHPayment, Context paramContext, IPayIHResultDelegate paramPayPalResultDelegate) { | ||
Intent paramContext2 = (new Intent(paramContext, IPayIHSelectionActivity.class)).putExtra("com.ipay.android.IPAY_PAYMENT", IPayIHPayment); | ||
paramContext2.putExtra("com.paypal.android.RESULT_DELEGATE", (Serializable)paramPayPalResultDelegate); | ||
return paramContext2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.ipay; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.os.StrictMode; | ||
import android.os.Build.VERSION; | ||
import android.os.StrictMode.ThreadPolicy; | ||
import android.os.StrictMode.ThreadPolicy.Builder; | ||
import android.util.Log; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.apache.http.HttpResponse; | ||
import org.apache.http.NameValuePair; | ||
import org.apache.http.client.HttpClient; | ||
import org.apache.http.client.entity.UrlEncodedFormEntity; | ||
import org.apache.http.client.methods.HttpPost; | ||
import org.apache.http.impl.client.DefaultHttpClient; | ||
import org.apache.http.message.BasicNameValuePair; | ||
import org.apache.http.util.EntityUtils; | ||
|
||
public class IPayIHAcitivityR extends Activity { | ||
public static IPayIH _IPayIH; | ||
private IPayIHResultDelegate ipayResult; | ||
|
||
protected final void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
IPayIHR ipaypayment = (IPayIHR)this.getIntent().getSerializableExtra("rrr"); | ||
if (ipaypayment != null) { | ||
HttpPost postMethod = new HttpPost("https://payment.ipay88.com.my/ePayment/enquiry.asp"); | ||
|
||
try { | ||
if (VERSION.SDK_INT > 9) { | ||
ThreadPolicy policy = (new Builder()).permitAll().build(); | ||
StrictMode.setThreadPolicy(policy); | ||
} | ||
|
||
String local_MerchantCode = ipaypayment.getMerchantCode(); | ||
String local_RefID = ipaypayment.getRefNo(); | ||
String local_Amount = ipaypayment.getAmount(); | ||
List<NameValuePair> nameValuePairs = new ArrayList(3); | ||
nameValuePairs.add(new BasicNameValuePair("MerchantCode", local_MerchantCode)); | ||
nameValuePairs.add(new BasicNameValuePair("RefNo", local_RefID)); | ||
nameValuePairs.add(new BasicNameValuePair("Amount", local_Amount)); | ||
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs)); | ||
HttpClient client = new DefaultHttpClient(); | ||
HttpResponse response = client.execute(postMethod); | ||
String pcm_response = EntityUtils.toString(response.getEntity()); | ||
pcm_response = pcm_response.trim(); | ||
Log.i("sss333", pcm_response); | ||
this.setStatus(local_MerchantCode, local_RefID, local_Amount, pcm_response); | ||
} catch (Exception var11) { | ||
var11.printStackTrace(); | ||
} | ||
} | ||
|
||
} | ||
|
||
public void setStatus(String MerchantCode, String RefNo, String Amount, String Result) { | ||
Intent data = new Intent(); | ||
data.putExtra("SOMETHING", "EXTRAS"); | ||
this.ipayResult = (IPayIHResultDelegate)this.getIntent().getSerializableExtra("com.paypal.android.RESULT_DELEGATE"); | ||
this.ipayResult.onRequeryResult(MerchantCode, RefNo, Amount, Result); | ||
if (this.getParent() == null) { | ||
this.setResult(-1, data); | ||
} else { | ||
this.getParent().setResult(-1, data); | ||
} | ||
|
||
this.finish(); | ||
} | ||
} |
Oops, something went wrong.