├── .gitignore ├── LICENSE ├── README.md ├── plugin.xml ├── src ├── android │ ├── Pay.java │ ├── PayFactory.java │ ├── ali │ │ ├── Alipay.java │ │ └── PayResult.java │ ├── libs │ │ ├── alipaySdk-20160825.jar │ │ └── libammsdk.jar │ └── wx │ │ ├── AppRegister.java │ │ ├── WXPayEntryActivity.java │ │ └── Wxpay.java └── ios │ ├── Lyxpay.h │ ├── Lyxpay.m │ ├── Pay │ ├── AlipaySDK.bundle │ │ ├── bar@2x.png │ │ ├── refresh@2x.png │ │ ├── refresh_click@2x.png │ │ ├── shutdown@2x.png │ │ └── shutdown_click@2x.png │ ├── AlipaySDK.framework │ │ ├── AlipaySDK │ │ ├── Headers │ │ │ ├── APayAuthInfo.h │ │ │ └── AlipaySDK.h │ │ ├── Info.plist │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ ├── SDKExport │ │ ├── WXApi.h │ │ ├── WXApiObject.h │ │ └── libWeChatSDK.a │ ├── ZXWeniPay.h │ └── ZXWeniPay.m │ └── lib │ ├── AlipaySDK.bundle │ ├── bar@2x.png │ ├── refresh@2x.png │ ├── refresh_click@2x.png │ ├── shutdown@2x.png │ └── shutdown_click@2x.png │ └── AlipaySDK.framework │ ├── AlipaySDK │ ├── Headers │ ├── APayAuthInfo.h │ └── AlipaySDK.h │ ├── Info.plist │ └── en.lproj │ └── InfoPlist.strings └── www ├── android └── lyxpay.js └── ios └── lyxpay.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | .gitignore 3 | .idea/ 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 LYX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### cordova-plugin-pay 2 | 3 | > 其实是给ionic2做的插件,未经过cordova测试,需要将ionic-native替换成我的源,等做完再详细写 4 | 5 | ### 说明 6 | 由于项目问题,该插件暂时停止维护,虽然大部分功能可用,但是,还没有将配置集成到配置文件中,也还没经过完整的项目测试,目前只能算是demo 性的插件,如有需要,可以自行进行改造。之后重新着手`cordova`相关开发之后,会再次开始该插件开发和维护。 7 | 8 | 9 | === 10 | 1. Android支付宝支付 完成 11 | 2. Android微信支付 完成 12 | 3. IOS支付宝支付 完成 13 | 4. IOS微信支付 完成 14 | 15 | ### 负责人 16 | - 设计:林耀鑫 17 | - Android平台的微信/支付宝接入:林耀鑫 18 | - IOS平台的微信/支付宝接入:许志雄 19 | 20 | === 21 | #### 调用示例 22 | 23 | - 引入LyxPay: `import {StatusBar, Lyxpay,PayCallBack} from 'ionic-native';` 24 | - 继承 `PayCallBack`接口,重写`success`和`failure`方法 25 | 26 | ``` 27 | class CallBack implements PayCallBack{ 28 | success(): any { 29 | alert("success"); 30 | } 31 | 32 | failure(msg: string): any { 33 | alert(msg); 34 | } 35 | 36 | } 37 | 38 | 39 | ``` 40 | === 41 | - 调用` Lyxpay.pay(1,data.text(),new CallBack());` 42 | - 参数一是支付类型:1是支付宝,2是微信 43 | - 参数二是支付字符串 44 | - 参数三是重写的回调方法 45 | 46 | 47 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | lyxpay 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | CFBundleURLName 77 | weixin 78 | CFBundleURLSchemes 79 | 80 | wx4fd357e3019b6cd2 81 | 82 | 83 | 84 | CFBundleURLName 85 | ali 86 | CFBundleURLSchemes 87 | 88 | alisdkWeiNi 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/android/Pay.java: -------------------------------------------------------------------------------- 1 | package com.lyx.pay; 2 | 3 | import android.content.Context; 4 | 5 | import org.apache.cordova.CallbackContext; 6 | import org.apache.cordova.CordovaInterface; 7 | 8 | /** 9 | * Created by FollowWinter on 9/15/16. 10 | */ 11 | public class Pay { 12 | 13 | public void pay(CordovaInterface cordova, String param, CallbackContext callbackContext) { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/android/PayFactory.java: -------------------------------------------------------------------------------- 1 | package com.lyx.pay; 2 | 3 | import com.lyx.pay.ali.Alipay; 4 | import com.lyx.pay.wx.Wxpay; 5 | 6 | import org.apache.cordova.CallbackContext; 7 | import org.apache.cordova.CordovaInterface; 8 | import org.apache.cordova.CordovaPlugin; 9 | import org.apache.cordova.CordovaWebView; 10 | import org.json.JSONArray; 11 | import org.json.JSONException; 12 | 13 | /** 14 | * Created by FollowWinter on 9/15/16. 15 | */ 16 | public class PayFactory extends CordovaPlugin{ 17 | public static final int TYPE_ALIPAY=1; 18 | public static final int TYPE_WXPAY=2; 19 | 20 | public static final String ACT_PAY="pay"; 21 | 22 | private static PayFactory payFactory; 23 | 24 | private Pay pay; 25 | 26 | // private PayFactory(){} 27 | 28 | // public static PayFactory getInstance(){ 29 | // if (payFactory==null){ 30 | // payFactory=new PayFactory(); 31 | // } 32 | // return payFactory; 33 | // } 34 | // 35 | // public void pay(){ 36 | // 37 | // } 38 | 39 | @Override 40 | public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { 41 | 42 | if (ACT_PAY.equals(action)){ 43 | // callbackContext.success(); 44 | // return true; 45 | int type=args.getInt(0); 46 | String param=args.getString(1); 47 | switch (type){ 48 | case TYPE_ALIPAY:{ 49 | pay=new Alipay(); 50 | break; 51 | } 52 | case TYPE_WXPAY:{ 53 | pay=new Wxpay(); 54 | break; 55 | } 56 | } 57 | pay.pay(cordova,param,callbackContext); 58 | return true; 59 | } 60 | 61 | return false; 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/android/ali/Alipay.java: -------------------------------------------------------------------------------- 1 | package com.lyx.pay.ali; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.os.Handler; 7 | import android.os.Message; 8 | import android.text.TextUtils; 9 | import android.util.Log; 10 | import android.widget.Toast; 11 | 12 | import com.alipay.sdk.app.PayTask; 13 | import com.lyx.pay.Pay; 14 | 15 | import org.apache.cordova.CallbackContext; 16 | import org.apache.cordova.CordovaInterface; 17 | 18 | 19 | /** 20 | * Created by FollowWinter on 9/15/16. 21 | */ 22 | public class Alipay extends Pay{ 23 | private Context context; 24 | @Override 25 | public void pay(final CordovaInterface cordova, final String param, final CallbackContext callbackContext) { 26 | cordova.getThreadPool().execute(new Runnable() { 27 | @Override 28 | public void run() { 29 | PayTask alipay = new PayTask(cordova.getActivity()); 30 | // 调用支付接口,获取支付结果 31 | String result = alipay.pay(param, true); 32 | PayResult payResult = new PayResult(result); 33 | String resultInfo = payResult.getResult();// 同步返回需要验证的信息 34 | 35 | String resultStatus = payResult.getResultStatus(); 36 | 37 | if (TextUtils.equals(resultStatus, "9000")) { 38 | callbackContext.success(); 39 | } else { 40 | // 判断resultStatus 为非"9000"则代表可能支付失败 41 | // "8000"代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准(小概率状态) 42 | if (TextUtils.equals(resultStatus, "8000")) { 43 | Toast.makeText(cordova.getActivity(), "支付结果确认中", Toast.LENGTH_SHORT).show(); 44 | } else { 45 | // 其他值就可以判断为支付失败,包括用户主动取消支付,或者系统返回的错误 46 | callbackContext.error("支付失败"); 47 | 48 | } 49 | } 50 | } 51 | }); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/android/ali/PayResult.java: -------------------------------------------------------------------------------- 1 | package com.lyx.pay.ali; import android.text.TextUtils; public class PayResult { private String resultStatus; private String result; private String memo; public PayResult(String rawResult) { if (TextUtils.isEmpty(rawResult)) return; String[] resultParams = rawResult.split(";"); for (String resultParam : resultParams) { if (resultParam.startsWith("resultStatus")) { resultStatus = gatValue(resultParam, "resultStatus"); } if (resultParam.startsWith("result")) { result = gatValue(resultParam, "result"); } if (resultParam.startsWith("memo")) { memo = gatValue(resultParam, "memo"); } } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } private String gatValue(String content, String key) { String prefix = key + "={"; return content.substring(content.indexOf(prefix) + prefix.length(), content.lastIndexOf("}")); } /** * @return the resultStatus */ public String getResultStatus() { return resultStatus; } /** * @return the memo */ public String getMemo() { return memo; } /** * @return the result */ public String getResult() { return result; } } -------------------------------------------------------------------------------- /src/android/libs/alipaySdk-20160825.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/android/libs/alipaySdk-20160825.jar -------------------------------------------------------------------------------- /src/android/libs/libammsdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/android/libs/libammsdk.jar -------------------------------------------------------------------------------- /src/android/wx/AppRegister.java: -------------------------------------------------------------------------------- 1 | package com.lyx.pay.wx; 2 | 3 | import com.tencent.mm.sdk.openapi.IWXAPI; 4 | import com.tencent.mm.sdk.openapi.WXAPIFactory; 5 | 6 | import android.content.BroadcastReceiver; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | 10 | public class AppRegister extends BroadcastReceiver { 11 | 12 | @Override 13 | public void onReceive(Context context, Intent intent) { 14 | final IWXAPI msgApi = WXAPIFactory.createWXAPI(context, null); 15 | 16 | // 将该app注册到微信 17 | msgApi.registerApp(Wxpay.APP_ID); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/android/wx/WXPayEntryActivity.java: -------------------------------------------------------------------------------- 1 | package com.weni.shop.wxapi; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | 7 | import com.lyx.pay.wx.Wxpay; 8 | import com.tencent.mm.sdk.constants.ConstantsAPI; 9 | import com.tencent.mm.sdk.modelbase.BaseReq; 10 | import com.tencent.mm.sdk.modelbase.BaseResp; 11 | import com.tencent.mm.sdk.openapi.IWXAPI; 12 | import com.tencent.mm.sdk.openapi.IWXAPIEventHandler; 13 | import android.app.Activity; 14 | import com.lyx.pay.wx.Wxpay; 15 | 16 | import com.tencent.mm.sdk.openapi.WXAPIFactory; 17 | 18 | import org.chromium.base.Log; 19 | 20 | public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler { 21 | 22 | 23 | private static final String TAG = "Weni.WXPayEntryActivity"; 24 | 25 | private IWXAPI api; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | api = WXAPIFactory.createWXAPI(this, Wxpay.APP_ID); 31 | api.handleIntent(getIntent(), this); 32 | finish(); 33 | } 34 | 35 | @Override 36 | public void onReq(BaseReq baseReq) { 37 | Log.e("type", "2"); 38 | 39 | } 40 | 41 | @Override 42 | protected void onNewIntent(Intent intent) { 43 | super.onNewIntent(intent); 44 | setIntent(intent); 45 | api.handleIntent(intent, this); 46 | } 47 | 48 | @Override 49 | public void onResp(BaseResp baseResp) { 50 | Log.e("type", baseResp.getType() + ""); 51 | if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) { 52 | if (baseResp.errCode == 0) { 53 | Log.e("success", "success"); 54 | Wxpay.callbackContext.success(); 55 | } else { 56 | Wxpay.callbackContext.error("支付失败"); 57 | } 58 | } else { 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/android/wx/Wxpay.java: -------------------------------------------------------------------------------- 1 | package com.lyx.pay.wx; 2 | 3 | import android.content.Context; 4 | 5 | import com.lyx.pay.Pay; 6 | import com.tencent.mm.sdk.modelpay.PayReq; 7 | import com.tencent.mm.sdk.openapi.IWXAPI; 8 | import com.tencent.mm.sdk.openapi.WXAPIFactory; 9 | import org.apache.cordova.CallbackContext; 10 | import org.apache.cordova.CordovaInterface; 11 | import org.json.JSONObject; 12 | 13 | 14 | /** 15 | * Created by FollowWinter on 9/15/16. 16 | */ 17 | public class Wxpay extends Pay { 18 | private IWXAPI api; 19 | public final static String APP_ID = ""; 20 | public static CallbackContext callbackContext; 21 | 22 | @Override 23 | public void pay(CordovaInterface cordova, String param, CallbackContext callbackContext) { 24 | this.callbackContext = callbackContext; 25 | api = WXAPIFactory.createWXAPI(cordova.getActivity(), APP_ID); 26 | try { 27 | JSONObject json = new JSONObject(param); 28 | PayReq req = new PayReq(); 29 | req.appId = APP_ID; 30 | req.partnerId = json.getString("partnerid"); 31 | req.prepayId = json.getString("prepayid"); 32 | req.nonceStr = json.getString("noncestr"); 33 | req.timeStamp = json.getString("timestamp"); 34 | req.packageValue = json.getString("package"); 35 | req.sign = json.getString("sign"); 36 | api.sendReq(req); 37 | } catch (Exception e) { 38 | 39 | } 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /src/ios/Lyxpay.h: -------------------------------------------------------------------------------- 1 | // 2 | // Lyxpay.h 3 | // PluginTest 4 | // 5 | // Created by 冬追夏赶 on 9/15/16. 6 | // 7 | // 8 | 9 | #import 10 | #import "WXApi.h" 11 | @interface Lyxpay : CDVPlugin 12 | 13 | - (void)pay:(CDVInvokedUrlCommand*)command; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /src/ios/Lyxpay.m: -------------------------------------------------------------------------------- 1 | // 2 | // Lyxpay.m 3 | // PluginTest 4 | // 5 | // Created by 冬追夏赶 on 9 / 15 / 16. 6 | // 7 | // 8 | 9 | #import "Lyxpay.h" 10 | //#import "ZXWeniPay.h" 11 | #import 12 | 13 | 14 | @interface Lyxpay () 15 | @property (nonatomic, strong) CDVInvokedUrlCommand *tempCommand; 16 | @end 17 | 18 | @implementation Lyxpay 19 | - (void)pay : (CDVInvokedUrlCommand *)command 20 | { 21 | self.tempCommand = command; 22 | //type 1是支付宝 2是微信 23 | //param 24 | 25 | // [self.commandDelegate runInBackground:^{ 26 | // 27 | // 28 | // [[AlipaySDK defaultService] payOrder:@"" fromScheme:@"" callback:^(NSDictionary *resultDic) { 29 | // NSLog(@"reslut = %@",resultDic); 30 | // 31 | // CDVPluginResult * pluginResult = nil; 32 | // 33 | // pluginResult =[CDVPluginResult resultWithStatus : CDVCommandStatus_OK messageAsString : @""]; 34 | // 35 | // [self.commandDelegate sendPluginResult : pluginResult callbackId : command.callbackId]; 36 | // 37 | // 38 | // }]; 39 | // }]; 40 | 41 | 42 | // CDVPluginResult* pluginResult = nil; 43 | // NSString* myarg = [command.arguments objectAtIndex:0]; 44 | 45 | // if (myarg != nil) { 46 | // pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 47 | // } else { 48 | // pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Arg was null"]; 49 | // } 50 | // [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 51 | 52 | NSInteger type = [command.arguments[0] integerValue]; 53 | // self.commandDelegate 54 | // ZXWeniPay *pay = [[ZXWeniPay alloc] init]; 55 | if (type == 1) { 56 | //支付宝 57 | //应用注册scheme,在AliSDKDemo-Info.plist定义URL types 58 | NSString *appScheme = @"alisdkWeiNi"; 59 | [[AlipaySDK defaultService] payOrder:command.arguments[1] fromScheme:appScheme callback:^(NSDictionary *resultDic) { 60 | CDVPluginResult* pluginResult = nil; 61 | if ([resultDic[@"resultStatus"] integerValue] == 9000) { 62 | //成功 63 | 64 | pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 65 | } else { 66 | //失败 67 | NSLog(@"sadahdasjkd"); 68 | pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@""]; 69 | } 70 | 71 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 72 | NSLog(@"1reslut = %@",resultDic); 73 | }]; 74 | 75 | 76 | // [pay aliPay:command.arguments[1]]; 77 | } else if (type == 2) { 78 | //微信 79 | //注册微信支付appid 80 | [WXApi registerApp:command.arguments[1][@"appid"]]; 81 | 82 | PayReq *request = [[PayReq alloc] init]; 83 | request.partnerId = command.arguments[1][@"partnerid"]; 84 | request.prepayId = command.arguments[1][@"prepayid"]; 85 | request.package = command.arguments[1][@"package"]; 86 | request.nonceStr = command.arguments[1][@"noncestr"]; 87 | request.timeStamp = [command.arguments[1][@"timestamp"] intValue]; 88 | request.sign = command.arguments[1][@"sign"]; 89 | [WXApi sendReq:request]; 90 | // [pay wxPay:command.arguments[1]]; 91 | 92 | } 93 | 94 | 95 | } 96 | 97 | - (void)onResp:(BaseResp *)resp { 98 | CDVPluginResult* pluginResult = nil; 99 | if ([resp isKindOfClass:[PayResp class]]){ 100 | PayResp *response = (PayResp*)resp; 101 | switch(response.errCode){ 102 | case WXSuccess: 103 | //服务器端查询支付通知或查询API返回的结果再提示成功 104 | NSLog(@"支付成功"); 105 | pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 106 | break; 107 | default: 108 | NSLog(@"支付失败,retcode=%d",resp.errCode); 109 | pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@""]; 110 | break; 111 | } 112 | } 113 | [self.commandDelegate sendPluginResult:pluginResult callbackId:self.tempCommand .callbackId]; 114 | 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.bundle/bar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.bundle/bar@2x.png -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.bundle/refresh@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.bundle/refresh@2x.png -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.bundle/refresh_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.bundle/refresh_click@2x.png -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.bundle/shutdown@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.bundle/shutdown@2x.png -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.bundle/shutdown_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.bundle/shutdown_click@2x.png -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.framework/AlipaySDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.framework/AlipaySDK -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.framework/Headers/APayAuthInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // APAuthInfo.h 3 | // AliSDKDemo 4 | // 5 | // Created by 方彬 on 14-7-18. 6 | // Copyright (c) 2014年 Alipay.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface APayAuthInfo : NSObject 12 | 13 | @property(nonatomic, copy)NSString *appID; 14 | @property(nonatomic, copy)NSString *pid; 15 | @property(nonatomic, copy)NSString *redirectUri; 16 | 17 | /** 18 | * 初始化AuthInfo 19 | * 20 | * @param appIDStr 应用ID 21 | * @param productIDStr 产品码 该商户在aboss签约的产品,用户获取pid获取的参数 22 | * @param pidStr 商户ID 可不填 23 | * @param uriStr 授权的应用回调地址 比如:alidemo://auth 24 | * 25 | * @return authinfo实例 26 | */ 27 | - (id)initWithAppID:(NSString *)appIDStr 28 | pid:(NSString *)pidStr 29 | redirectUri:(NSString *)uriStr; 30 | 31 | - (NSString *)description; 32 | - (NSString *)wapDescription; 33 | @end 34 | -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.framework/Headers/AlipaySDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlipaySDK.h 3 | // AlipaySDK 4 | // 5 | // Created by 方彬 on 14-4-28. 6 | // Copyright (c) 2014年 Alipay. All rights reserved. 7 | // 8 | 9 | 10 | //////////////////////////////////////////////////////// 11 | ////////////////version:2.1 motify:2014.12.24////////// 12 | ///////////////////Merry Christmas=。=////////////////// 13 | //////////////////////////////////////////////////////// 14 | 15 | 16 | #import "APayAuthInfo.h" 17 | typedef enum { 18 | ALIPAY_TIDFACTOR_IMEI, 19 | ALIPAY_TIDFACTOR_IMSI, 20 | ALIPAY_TIDFACTOR_TID, 21 | ALIPAY_TIDFACTOR_CLIENTKEY, 22 | ALIPAY_TIDFACTOR_VIMEI, 23 | ALIPAY_TIDFACTOR_VIMSI, 24 | ALIPAY_TIDFACTOR_CLIENTID, 25 | ALIPAY_TIDFACTOR_APDID, 26 | ALIPAY_TIDFACTOR_MAX 27 | } AlipayTidFactor; 28 | 29 | typedef void(^CompletionBlock)(NSDictionary *resultDic); 30 | 31 | @interface AlipaySDK : NSObject 32 | 33 | /** 34 | * 创建支付单例服务 35 | * 36 | * @return 返回单例对象 37 | */ 38 | + (AlipaySDK *)defaultService; 39 | 40 | /** 41 | * 用于设置SDK使用的window,如果没有自行创建window无需设置此接口 42 | */ 43 | @property (nonatomic, weak) UIWindow *targetWindow; 44 | 45 | /** 46 | * 支付接口 47 | * 48 | * @param orderStr 订单信息 49 | * @param schemeStr 调用支付的app注册在info.plist中的scheme 50 | * @param compltionBlock 支付结果回调Block,用于wap支付结果回调(非跳转钱包支付) 51 | */ 52 | - (void)payOrder:(NSString *)orderStr 53 | fromScheme:(NSString *)schemeStr 54 | callback:(CompletionBlock)completionBlock; 55 | 56 | /** 57 | * 处理钱包或者独立快捷app支付跳回商户app携带的支付结果Url 58 | * 59 | * @param resultUrl 支付结果url 60 | * @param completionBlock 支付结果回调 61 | */ 62 | - (void)processOrderWithPaymentResult:(NSURL *)resultUrl 63 | standbyCallback:(CompletionBlock)completionBlock; 64 | 65 | 66 | 67 | /** 68 | * 获取交易token。 69 | * 70 | * @return 交易token,若无则为空。 71 | */ 72 | - (NSString *)fetchTradeToken; 73 | 74 | /** 75 | * 是否已经使用过 76 | * 77 | * @return YES为已经使用过,NO反之 78 | */ 79 | - (BOOL)isLogined; 80 | 81 | /** 82 | * 当前版本号 83 | * 84 | * @return 当前版本字符串 85 | */ 86 | - (NSString *)currentVersion; 87 | 88 | /** 89 | * 当前版本号 90 | * 91 | * @return tid相关信息 92 | */ 93 | - (NSString*)queryTidFactor:(AlipayTidFactor)factor; 94 | 95 | /** 96 | * 測試所用,realse包无效 97 | * 98 | * @param url 测试环境 99 | */ 100 | - (void)setUrl:(NSString *)url; 101 | 102 | 103 | ////////////////////////////////////////////////////////////////////////////////////////////// 104 | //////////////////////////h5 拦截支付入口/////////////////////////////////////////////////////// 105 | ////////////////////////////////////////////////////////////////////////////////////////////// 106 | 107 | /** 108 | * url order 获取接口 109 | * 110 | * @param urlStr 拦截的 url string 111 | * 112 | * @return 获取到的url order info 113 | */ 114 | - (NSString*)fetchOrderInfoFromH5PayUrl:(NSString*)urlStr; 115 | 116 | 117 | /** 118 | * url支付接口 119 | * 120 | * @param orderStr 订单信息 121 | * @param schemeStr 调用支付的app注册在info.plist中的scheme 122 | * @param compltionBlock 支付结果回调Block 123 | */ 124 | - (void)payUrlOrder:(NSString *)orderStr 125 | fromScheme:(NSString *)schemeStr 126 | callback:(CompletionBlock)completionBlock; 127 | 128 | 129 | ////////////////////////////////////////////////////////////////////////////////////////////// 130 | //////////////////////////授权1.0////////////////////////////////////////////////////////////// 131 | ////////////////////////////////////////////////////////////////////////////////////////////// 132 | 133 | /** 134 | * 快登授权 135 | * @param authInfo 需授权信息 136 | * @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效, 137 | 需要调用方在appDelegate中调用processAuthResult:standbyCallback:方法获取授权结果 138 | */ 139 | - (void)authWithInfo:(APayAuthInfo *)authInfo 140 | callback:(CompletionBlock)completionBlock; 141 | 142 | 143 | /** 144 | * 处理授权信息Url 145 | * 146 | * @param resultUrl 钱包返回的授权结果url 147 | * @param completionBlock 授权结果回调 148 | */ 149 | - (void)processAuthResult:(NSURL *)resultUrl 150 | standbyCallback:(CompletionBlock)completionBlock; 151 | 152 | ////////////////////////////////////////////////////////////////////////////////////////////// 153 | //////////////////////////授权2.0////////////////////////////////////////////////////////////// 154 | ////////////////////////////////////////////////////////////////////////////////////////////// 155 | 156 | /** 157 | * 快登授权2.0 158 | * 159 | * @param infoStr 授权请求信息字符串 160 | * @param schemeStr 调用授权的app注册在info.plist中的scheme 161 | * @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效, 162 | 需要调用方在appDelegate中调用processAuth_V2Result:standbyCallback:方法获取授权结果 163 | */ 164 | - (void)auth_V2WithInfo:(NSString *)infoStr 165 | fromScheme:(NSString *)schemeStr 166 | callback:(CompletionBlock)completionBlock; 167 | 168 | /** 169 | * 处理授权信息Url 170 | * 171 | * @param resultUrl 钱包返回的授权结果url 172 | * @param completionBlock 授权结果回调 173 | */ 174 | - (void)processAuth_V2Result:(NSURL *)resultUrl 175 | standbyCallback:(CompletionBlock)completionBlock; 176 | 177 | @end 178 | -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.framework/Info.plist -------------------------------------------------------------------------------- /src/ios/Pay/AlipaySDK.framework/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/AlipaySDK.framework/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /src/ios/Pay/SDKExport/WXApi.h: -------------------------------------------------------------------------------- 1 | // 2 | // WXApi.h 3 | // 所有Api接口 4 | // 5 | // Created by Wechat on 12-2-28. 6 | // Copyright (c) 2012年 Tencent. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WXApiObject.h" 11 | 12 | 13 | #pragma mark - WXApiDelegate 14 | /*! @brief 接收并处理来自微信终端程序的事件消息 15 | * 16 | * 接收并处理来自微信终端程序的事件消息,期间微信界面会切换到第三方应用程序。 17 | * WXApiDelegate 会在handleOpenURL:delegate:中使用并触发。 18 | */ 19 | @protocol WXApiDelegate 20 | @optional 21 | 22 | /*! @brief 收到一个来自微信的请求,第三方应用程序处理完后调用sendResp向微信发送结果 23 | * 24 | * 收到一个来自微信的请求,异步处理完成后必须调用sendResp发送处理结果给微信。 25 | * 可能收到的请求有GetMessageFromWXReq、ShowMessageFromWXReq等。 26 | * @param req 具体请求内容,是自动释放的 27 | */ 28 | -(void) onReq:(BaseReq*)req; 29 | 30 | 31 | 32 | /*! @brief 发送一个sendReq后,收到微信的回应 33 | * 34 | * 收到一个来自微信的处理结果。调用一次sendReq后会收到onResp。 35 | * 可能收到的处理结果有SendMessageToWXResp、SendAuthResp等。 36 | * @param resp具体的回应内容,是自动释放的 37 | */ 38 | -(void) onResp:(BaseResp*)resp; 39 | 40 | @end 41 | 42 | 43 | 44 | #pragma mark - WXApi 45 | 46 | /*! @brief 微信Api接口函数类 47 | * 48 | * 该类封装了微信终端SDK的所有接口 49 | */ 50 | @interface WXApi : NSObject 51 | 52 | /*! @brief WXApi的成员函数,向微信终端程序注册第三方应用。 53 | * 54 | * 需要在每次启动第三方应用程序时调用。第一次调用后,会在微信的可用应用列表中出现。 55 | * iOS7及以上系统需要调起一次微信才会出现在微信的可用应用列表中。 56 | * @attention 请保证在主线程中调用此函数 57 | * @param appid 微信开发者ID 58 | * @return 成功返回YES,失败返回NO。 59 | */ 60 | +(BOOL) registerApp:(NSString *)appid; 61 | 62 | 63 | 64 | /*! @brief WXApi的成员函数,向微信终端程序注册第三方应用。 65 | * 66 | * 需要在每次启动第三方应用程序时调用。第一次调用后,会在微信的可用应用列表中出现。 67 | * @see registerApp 68 | * @param appid 微信开发者ID 69 | * @param appdesc 应用附加信息,长度不超过1024字节 70 | * @return 成功返回YES,失败返回NO。 71 | */ 72 | +(BOOL) registerApp:(NSString *)appid withDescription:(NSString *)appdesc; 73 | 74 | 75 | 76 | /*! @brief 处理微信通过URL启动App时传递的数据 77 | * 78 | * 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用。 79 | * @param url 微信启动第三方应用时传递过来的URL 80 | * @param delegate WXApiDelegate对象,用来接收微信触发的消息。 81 | * @return 成功返回YES,失败返回NO。 82 | */ 83 | +(BOOL) handleOpenURL:(NSURL *) url delegate:(id) delegate; 84 | 85 | 86 | 87 | /*! @brief 检查微信是否已被用户安装 88 | * 89 | * @return 微信已安装返回YES,未安装返回NO。 90 | */ 91 | +(BOOL) isWXAppInstalled; 92 | 93 | 94 | 95 | /*! @brief 判断当前微信的版本是否支持OpenApi 96 | * 97 | * @return 支持返回YES,不支持返回NO。 98 | */ 99 | +(BOOL) isWXAppSupportApi; 100 | 101 | 102 | 103 | /*! @brief 获取微信的itunes安装地址 104 | * 105 | * @return 微信的安装地址字符串。 106 | */ 107 | +(NSString *) getWXAppInstallUrl; 108 | 109 | 110 | 111 | /*! @brief 获取当前微信SDK的版本号 112 | * 113 | * @return 返回当前微信SDK的版本号 114 | */ 115 | +(NSString *) getApiVersion; 116 | 117 | 118 | 119 | /*! @brief 打开微信 120 | * 121 | * @return 成功返回YES,失败返回NO。 122 | */ 123 | +(BOOL) openWXApp; 124 | 125 | 126 | 127 | /*! @brief 发送请求到微信,等待微信返回onResp 128 | * 129 | * 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持以下类型 130 | * SendAuthReq、SendMessageToWXReq、PayReq等。 131 | * @param req 具体的发送请求,在调用函数后,请自己释放。 132 | * @return 成功返回YES,失败返回NO。 133 | */ 134 | +(BOOL) sendReq:(BaseReq*)req; 135 | 136 | /*! @brief 发送Auth请求到微信,支持用户没安装微信,等待微信返回onResp 137 | * 138 | * 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持SendAuthReq类型。 139 | * @param req 具体的发送请求,在调用函数后,请自己释放。 140 | * @param viewController 当前界面对象。 141 | * @param delegate WXApiDelegate对象,用来接收微信触发的消息。 142 | * @return 成功返回YES,失败返回NO。 143 | */ 144 | +(BOOL) sendAuthReq:(SendAuthReq*) req viewController : (UIViewController*) viewController delegate:(id) delegate; 145 | 146 | 147 | /*! @brief 收到微信onReq的请求,发送对应的应答给微信,并切换到微信界面 148 | * 149 | * 函数调用后,会切换到微信的界面。第三方应用程序收到微信onReq的请求,异步处理该请求,完成后必须调用该函数。可能发送的相应有 150 | * GetMessageFromWXResp、ShowMessageFromWXResp等。 151 | * @param resp 具体的应答内容,调用函数后,请自己释放 152 | * @return 成功返回YES,失败返回NO。 153 | */ 154 | +(BOOL) sendResp:(BaseResp*)resp; 155 | 156 | 157 | @end 158 | -------------------------------------------------------------------------------- /src/ios/Pay/SDKExport/WXApiObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMApiObject.h 3 | // Api对象,包含所有接口和对象数据定义 4 | // 5 | // Created by Wechat on 12-2-28. 6 | // Copyright (c) 2012年 Tencent. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /*! @brief 错误码 13 | * 14 | */ 15 | enum WXErrCode { 16 | WXSuccess = 0, /**< 成功 */ 17 | WXErrCodeCommon = -1, /**< 普通错误类型 */ 18 | WXErrCodeUserCancel = -2, /**< 用户点击取消并返回 */ 19 | WXErrCodeSentFail = -3, /**< 发送失败 */ 20 | WXErrCodeAuthDeny = -4, /**< 授权失败 */ 21 | WXErrCodeUnsupport = -5, /**< 微信不支持 */ 22 | }; 23 | 24 | 25 | 26 | /*! @brief 请求发送场景 27 | * 28 | */ 29 | enum WXScene { 30 | WXSceneSession = 0, /**< 聊天界面 */ 31 | WXSceneTimeline = 1, /**< 朋友圈 */ 32 | WXSceneFavorite = 2, /**< 收藏 */ 33 | }; 34 | 35 | 36 | 37 | enum WXAPISupport { 38 | WXAPISupportSession = 0, 39 | }; 40 | 41 | 42 | 43 | /*! @brief 跳转profile类型 44 | * 45 | */ 46 | enum WXBizProfileType{ 47 | WXBizProfileType_Normal = 0, //**< 普通公众号 */ 48 | WXBizProfileType_Device = 1, //**< 硬件公众号 */ 49 | }; 50 | 51 | 52 | 53 | /*! @brief 跳转mp网页类型 54 | * 55 | */ 56 | enum WXMPWebviewType { 57 | WXMPWebviewType_Ad = 0, /**< 广告网页 **/ 58 | }; 59 | 60 | #pragma mark - BaseReq 61 | /*! @brief 该类为微信终端SDK所有请求类的基类 62 | * 63 | */ 64 | @interface BaseReq : NSObject 65 | 66 | /** 请求类型 */ 67 | @property (nonatomic, assign) int type; 68 | /** 由用户微信号和AppID组成的唯一标识,发送请求时第三方程序必须填写,用于校验微信用户是否换号登录*/ 69 | @property (nonatomic, retain) NSString* openID; 70 | 71 | @end 72 | 73 | 74 | 75 | #pragma mark - BaseResp 76 | /*! @brief 该类为微信终端SDK所有响应类的基类 77 | * 78 | */ 79 | @interface BaseResp : NSObject 80 | /** 错误码 */ 81 | @property (nonatomic, assign) int errCode; 82 | /** 错误提示字符串 */ 83 | @property (nonatomic, retain) NSString *errStr; 84 | /** 响应类型 */ 85 | @property (nonatomic, assign) int type; 86 | 87 | @end 88 | 89 | 90 | 91 | #pragma mark - WXMediaMessage 92 | @class WXMediaMessage; 93 | 94 | /*! @brief 第三方向微信终端发起支付的消息结构体 95 | * 96 | * 第三方向微信终端发起支付的消息结构体,微信终端处理后会向第三方返回处理结果 97 | * @see PayResp 98 | */ 99 | @interface PayReq : BaseReq 100 | 101 | /** 商家向财付通申请的商家id */ 102 | @property (nonatomic, retain) NSString *partnerId; 103 | /** 预支付订单 */ 104 | @property (nonatomic, retain) NSString *prepayId; 105 | /** 随机串,防重发 */ 106 | @property (nonatomic, retain) NSString *nonceStr; 107 | /** 时间戳,防重发 */ 108 | @property (nonatomic, assign) UInt32 timeStamp; 109 | /** 商家根据财付通文档填写的数据和签名 */ 110 | @property (nonatomic, retain) NSString *package; 111 | /** 商家根据微信开放平台文档对数据做的签名 */ 112 | @property (nonatomic, retain) NSString *sign; 113 | 114 | @end 115 | 116 | 117 | 118 | #pragma mark - PayResp 119 | /*! @brief 微信终端返回给第三方的关于支付结果的结构体 120 | * 121 | * 微信终端返回给第三方的关于支付结果的结构体 122 | */ 123 | @interface PayResp : BaseResp 124 | 125 | /** 财付通返回给商家的信息 */ 126 | @property (nonatomic, retain) NSString *returnKey; 127 | 128 | @end 129 | 130 | 131 | #pragma mark - SendAuthReq 132 | /*! @brief 第三方程序向微信终端请求认证的消息结构 133 | * 134 | * 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数, 135 | * 向微信终端发送一个SendAuthReq消息结构。微信终端处理完后会向第三方程序发送一个处理结果。 136 | * @see SendAuthResp 137 | */ 138 | @interface SendAuthReq : BaseReq 139 | /** 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。微信终端处理完后会向第三方程序发送一个处理结果。 140 | * @see SendAuthResp 141 | * @note scope字符串长度不能超过1K 142 | */ 143 | @property (nonatomic, retain) NSString* scope; 144 | /** 第三方程序本身用来标识其请求的唯一性,最后跳转回第三方程序时,由微信终端回传。 145 | * @note state字符串长度不能超过1K 146 | */ 147 | @property (nonatomic, retain) NSString* state; 148 | @end 149 | 150 | 151 | 152 | #pragma mark - SendAuthResp 153 | /*! @brief 微信处理完第三方程序的认证和权限申请后向第三方程序回送的处理结果。 154 | * 155 | * 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。 156 | * 微信终端处理完后会向第三方程序发送一个SendAuthResp。 157 | * @see onResp 158 | */ 159 | @interface SendAuthResp : BaseResp 160 | @property (nonatomic, retain) NSString* code; 161 | /** 第三方程序发送时用来标识其请求的唯一性的标志,由第三方程序调用sendReq时传入,由微信终端回传 162 | * @note state字符串长度不能超过1K 163 | */ 164 | @property (nonatomic, retain) NSString* state; 165 | @property (nonatomic, retain) NSString* lang; 166 | @property (nonatomic, retain) NSString* country; 167 | @end 168 | 169 | 170 | 171 | #pragma mark - SendMessageToWXReq 172 | /*! @brief 第三方程序发送消息至微信终端程序的消息结构体 173 | * 174 | * 第三方程序向微信发送信息需要传入SendMessageToWXReq结构体,信息类型包括文本消息和多媒体消息, 175 | * 分别对应于text和message成员。调用该方法后,微信处理完信息会向第三方程序发送一个处理结果。 176 | * @see SendMessageToWXResp 177 | */ 178 | @interface SendMessageToWXReq : BaseReq 179 | /** 发送消息的文本内容 180 | * @note 文本长度必须大于0且小于10K 181 | */ 182 | @property (nonatomic, retain) NSString* text; 183 | /** 发送消息的多媒体内容 184 | * @see WXMediaMessage 185 | */ 186 | @property (nonatomic, retain) WXMediaMessage* message; 187 | /** 发送消息的类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */ 188 | @property (nonatomic, assign) BOOL bText; 189 | /** 发送的目标场景,可以选择发送到会话(WXSceneSession)或者朋友圈(WXSceneTimeline)。 默认发送到会话。 190 | * @see WXScene 191 | */ 192 | @property (nonatomic, assign) int scene; 193 | 194 | @end 195 | 196 | 197 | 198 | #pragma mark - SendMessageToWXResp 199 | /*! @brief 微信终端向第三方程序返回的SendMessageToWXReq处理结果。 200 | * 201 | * 第三方程序向微信终端发送SendMessageToWXReq后,微信发送回来的处理结果,该结果用SendMessageToWXResp表示。 202 | */ 203 | @interface SendMessageToWXResp : BaseResp 204 | @property(nonatomic, retain) NSString* lang; 205 | @property(nonatomic, retain) NSString* country; 206 | @end 207 | 208 | 209 | #pragma mark - GetMessageFromWXReq 210 | /*! @brief 微信终端向第三方程序请求提供内容的消息结构体。 211 | * 212 | * 微信终端向第三方程序请求提供内容,微信终端会向第三方程序发送GetMessageFromWXReq消息结构体, 213 | * 需要第三方程序调用sendResp返回一个GetMessageFromWXResp消息结构体。 214 | */ 215 | @interface GetMessageFromWXReq : BaseReq 216 | @property (nonatomic, retain) NSString* lang; 217 | @property (nonatomic, retain) NSString* country; 218 | @end 219 | 220 | 221 | 222 | #pragma mark - GetMessageFromWXResp 223 | /*! @brief 微信终端向第三方程序请求提供内容,第三方程序向微信终端返回的消息结构体。 224 | * 225 | * 微信终端向第三方程序请求提供内容,第三方程序调用sendResp向微信终端返回一个GetMessageFromWXResp消息结构体。 226 | */ 227 | @interface GetMessageFromWXResp : BaseResp 228 | /** 向微信终端提供的文本内容 229 | @note 文本长度必须大于0且小于10K 230 | */ 231 | @property (nonatomic, retain) NSString* text; 232 | /** 向微信终端提供的多媒体内容。 233 | * @see WXMediaMessage 234 | */ 235 | @property (nonatomic, retain) WXMediaMessage* message; 236 | /** 向微信终端提供内容的消息类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */ 237 | @property (nonatomic, assign) BOOL bText; 238 | @end 239 | 240 | 241 | 242 | #pragma mark - ShowMessageFromWXReq 243 | /*! @brief 微信通知第三方程序,要求第三方程序显示的消息结构体。 244 | * 245 | * 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。 246 | * 第三方程序处理完内容后调用sendResp向微信终端发送ShowMessageFromWXResp。 247 | */ 248 | @interface ShowMessageFromWXReq : BaseReq 249 | /** 微信终端向第三方程序发送的要求第三方程序处理的多媒体内容 250 | * @see WXMediaMessage 251 | */ 252 | @property (nonatomic, retain) WXMediaMessage* message; 253 | @property (nonatomic, retain) NSString* lang; 254 | @property (nonatomic, retain) NSString* country; 255 | @end 256 | 257 | 258 | 259 | #pragma mark - ShowMessageFromWXResp 260 | /*! @brief 微信通知第三方程序,要求第三方程序显示或处理某些消息,第三方程序处理完后向微信终端发送的处理结果。 261 | * 262 | * 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。 263 | * 第三方程序处理完内容后调用sendResp向微信终端发送ShowMessageFromWXResp。 264 | */ 265 | @interface ShowMessageFromWXResp : BaseResp 266 | @end 267 | 268 | 269 | 270 | #pragma mark - LaunchFromWXReq 271 | /*! @brief 微信终端打开第三方程序携带的消息结构体 272 | * 273 | * 微信向第三方发送的结构体,第三方不需要返回 274 | */ 275 | @interface LaunchFromWXReq : BaseReq 276 | @property (nonatomic, retain) WXMediaMessage* message; 277 | @property (nonatomic, retain) NSString* lang; 278 | @property (nonatomic, retain) NSString* country; 279 | @end 280 | 281 | #pragma mark - OpenTempSessionReq 282 | /* ! @brief 第三方通知微信,打开临时会话 283 | * 284 | * 第三方通知微信,打开临时会话 285 | */ 286 | @interface OpenTempSessionReq : BaseReq 287 | /** 需要打开的用户名 288 | * @attention 长度不能超过512字节 289 | */ 290 | @property (nonatomic, retain) NSString* username; 291 | /** 开发者自定义参数,拉起临时会话后会发给开发者后台,可以用于识别场景 292 | * @attention 长度不能超过32位 293 | */ 294 | @property (nonatomic, retain) NSString* sessionFrom; 295 | @end 296 | 297 | #pragma mark - OpenTempSessionResp 298 | /*! @brief 微信终端向第三方程序返回的OpenTempSessionReq处理结果。 299 | * 300 | * 第三方程序向微信终端发送OpenTempSessionReq后,微信发送回来的处理结果,该结果用OpenTempSessionResp表示。 301 | */ 302 | @interface OpenTempSessionResp : BaseResp 303 | 304 | @end 305 | 306 | #pragma mark - OpenWebviewReq 307 | /* ! @brief 第三方通知微信启动内部浏览器,打开指定网页 308 | * 309 | * 第三方通知微信启动内部浏览器,打开指定Url对应的网页 310 | */ 311 | @interface OpenWebviewReq : BaseReq 312 | /** 需要打开的网页对应的Url 313 | * @attention 长度不能超过1024 314 | */ 315 | @property(nonatomic,retain)NSString* url; 316 | 317 | @end 318 | 319 | #pragma mark - OpenWebviewResp 320 | /*! @brief 微信终端向第三方程序返回的OpenWebviewReq处理结果 321 | * 322 | * 第三方程序向微信终端发送OpenWebviewReq后,微信发送回来的处理结果,该结果用OpenWebviewResp表示 323 | */ 324 | @interface OpenWebviewResp : BaseResp 325 | 326 | @end 327 | 328 | #pragma mark - OpenRankListReq 329 | /* ! @brief 第三方通知微信,打开硬件排行榜 330 | * 331 | * 第三方通知微信,打开硬件排行榜 332 | */ 333 | @interface OpenRankListReq : BaseReq 334 | 335 | @end 336 | 337 | #pragma mark - OpenRanklistResp 338 | /*! @brief 微信终端向第三方程序返回的OpenRankListReq处理结果。 339 | * 340 | * 第三方程序向微信终端发送OpenRankListReq后,微信发送回来的处理结果,该结果用OpenRankListResp表示。 341 | */ 342 | @interface OpenRankListResp : BaseResp 343 | 344 | @end 345 | 346 | #pragma mark - JumpToBizProfileReq 347 | /* ! @brief 第三方通知微信,打开指定微信号profile页面 348 | * 349 | * 第三方通知微信,打开指定微信号profile页面 350 | */ 351 | @interface JumpToBizProfileReq : BaseReq 352 | /** 跳转到该公众号的profile 353 | * @attention 长度不能超过512字节 354 | */ 355 | @property (nonatomic, retain) NSString* username; 356 | /** 如果用户加了该公众号为好友,extMsg会上传到服务器 357 | * @attention 长度不能超过1024字节 358 | */ 359 | @property (nonatomic, retain) NSString* extMsg; 360 | /** 361 | * 跳转的公众号类型 362 | * @see WXBizProfileType 363 | */ 364 | @property (nonatomic, assign) int profileType; 365 | @end 366 | 367 | 368 | 369 | #pragma mark - JumpToBizWebviewReq 370 | /* ! @brief 第三方通知微信,打开指定usrname的profile网页版 371 | * 372 | */ 373 | @interface JumpToBizWebviewReq : BaseReq 374 | /** 跳转的网页类型,目前只支持广告页 375 | * @see WXMPWebviewType 376 | */ 377 | @property(nonatomic, assign) int webType; 378 | /** 跳转到该公众号的profile网页版 379 | * @attention 长度不能超过512字节 380 | */ 381 | @property(nonatomic, retain) NSString* tousrname; 382 | /** 如果用户加了该公众号为好友,extMsg会上传到服务器 383 | * @attention 长度不能超过1024字节 384 | */ 385 | @property(nonatomic, retain) NSString* extMsg; 386 | 387 | @end 388 | 389 | #pragma mark - WXCardItem 390 | 391 | @interface WXCardItem : NSObject 392 | /** 卡id 393 | * @attention 长度不能超过1024字节 394 | */ 395 | @property (nonatomic,retain) NSString* cardId; 396 | /** ext信息 397 | * @attention 长度不能超过2024字节 398 | * 具体见http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E9.99.84.E5.BD.954-.E5.8D.A1.E5.88.B8.E6.89.A9.E5.B1.95.E5.AD.97.E6.AE.B5.E5.8F.8A.E7.AD.BE.E5.90.8D.E7.94.9F.E6.88.90.E7.AE.97.E6.B3.95 卡券扩展字段cardExt说明 399 | */ 400 | @property (nonatomic,retain) NSString* extMsg; 401 | /** 402 | * @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。 403 | */ 404 | @property (nonatomic,assign) UInt32 cardState; 405 | @end; 406 | 407 | #pragma mark - AddCardToWXCardPackageReq 408 | /* ! @brief 请求添加卡券至微信卡包 409 | * 410 | */ 411 | 412 | @interface AddCardToWXCardPackageReq : BaseReq 413 | /** 卡列表 414 | * @attention 个数不能超过40个 类型WXCardItem 415 | */ 416 | @property (nonatomic,retain) NSArray* cardAry; 417 | 418 | @end 419 | 420 | 421 | #pragma mark - AddCardToWXCardPackageResp 422 | /** ! @brief 微信返回第三方添加卡券结果 423 | * 424 | */ 425 | 426 | @interface AddCardToWXCardPackageResp : BaseResp 427 | /** 卡列表 428 | * @attention 个数不能超过40个 类型WXCardItem 429 | */ 430 | @property (nonatomic,retain) NSArray* cardAry; 431 | @end 432 | 433 | #pragma mark - WXMediaMessage 434 | 435 | /*! @brief 多媒体消息结构体 436 | * 437 | * 用于微信终端和第三方程序之间传递消息的多媒体消息内容 438 | */ 439 | @interface WXMediaMessage : NSObject 440 | 441 | +(WXMediaMessage *) message; 442 | 443 | /** 标题 444 | * @note 长度不能超过512字节 445 | */ 446 | @property (nonatomic, retain) NSString *title; 447 | /** 描述内容 448 | * @note 长度不能超过1K 449 | */ 450 | @property (nonatomic, retain) NSString *description; 451 | /** 缩略图数据 452 | * @note 大小不能超过32K 453 | */ 454 | @property (nonatomic, retain) NSData *thumbData; 455 | /** 456 | * @note 长度不能超过64字节 457 | */ 458 | @property (nonatomic, retain) NSString *mediaTagName; 459 | /** 460 | * 461 | */ 462 | @property (nonatomic, retain) NSString *messageExt; 463 | @property (nonatomic, retain) NSString *messageAction; 464 | /** 465 | * 多媒体数据对象,可以为WXImageObject,WXMusicObject,WXVideoObject,WXWebpageObject等。 466 | */ 467 | @property (nonatomic, retain) id mediaObject; 468 | 469 | /*! @brief 设置消息缩略图的方法 470 | * 471 | * @param image 缩略图 472 | * @note 大小不能超过32K 473 | */ 474 | - (void) setThumbImage:(UIImage *)image; 475 | 476 | @end 477 | 478 | 479 | 480 | #pragma mark - WXImageObject 481 | /*! @brief 多媒体消息中包含的图片数据对象 482 | * 483 | * 微信终端和第三方程序之间传递消息中包含的图片数据对象。 484 | * @note imageData和imageUrl成员不能同时为空 485 | * @see WXMediaMessage 486 | */ 487 | @interface WXImageObject : NSObject 488 | /*! @brief 返回一个WXImageObject对象 489 | * 490 | * @note 返回的WXImageObject对象是自动释放的 491 | */ 492 | +(WXImageObject *) object; 493 | 494 | /** 图片真实数据内容 495 | * @note 大小不能超过10M 496 | */ 497 | @property (nonatomic, retain) NSData *imageData; 498 | /** 图片url 499 | * @note 长度不能超过10K 500 | */ 501 | @property (nonatomic, retain) NSString *imageUrl; 502 | 503 | @end 504 | 505 | 506 | #pragma mark - WXMusicObject 507 | /*! @brief 多媒体消息中包含的音乐数据对象 508 | * 509 | * 微信终端和第三方程序之间传递消息中包含的音乐数据对象。 510 | * @note musicUrl和musicLowBandUrl成员不能同时为空。 511 | * @see WXMediaMessage 512 | */ 513 | @interface WXMusicObject : NSObject 514 | /*! @brief 返回一个WXMusicObject对象 515 | * 516 | * @note 返回的WXMusicObject对象是自动释放的 517 | */ 518 | +(WXMusicObject *) object; 519 | 520 | /** 音乐网页的url地址 521 | * @note 长度不能超过10K 522 | */ 523 | @property (nonatomic, retain) NSString *musicUrl; 524 | /** 音乐lowband网页的url地址 525 | * @note 长度不能超过10K 526 | */ 527 | @property (nonatomic, retain) NSString *musicLowBandUrl; 528 | /** 音乐数据url地址 529 | * @note 长度不能超过10K 530 | */ 531 | @property (nonatomic, retain) NSString *musicDataUrl; 532 | 533 | /**音乐lowband数据url地址 534 | * @note 长度不能超过10K 535 | */ 536 | @property (nonatomic, retain) NSString *musicLowBandDataUrl; 537 | 538 | @end 539 | 540 | 541 | 542 | #pragma mark - WXVideoObject 543 | /*! @brief 多媒体消息中包含的视频数据对象 544 | * 545 | * 微信终端和第三方程序之间传递消息中包含的视频数据对象。 546 | * @note videoUrl和videoLowBandUrl不能同时为空。 547 | * @see WXMediaMessage 548 | */ 549 | @interface WXVideoObject : NSObject 550 | /*! @brief 返回一个WXVideoObject对象 551 | * 552 | * @note 返回的WXVideoObject对象是自动释放的 553 | */ 554 | +(WXVideoObject *) object; 555 | 556 | /** 视频网页的url地址 557 | * @note 长度不能超过10K 558 | */ 559 | @property (nonatomic, retain) NSString *videoUrl; 560 | /** 视频lowband网页的url地址 561 | * @note 长度不能超过10K 562 | */ 563 | @property (nonatomic, retain) NSString *videoLowBandUrl; 564 | 565 | @end 566 | 567 | 568 | 569 | #pragma mark - WXWebpageObject 570 | /*! @brief 多媒体消息中包含的网页数据对象 571 | * 572 | * 微信终端和第三方程序之间传递消息中包含的网页数据对象。 573 | * @see WXMediaMessage 574 | */ 575 | @interface WXWebpageObject : NSObject 576 | /*! @brief 返回一个WXWebpageObject对象 577 | * 578 | * @note 返回的WXWebpageObject对象是自动释放的 579 | */ 580 | +(WXWebpageObject *) object; 581 | 582 | /** 网页的url地址 583 | * @note 不能为空且长度不能超过10K 584 | */ 585 | @property (nonatomic, retain) NSString *webpageUrl; 586 | 587 | @end 588 | 589 | 590 | 591 | #pragma mark - WXAppExtendObject 592 | /*! @brief 多媒体消息中包含的App扩展数据对象 593 | * 594 | * 第三方程序向微信终端发送包含WXAppExtendObject的多媒体消息, 595 | * 微信需要处理该消息时,会调用该第三方程序来处理多媒体消息内容。 596 | * @note url,extInfo和fileData不能同时为空 597 | * @see WXMediaMessage 598 | */ 599 | @interface WXAppExtendObject : NSObject 600 | /*! @brief 返回一个WXAppExtendObject对象 601 | * 602 | * @note 返回的WXAppExtendObject对象是自动释放的 603 | */ 604 | +(WXAppExtendObject *) object; 605 | 606 | /** 若第三方程序不存在,微信终端会打开该url所指的App下载地址 607 | * @note 长度不能超过10K 608 | */ 609 | @property (nonatomic, retain) NSString *url; 610 | /** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理 611 | * @note 长度不能超过2K 612 | */ 613 | @property (nonatomic, retain) NSString *extInfo; 614 | /** App文件数据,该数据发送给微信好友,微信好友需要点击后下载数据,微信终端会回传给第三方程序处理 615 | * @note 大小不能超过10M 616 | */ 617 | @property (nonatomic, retain) NSData *fileData; 618 | 619 | @end 620 | 621 | 622 | 623 | #pragma mark - WXEmoticonObject 624 | /*! @brief 多媒体消息中包含的表情数据对象 625 | * 626 | * 微信终端和第三方程序之间传递消息中包含的表情数据对象。 627 | * @see WXMediaMessage 628 | */ 629 | @interface WXEmoticonObject : NSObject 630 | 631 | /*! @brief 返回一个WXEmoticonObject对象 632 | * 633 | * @note 返回的WXEmoticonObject对象是自动释放的 634 | */ 635 | +(WXEmoticonObject *) object; 636 | 637 | /** 表情真实数据内容 638 | * @note 大小不能超过10M 639 | */ 640 | @property (nonatomic, retain) NSData *emoticonData; 641 | 642 | @end 643 | 644 | 645 | 646 | #pragma mark - WXFileObject 647 | /*! @brief 多媒体消息中包含的文件数据对象 648 | * 649 | * @see WXMediaMessage 650 | */ 651 | @interface WXFileObject : NSObject 652 | 653 | /*! @brief 返回一个WXFileObject对象 654 | * 655 | * @note 返回的WXFileObject对象是自动释放的 656 | */ 657 | +(WXFileObject *) object; 658 | 659 | /** 文件后缀名 660 | * @note 长度不超过64字节 661 | */ 662 | @property (nonatomic, retain) NSString *fileExtension; 663 | 664 | /** 文件真实数据内容 665 | * @note 大小不能超过10M 666 | */ 667 | @property (nonatomic, retain) NSData *fileData; 668 | 669 | @end 670 | -------------------------------------------------------------------------------- /src/ios/Pay/SDKExport/libWeChatSDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/Pay/SDKExport/libWeChatSDK.a -------------------------------------------------------------------------------- /src/ios/Pay/ZXWeniPay.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZXWeniPay.h 3 | // 唯咛商城 4 | // 5 | // Created by 许志雄 on 16/10/21. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface ZXWeniPay : NSObject 12 | - (void)aliPay:(NSString *)order; 13 | - (void)wxPay:(NSDictionary *)dict; 14 | @end 15 | -------------------------------------------------------------------------------- /src/ios/Pay/ZXWeniPay.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZXWeniPay.m 3 | // 唯咛商城 4 | // 5 | // Created by 许志雄 on 16/10/21. 6 | // 7 | // 8 | 9 | #import "ZXWeniPay.h" 10 | #import 11 | #import "WXApi.h" 12 | @implementation ZXWeniPay 13 | 14 | - (void)aliPay:(NSString *)order { 15 | 16 | //应用注册scheme,在AliSDKDemo-Info.plist定义URL types 17 | NSString *appScheme = @"alisdkWeiNi"; 18 | [[AlipaySDK defaultService] payOrder:order fromScheme:appScheme callback:^(NSDictionary *resultDic) { 19 | 20 | NSLog(@"1reslut = %@",resultDic); 21 | }]; 22 | } 23 | 24 | - (void)wxPay:(NSDictionary *)dict { 25 | //注册微信支付appid 26 | [WXApi registerApp:dict[@"appid"]]; 27 | 28 | PayReq *request = [[PayReq alloc] init]; 29 | request.partnerId = dict[@"partnerid"]; 30 | request.prepayId = dict[@"prepayid"]; 31 | request.package = dict[@"package"]; 32 | request.nonceStr = dict[@"noncestr"]; 33 | request.timeStamp = [dict[@"timestamp"] intValue]; 34 | request.sign = dict[@"sign"]; 35 | [WXApi sendReq:request]; 36 | 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.bundle/bar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.bundle/bar@2x.png -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.bundle/refresh@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.bundle/refresh@2x.png -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.bundle/refresh_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.bundle/refresh_click@2x.png -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.bundle/shutdown@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.bundle/shutdown@2x.png -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.bundle/shutdown_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.bundle/shutdown_click@2x.png -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.framework/AlipaySDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.framework/AlipaySDK -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.framework/Headers/APayAuthInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // APAuthInfo.h 3 | // AliSDKDemo 4 | // 5 | // Created by 方彬 on 14-7-18. 6 | // Copyright (c) 2014年 Alipay.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface APayAuthInfo : NSObject 12 | 13 | @property(nonatomic, copy)NSString *appID; 14 | @property(nonatomic, copy)NSString *pid; 15 | @property(nonatomic, copy)NSString *redirectUri; 16 | 17 | /** 18 | * 初始化AuthInfo 19 | * 20 | * @param appIDStr 应用ID 21 | * @param productIDStr 产品码 该商户在aboss签约的产品,用户获取pid获取的参数 22 | * @param pidStr 商户ID 可不填 23 | * @param uriStr 授权的应用回调地址 比如:alidemo://auth 24 | * 25 | * @return authinfo实例 26 | */ 27 | - (id)initWithAppID:(NSString *)appIDStr 28 | pid:(NSString *)pidStr 29 | redirectUri:(NSString *)uriStr; 30 | 31 | - (NSString *)description; 32 | - (NSString *)wapDescription; 33 | @end 34 | -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.framework/Headers/AlipaySDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlipaySDK.h 3 | // AlipaySDK 4 | // 5 | // Created by 方彬 on 14-4-28. 6 | // Copyright (c) 2014年 Alipay. All rights reserved. 7 | // 8 | 9 | 10 | //////////////////////////////////////////////////////// 11 | ////////////////version:2.1 motify:2014.12.24////////// 12 | ///////////////////Merry Christmas=。=////////////////// 13 | //////////////////////////////////////////////////////// 14 | 15 | 16 | #import "APayAuthInfo.h" 17 | typedef enum { 18 | ALIPAY_TIDFACTOR_IMEI, 19 | ALIPAY_TIDFACTOR_IMSI, 20 | ALIPAY_TIDFACTOR_TID, 21 | ALIPAY_TIDFACTOR_CLIENTKEY, 22 | ALIPAY_TIDFACTOR_VIMEI, 23 | ALIPAY_TIDFACTOR_VIMSI, 24 | ALIPAY_TIDFACTOR_CLIENTID, 25 | ALIPAY_TIDFACTOR_APDID, 26 | ALIPAY_TIDFACTOR_MAX 27 | } AlipayTidFactor; 28 | 29 | typedef void(^CompletionBlock)(NSDictionary *resultDic); 30 | 31 | @interface AlipaySDK : NSObject 32 | 33 | /** 34 | * 创建支付单例服务 35 | * 36 | * @return 返回单例对象 37 | */ 38 | + (AlipaySDK *)defaultService; 39 | 40 | /** 41 | * 用于设置SDK使用的window,如果没有自行创建window无需设置此接口 42 | */ 43 | @property (nonatomic, weak) UIWindow *targetWindow; 44 | 45 | /** 46 | * 支付接口 47 | * 48 | * @param orderStr 订单信息 49 | * @param schemeStr 调用支付的app注册在info.plist中的scheme 50 | * @param compltionBlock 支付结果回调Block,用于wap支付结果回调(非跳转钱包支付) 51 | */ 52 | - (void)payOrder:(NSString *)orderStr 53 | fromScheme:(NSString *)schemeStr 54 | callback:(CompletionBlock)completionBlock; 55 | 56 | /** 57 | * 处理钱包或者独立快捷app支付跳回商户app携带的支付结果Url 58 | * 59 | * @param resultUrl 支付结果url 60 | * @param completionBlock 支付结果回调 61 | */ 62 | - (void)processOrderWithPaymentResult:(NSURL *)resultUrl 63 | standbyCallback:(CompletionBlock)completionBlock; 64 | 65 | 66 | 67 | /** 68 | * 获取交易token。 69 | * 70 | * @return 交易token,若无则为空。 71 | */ 72 | - (NSString *)fetchTradeToken; 73 | 74 | /** 75 | * 是否已经使用过 76 | * 77 | * @return YES为已经使用过,NO反之 78 | */ 79 | - (BOOL)isLogined; 80 | 81 | /** 82 | * 当前版本号 83 | * 84 | * @return 当前版本字符串 85 | */ 86 | - (NSString *)currentVersion; 87 | 88 | /** 89 | * 当前版本号 90 | * 91 | * @return tid相关信息 92 | */ 93 | - (NSString*)queryTidFactor:(AlipayTidFactor)factor; 94 | 95 | /** 96 | * 測試所用,realse包无效 97 | * 98 | * @param url 测试环境 99 | */ 100 | - (void)setUrl:(NSString *)url; 101 | 102 | 103 | ////////////////////////////////////////////////////////////////////////////////////////////// 104 | //////////////////////////h5 拦截支付入口/////////////////////////////////////////////////////// 105 | ////////////////////////////////////////////////////////////////////////////////////////////// 106 | 107 | /** 108 | * url order 获取接口 109 | * 110 | * @param urlStr 拦截的 url string 111 | * 112 | * @return 获取到的url order info 113 | */ 114 | - (NSString*)fetchOrderInfoFromH5PayUrl:(NSString*)urlStr; 115 | 116 | 117 | /** 118 | * url支付接口 119 | * 120 | * @param orderStr 订单信息 121 | * @param schemeStr 调用支付的app注册在info.plist中的scheme 122 | * @param compltionBlock 支付结果回调Block 123 | */ 124 | - (void)payUrlOrder:(NSString *)orderStr 125 | fromScheme:(NSString *)schemeStr 126 | callback:(CompletionBlock)completionBlock; 127 | 128 | 129 | ////////////////////////////////////////////////////////////////////////////////////////////// 130 | //////////////////////////授权1.0////////////////////////////////////////////////////////////// 131 | ////////////////////////////////////////////////////////////////////////////////////////////// 132 | 133 | /** 134 | * 快登授权 135 | * @param authInfo 需授权信息 136 | * @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效, 137 | 需要调用方在appDelegate中调用processAuthResult:standbyCallback:方法获取授权结果 138 | */ 139 | - (void)authWithInfo:(APayAuthInfo *)authInfo 140 | callback:(CompletionBlock)completionBlock; 141 | 142 | 143 | /** 144 | * 处理授权信息Url 145 | * 146 | * @param resultUrl 钱包返回的授权结果url 147 | * @param completionBlock 授权结果回调 148 | */ 149 | - (void)processAuthResult:(NSURL *)resultUrl 150 | standbyCallback:(CompletionBlock)completionBlock; 151 | 152 | ////////////////////////////////////////////////////////////////////////////////////////////// 153 | //////////////////////////授权2.0////////////////////////////////////////////////////////////// 154 | ////////////////////////////////////////////////////////////////////////////////////////////// 155 | 156 | /** 157 | * 快登授权2.0 158 | * 159 | * @param infoStr 授权请求信息字符串 160 | * @param schemeStr 调用授权的app注册在info.plist中的scheme 161 | * @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效, 162 | 需要调用方在appDelegate中调用processAuth_V2Result:standbyCallback:方法获取授权结果 163 | */ 164 | - (void)auth_V2WithInfo:(NSString *)infoStr 165 | fromScheme:(NSString *)schemeStr 166 | callback:(CompletionBlock)completionBlock; 167 | 168 | /** 169 | * 处理授权信息Url 170 | * 171 | * @param resultUrl 钱包返回的授权结果url 172 | * @param completionBlock 授权结果回调 173 | */ 174 | - (void)processAuth_V2Result:(NSURL *)resultUrl 175 | standbyCallback:(CompletionBlock)completionBlock; 176 | 177 | @end 178 | -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.framework/Info.plist -------------------------------------------------------------------------------- /src/ios/lib/AlipaySDK.framework/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-x/ionic2-cordova-plugin-pay/1a1692c6d9937bbc97a5eb14373150bfdabc88a7/src/ios/lib/AlipaySDK.framework/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /www/android/lyxpay.js: -------------------------------------------------------------------------------- 1 | 2 | var 3 | exec = require('cordova/exec') 4 | ; 5 | 6 | 7 | var Pay = function() { 8 | }; 9 | 10 | Pay.pay = function(pay_type,pay_param,payCallback) { 11 | exec(function () { 12 | payCallback.success(); 13 | }, function (error_essage) { 14 | payCallback.failure(error_essage); 15 | }, "Lyxpay", "pay", [pay_type,pay_param,payCallback]); 16 | }; 17 | 18 | 19 | module.exports = Pay; 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /www/ios/lyxpay.js: -------------------------------------------------------------------------------- 1 | 2 | var 3 | exec = require('cordova/exec') 4 | ; 5 | 6 | 7 | var Pay = function() { 8 | }; 9 | 10 | Pay.pay = function(pay_type,pay_param) { 11 | exec(function () { 12 | alert("success"); 13 | }, function (error_essage) { 14 | alert(error_essage) 15 | }, "Lyxpay", "pay", [pay_type,pay_param]); 16 | }; 17 | 18 | /* 19 | Keyboard.styleDark = function(dark) { 20 | exec(null, null, "Keyboard", "styleDark", [dark]); 21 | }; 22 | */ 23 | 24 | module.exports = Pay; 25 | 26 | 27 | 28 | --------------------------------------------------------------------------------