您好,我按照流程ipay88开始设置付款对象
payment = new IPayIHPayment();
payment.setMerchantKey(marchantKey);
payment.setMerchantCode(marchantCode);
payment.setPaymentId(generateId("WoW"));
payment.setRefNo(generateRefNo());
payment.setAmount(amount);
payment.setProdDesc(generateDescription());
payment.setUserName(nameUser);
payment.setUserEmail(emailUser);
payment.setUserContact(phoneUser);
payment.setRemark(generateRemark());
payment.setBackendPostURL(backendUrl);
Intent checkoutIntent = IPayIH.getInstance().checkout(payment, ipay88pay.this, new ResultDelegate(), IPayIH.ENV_PRODUCTION);
startActivityForResult(checkoutIntent, 1);
和ResultDelegate类:
public class ResultDelegate implements IPayIHResultDelegate, Serializable {
@Override
public void onPaymentSucceeded(String s, String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8) {
showSuccessUpload();
}
@Override
public void onPaymentFailed(String s, String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8) {
Toast.makeText(context, "Pembayaran gagal. Sila cuba lagi!", Toast.LENGTH_SHORT).show();
}
@Override
public void onPaymentCanceled(String s, String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8) {
Toast.makeText(context, "Pembayaran batal. Sila cuba lagi!", Toast.LENGTH_SHORT).show();
}
@Override
public void onRequeryResult(String s, String s1, String s2, String s3) {
}
@Override
public void onConnectionError(String s, String s1, String s2, String s3, String s4, String s5, String s6) {
Toast.makeText(context, "Masalah hubungan internet. Sila cuba lagi!", Toast.LENGTH_SHORT).show();
}
}
这是ipay88尝试序列化的接口:
public interface IPayIHResultDelegate {
void onPaymentSucceeded(String var1, String var2, String var3, String var4, String var5, String var6, String var7, String var8, String var9);
void onPaymentFailed(String var1, String var2, String var3, String var4, String var5, String var6, String var7, String var8, String var9);
void onPaymentCanceled(String var1, String var2, String var3, String var4, String var5, String var6, String var7, String var8, String var9);
void onRequeryResult(String var1, String var2, String var3, String var4);
void onConnectionError(String var1, String var2, String var3, String var4, String var5, String var6, String var7);
}
最后出现此错误:
Parcelable遇到IOException写入可序列化对象(名称= {packageid} .ipay88pay $ ResultDelegate 引起原因:java.io.NotSerializableException:
此外,我确实实现了包裹,但是它们都不起作用。任何人都有与我一样的问题,不胜感激。
答案 0 :(得分:1)
错误告诉您问题所在;您尝试序列化的对象不可序列化,这很可能是因为它包含一个不会实现序列化的变量,并且您没有覆盖wriiteobject和readobject方法。
您可以查看Serialization - readObject writeObject overrides,以获取有关如何执行此操作的更多信息