本文整理汇总了Java中com.alipay.sdk.app.PayTask类的典型用法代码示例。如果您正苦于以下问题:Java PayTask类的具体用法?Java PayTask怎么用?Java PayTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PayTask类属于com.alipay.sdk.app包,在下文中一共展示了PayTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: aliPayReturn
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
@Override
public void aliPayReturn(String data) {
if (!data.isEmpty()) {
Runnable payRunnable = new Runnable() {
@Override
public void run() {
// 构造PayTask 对象
PayTask alipay = new PayTask(UserRechargeActivity.this);
// 调用支付接口,获取支付结果
String result = alipay.pay(data, true);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
}
}
示例2: setOrderInfo
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
@Override
public void setOrderInfo(String orderInfo) {
if (!orderInfo.isEmpty()) {
Runnable payRunnable = new Runnable() {
@Override
public void run() {
// 构造PayTask 对象
PayTask alipay = new PayTask(OrderPayActivity.this);
// 调用支付接口,获取支付结果
String result = alipay.pay(orderInfo, true);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
}
}
示例3: pay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
/**
* call aliPay sdk pay. 调用SDK支付
*/
public void pay(final String orderInfo) {
Runnable payRunnable = new Runnable() {
@Override
public void run() {
// 构造PayTask 对象
PayTask aliPay = new PayTask((Activity) mContext);
// 调用支付接口,获取支付结果
Map<String, String> result = aliPay.payV2(orderInfo, true);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例4: payV1
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
/**
* call alipay sdk pay. 调用SDK支付
*/
public void payV1(final String payInfo) {
Runnable payRunnable = new Runnable() {
@Override
public void run() {
// 构造PayTask 对象
PayTask alipay = new PayTask(context);
// 调用支付接口,获取支付结果
String result = alipay.pay(payInfo, true);// true 在调起支付页面之前显示进度条
Message msg = new Message();
msg.what = Config.SDK_PAY_FLAG;
msg.arg1 = VERSION_1;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例5: payV2
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void payV2(final String orderInfo) {
Runnable payRunnable = new Runnable() {
@Override
public void run() {
PayTask alipay = new PayTask(context);
Map<String, String> result = alipay.payV2(orderInfo, true);
Message msg = new Message();
msg.what = Config.SDK_PAY_FLAG;
msg.arg1 = VERSION_2;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例6: payV2
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void payV2(final String orderInfo) {
Runnable payRunnable = new Runnable() {
@Override
public void run() {
PayTask alipay = new PayTask(mActivity);
Map<String, String> result = alipay.payV2(orderInfo, true);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
resultHandler.sendMessage(msg);
}
};
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例7: run
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void run() {
String pay;
try {
PayTask payTask = new PayTask(this.b);
PingppLog.d("alipaysdk version: " + payTask.getVersion());
pay = payTask.pay(this.a, true);
PingppLog.d("PaymentActivity alipay result: " + pay);
Message message = new Message();
message.what = 1;
message.obj = pay;
this.b.m.sendMessage(message);
} catch (NoClassDefFoundError e) {
e.printStackTrace();
pay = PingppObject.getInstance().currentChannel;
this.b.a("fail", "channel_sdk_not_included:" + pay, "不支持该渠道: " + pay + "。缺少支付宝的 SDK。");
}
}
示例8: pay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
@Override
public void pay(Activity activity, AlipayInfoImpli payInfo, IPayCallback payCallback) {
this.mActivity = activity;
this.alipayInfoImpli = payInfo;
sPayCallback = payCallback;
Runnable payRunnable = new Runnable() {
@Override
public void run() {
// 构造PayTask 对象
PayTask alipay = new PayTask(mActivity);
// 调用支付接口,获取支付结果
String result = alipay.pay(alipayInfoImpli.getOrderInfo(), true);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例9: pay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void pay(String price, String goodname, String gooddes,String orderid) {
String orderInfo = getOrderInfo(goodname, gooddes, price,orderid);
String sign = sign(orderInfo);
try {
sign = URLEncoder.encode(sign, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
final String payInfo = orderInfo + "&sign=\"" + sign + "\"&"
+ getSignType();
Runnable payRunnable = new Runnable() {
@Override
public void run() {
PayTask alipay = new PayTask(OrderDetailActivity.this);
String result = alipay.pay(payInfo);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例10: check
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void check() {
Runnable checkRunnable = new Runnable() {
@Override
public void run() {
PayTask payTask = new PayTask(OrderDetailActivity.this);
boolean isExist = payTask.checkAccountIfExist();
Message msg = new Message();
msg.what = SDK_CHECK_FLAG;
msg.obj = isExist;
mHandler.sendMessage(msg);
}
};
Thread checkThread = new Thread(checkRunnable);
checkThread.start();
}
示例11: pay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void pay(String price, String goodname, String gooddes,String orderid) {
String orderInfo = getOrderInfo(goodname, gooddes, price,orderid);
String sign = sign(orderInfo);
try {
sign = URLEncoder.encode(sign, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
final String payInfo = orderInfo + "&sign=\"" + sign + "\"&"
+ getSignType();
Runnable payRunnable = new Runnable() {
@Override
public void run() {
PayTask alipay = new PayTask(OrderActivity.this);
String result = alipay.pay(payInfo);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
Thread payThread = new Thread(payRunnable);
payThread.start();
}
示例12: check
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public void check() {
Runnable checkRunnable = new Runnable() {
@Override
public void run() {
PayTask payTask = new PayTask(OrderActivity.this);
boolean isExist = payTask.checkAccountIfExist();
Message msg = new Message();
msg.what = SDK_CHECK_FLAG;
msg.obj = isExist;
mHandler.sendMessage(msg);
}
};
Thread checkThread = new Thread(checkRunnable);
checkThread.start();
}
示例13: StartAlipay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
public static void StartAlipay(final Activity activity, final String payInfo,final PayCallback payCallback){
// 必须异步调用
new Thread(new Runnable() {
@Override
public void run() {
// 构造PayTask 对象
final PayTask alipay = new PayTask(activity);
// 调用支付接口,获取支付结果
payCallback.payResult(alipay.pay(payInfo,true));
}
}).start();
}
示例14: pay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
@Override
public void pay(final String data, final OnCallback<String> callback) {
new AsyncTask<String, Void, Result>() {
@Override
protected void onPreExecute() {
callback.onStarted(mActivity);
}
@Override
protected Result doInBackground(String... params) {
final PayTask task = new PayTask(mActivity);
return new Result(task.payV2(data, true));
}
@Override
protected void onPostExecute(Result result) {
String message = "[" + result.resultStatus + "]" + result.resultText;
if (result.isSuccess()) {
callback.onSucceed(mActivity, "");
} else if (result.isPending()) {
callback.onFailed(mActivity, ResultCode.RESULT_PENDING, message);
} else if (result.isCancelled()){
callback.onFailed(mActivity, ResultCode.RESULT_CANCELLED, message);
} else {
callback.onFailed(mActivity, ResultCode.RESULT_FAILED, message);
}
callback.onCompleted(mActivity);
}
}.execute(data);
}
示例15: isAlipay
import com.alipay.sdk.app.PayTask; //导入依赖的package包/类
private boolean isAlipay(final WebView view, String url) {
Activity mActivity=null;
if((mActivity=mWeakReference.get())==null)
return false;
final PayTask task = new PayTask(mActivity);
final String ex = task.fetchOrderInfoFromH5PayUrl(url);
LogUtils.i("Info", "alipay:" + ex);
if (!TextUtils.isEmpty(ex)) {
//System.out.println("paytask:::::" + url);
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
public void run() {
System.out.println("payTask:::" + ex);
final H5PayResultModel result = task.h5Pay(ex, true);
if (!TextUtils.isEmpty(result.getReturnUrl())) {
AgentWebX5Utils.runInUiThread(new Runnable() {
@Override
public void run() {
view.loadUrl(result.getReturnUrl());
}
});
}
}
});
return true;
}
return false;
}