Mike 7 лет назад
Родитель
Сommit
5a201f48f8
21 измененных файлов с 691 добавлено и 103 удалено
  1. 98 101
      miaomiao/config.xml
  2. 55 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/README.md
  3. 36 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/package.json
  4. 76 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/plugin.xml
  5. 109 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/android/AliPay.java
  6. 1 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/android/PayResult.java
  7. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/android/libs/alipaySdk-20160825.jar
  8. 11 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/AlipayPlugin.h
  9. 83 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/AlipayPlugin.m
  10. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/bar@2x.png
  11. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/refresh@2x.png
  12. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/refresh_click@2x.png
  13. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/shutdown@2x.png
  14. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/shutdown_click@2x.png
  15. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/AlipaySDK
  16. 33 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/Headers/APayAuthInfo.h
  17. 177 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/Headers/AlipaySDK.h
  18. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/Info.plist
  19. BIN
      miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/en.lproj/InfoPlist.strings
  20. 9 0
      miaomiao/plugins/cordova-plugin-offbye-alipay/www/AliPay.js
  21. 3 2
      miaomiao/plugins/fetch.json

+ 98 - 101
miaomiao/config.xml

xqd
@@ -1,106 +1,103 @@
-<?xml version='1.0' encoding='utf-8'?>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <widget id="com.miaomiao.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
-    <name>瞄喵</name>
-    <description>
+  <name>瞄喵</name>
+  <description>
         An Ionic Framework and Cordova project.
     </description>
-    <author email="you@example.com" href="http://example.com.com/">
+  <author email="you@example.com" href="http://example.com.com/">
       Mike
   </author>
-    <content src="index.html" />
-    <access origin="*" />
-    <allow-intent href="*" />
-    <allow-navigation href="*" />
-    <preference name="webviewbounce" value="false" />
-    <preference name="UIWebViewBounce" value="false" />
-    <preference name="DisallowOverscroll" value="true" />
-    <preference name="android-minSdkVersion" value="16" />
-    <preference name="BackupWebStorage" value="none" />
-    <preference name="KeepRunning" value="True" />
-    <preference name="ShowTitle" value="True" />
-    <preference name="InAppBrowserStorageEnabled" value="True" />
-    <preference name="SuppressesIncrementalRendering" value="True" />
-    <preference name="windows-target-version" value="10.0" />
-    <preference name="SplashScreen" value="screen" />
-    <preference name="SplashScreenDelay" value="3000" />
-    <feature name="StatusBar">
-        <param name="ios-package" onload="true" value="CDVStatusBar" />
-    </feature>
-    <platform name="ios">
-        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
-        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
-        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
-        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
-        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
-        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
-        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
-        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
-        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
-        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
-        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
-        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
-        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
-        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
-        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
-        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
-        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
-        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
-        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
-        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
-        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
-        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
-        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
-        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
-        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
-        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
-        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
-        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
-        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
-    </platform>
-    <platform name="android">
-        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
-        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
-        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
-        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
-        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
-        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
-        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
-        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
-        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
-        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
-        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
-        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
-        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
-        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
-        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
-        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
-        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
-        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
-    </platform>
-    <engine name="android" spec="^6.2.3" />
-    <plugin name="cordova-hot-code-push-plugin" spec="^1.5.3" />
-    <plugin name="cordova-plugin-actionsheet" spec="2.3.3" />
-    <plugin name="cordova-plugin-camera" spec="file:node_modules\cordova-plugin-camera" />
-    <plugin name="cordova-plugin-compat" spec="1.1.0" />
-    <plugin name="cordova-plugin-console" spec="~1.0.2" />
-    <plugin name="cordova-plugin-device" spec="~1.1.1" />
-    <plugin name="cordova-plugin-file" spec="4.3.2" />
-    <plugin name="cordova-plugin-file-transfer" spec="1.6.2" />
-    <plugin name="cordova-plugin-media-capture" spec="1.4.3" />
-<!--     <plugin name="cordova-plugin-offbye-alipay" spec="git+https://github.com/offbye/cordova-plugin-alipay.git">
-        <variable name="PARTNER_ID" value="2088721135315822" />
-    </plugin> -->
-    <plugin name="cordova-plugin-splashscreen" spec="4.0.3" />
-    <plugin name="cordova-plugin-statusbar" spec="~2.1.0" />
-    <plugin name="cordova-plugin-wechat" spec="^2.0.0">
-        <variable name="WECHATAPPID" value="wxc5181c0d406023e6" />
-    </plugin>
-    <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
-    <plugin name="ionic-plugin-keyboard" spec="~1.0.9" />
-    <plugin name="jpush-phonegap-plugin" spec="^3.2.3">
-        <variable name="APP_KEY" value="69838317211448192366f9d8" />
-    </plugin>
-    <plugin name="phonegap-plugin-barcodescanner" spec="git+https://github.com/phonegap/phonegap-plugin-barcodescanner.git">
-        <variable name="CAMERA_USAGE_DESCRIPTION" value="请摄像头对准条码" />
-    </plugin>
-</widget>
+  <content src="index.html"/>
+  <access origin="*"/>
+  <allow-intent href="*"/>
+  <allow-navigation href="*"/>
+  <preference name="webviewbounce" value="false"/>
+  <preference name="UIWebViewBounce" value="false"/>
+  <preference name="DisallowOverscroll" value="true"/>
+  <preference name="android-minSdkVersion" value="16"/>
+  <preference name="BackupWebStorage" value="none"/>
+  <preference name="KeepRunning" value="True"/>
+  <preference name="ShowTitle" value="True"/>
+  <preference name="InAppBrowserStorageEnabled" value="True"/>
+  <preference name="SuppressesIncrementalRendering" value="True"/>
+  <preference name="windows-target-version" value="10.0"/>
+  <preference name="SplashScreen" value="screen"/>
+  <preference name="SplashScreenDelay" value="3000"/>
+  <feature name="StatusBar">
+    <param name="ios-package" onload="true" value="CDVStatusBar"/>
+  </feature>
+  <platform name="ios">
+    <icon height="57" src="resources/ios/icon/icon.png" width="57"/>
+    <icon height="114" src="resources/ios/icon/icon@2x.png" width="114"/>
+    <icon height="40" src="resources/ios/icon/icon-40.png" width="40"/>
+    <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80"/>
+    <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120"/>
+    <icon height="50" src="resources/ios/icon/icon-50.png" width="50"/>
+    <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100"/>
+    <icon height="60" src="resources/ios/icon/icon-60.png" width="60"/>
+    <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120"/>
+    <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180"/>
+    <icon height="72" src="resources/ios/icon/icon-72.png" width="72"/>
+    <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144"/>
+    <icon height="76" src="resources/ios/icon/icon-76.png" width="76"/>
+    <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152"/>
+    <icon height="29" src="resources/ios/icon/icon-small.png" width="29"/>
+    <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58"/>
+    <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87"/>
+    <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640"/>
+    <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750"/>
+    <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242"/>
+    <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208"/>
+    <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048"/>
+    <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732"/>
+    <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024"/>
+    <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536"/>
+    <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048"/>
+    <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768"/>
+    <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640"/>
+    <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320"/>
+  </platform>
+  <platform name="android">
+    <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png"/>
+    <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png"/>
+    <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png"/>
+    <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png"/>
+    <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png"/>
+    <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png"/>
+    <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png"/>
+    <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png"/>
+    <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png"/>
+    <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png"/>
+    <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png"/>
+    <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png"/>
+    <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png"/>
+    <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png"/>
+    <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png"/>
+    <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png"/>
+    <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png"/>
+    <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png"/>
+  </platform>
+  <engine name="android" spec="^6.2.3"/>
+  <plugin name="cordova-hot-code-push-plugin" spec="^1.5.3"/>
+  <plugin name="cordova-plugin-actionsheet" spec="2.3.3"/>
+  <plugin name="cordova-plugin-camera" spec="file:node_modules\cordova-plugin-camera"/>
+  <plugin name="cordova-plugin-compat" spec="1.1.0"/>
+  <plugin name="cordova-plugin-console" spec="~1.0.2"/>
+  <plugin name="cordova-plugin-device" spec="~1.1.1"/>
+  <plugin name="cordova-plugin-file" spec="4.3.2"/>
+  <plugin name="cordova-plugin-file-transfer" spec="1.6.2"/>
+  <plugin name="cordova-plugin-media-capture" spec="1.4.3"/>
+  <plugin name="cordova-plugin-splashscreen" spec="4.0.3"/>
+  <plugin name="cordova-plugin-statusbar" spec="~2.1.0"/>
+  <plugin name="cordova-plugin-wechat" spec="^2.0.0">
+    <variable name="WECHATAPPID" value="wxc5181c0d406023e6"/>
+  </plugin>
+  <plugin name="cordova-plugin-whitelist" spec="^1.3.2"/>
+  <plugin name="ionic-plugin-keyboard" spec="~1.0.9"/>
+  <plugin name="jpush-phonegap-plugin" spec="^3.2.3">
+    <variable name="APP_KEY" value="69838317211448192366f9d8"/>
+  </plugin>
+  <plugin name="phonegap-plugin-barcodescanner" spec="git+https://github.com/phonegap/phonegap-plugin-barcodescanner.git">
+    <variable name="CAMERA_USAGE_DESCRIPTION" value="请摄像头对准条码"/>
+  </plugin>
+</widget>

+ 55 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/README.md

xqd
@@ -0,0 +1,55 @@
+## cordova-plugin-alipay ##
+
+Makes your Cordova application enable to use the [Alipay SDK](https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.hT44dE&treeId=54&articleId=104509&docType=1)
+for mobile payment with Alipay App or Mobile Web. Requires cordova-android 4.0 or greater.
+
+### ChangeLogs
+  本cordova插件是基于支付宝App支付SDK的Demo实现
+ - 升级支付宝SDK版本到20160825;
+ - 修改了一些bug;
+ - 支持Android和iOS Alipay SDK
+###主要功能
+
+ - 主要功能是:服务器把订单信息签名后,调用该插件调用支付宝sdk进行支付,支付完成后如支付成功,如果是9000状态,还要去服务端去验证是否真正支付
+
+### Install 安装
+
+The following directions are for cordova-cli (most people).  
+
+* Open an existing cordova project, with cordova-android 4.0.0+, and using the latest CLI. TBS X5  variables can be configured as an option when installing the plugin
+* Add this plugin
+
+  ```sh
+  cordova plugin add https://github.com/offbye/cordova-plugin-alipay.git --variable PARTNER_ID=[你的商户PID可以在账户中查询]
+  ```
+  (对于android,可以不传PARTNER_ID)
+
+   offline:下载后再进行安装 `cordova plugin add  YOUR_DIR`
+
+### 支持平台
+
+		Android IOS
+
+### Android API
+
+* js调用插件方法
+
+```js
+
+    //第一步:订单在服务端签名生成订单信息,具体请参考官网进行签名处理
+    var payInfo  = "xxxx";
+
+    //第二步:调用支付插件        	
+    cordova.plugins.AliPay.pay(payInfo,function success(e){},function error(e){});
+
+	 //e.resultStatus  状态代码  e.result  本次操作返回的结果数据 e.memo 提示信息
+	 //e.resultStatus  9000  订单支付成功 ;8000 正在处理中  调用function success
+	 //e.resultStatus  4000  订单支付失败 ;6001  用户中途取消 ;6002 网络连接出错  调用function error
+	 //当e.resultStatus为9000时,请去服务端验证支付结果
+	 			/**
+				 * 同步返回的结果必须放置到服务端进行验证(验证的规则请看https://doc.open.alipay.com/doc2/
+				 * detail.htm?spm=0.0.0.0.xdvAU6&treeId=59&articleId=103665&
+				 * docType=1) 建议商户依赖异步通知
+				 */
+
+```

+ 36 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/package.json

xqd
@@ -0,0 +1,36 @@
+{
+  "name": "cordova-plugin-offbye-alipay",
+  "version": "1.0.1",
+  "description": "Makes your Cordova application enable to use the Alipay SDK",
+  "cordova": {
+    "id": "cordova-plugin-offbye-alipay",
+    "platforms": [
+      "android", "ios"
+    ]
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/offbye/cordova-plugin-alipay.git"
+  },
+  "keywords": [
+    "cordova",
+    "chromium",
+    "alipay",
+    "ecosystem:cordova",
+    "cordova-ios",
+    "cordova-android"
+  ],
+  "engines": [{
+    "name": "cordova-android",
+    "version": ">=4"
+  }, {
+    "name": "cordova-plugman",
+    "version": ">=4.2.0"
+  }],
+  "author": "",
+  "license": "Apache 2.0",
+  "bugs": {
+    "url": "https://github.com/offbye/cordova-plugin-alipay"
+  },
+  "homepage": "https://github.com/offbye/cordova-plugin-alipay"
+}

+ 76 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/plugin.xml

xqd
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+xmlns:android="http://schemas.android.com/apk/res/android"
+    id="cordova-plugin-offbye-alipay"
+    version="1.0.1">
+    <name>AliPay</name>
+
+    <preference name="PARTNER_ID"/>
+    <js-module src="www/AliPay.js" name="AliPay">
+     		<clobbers target="cordova.plugins.AliPay" />
+    </js-module>
+    <platform name="android">
+        <config-file target="res/xml/config.xml" parent="/*">
+            <feature name="AliPay">
+                <param name="android-package" value="com.offbye.cordova.alipay.AliPay"/>
+            </feature>
+        </config-file>
+         <config-file target="AndroidManifest.xml" parent="/manifest">
+		      <uses-permission android:name="android.permission.INTERNET" />
+		      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+		      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+		      <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+		      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+        </config-file>
+        <config-file target="AndroidManifest.xml" parent="/manifest/application">
+                 <!-- alipay sdk begin -->
+        <activity
+            android:name="com.alipay.sdk.app.H5PayActivity"
+            android:configChanges="orientation|keyboardHidden|navigation|screenSize"
+            android:exported="false"
+            android:screenOrientation="behind"
+            android:windowSoftInputMode="adjustResize|stateHidden" >
+        </activity>
+        <!-- alipay sdk end -->
+        </config-file>
+        <source-file src="src/android/libs/alipaySdk-20160825.jar" target-dir="libs"/>
+        <source-file src="src/android/AliPay.java" target-dir="src/com/offbye/cordova/alipay" />
+        <source-file src="src/android/PayResult.java" target-dir="src/com/offbye/cordova/alipay" />
+    </platform>
+    <platform name="ios">
+        <config-file target="config.xml" parent="/widget">
+        <preference name="partner" value="$PARTNER_ID" />
+        <feature name="AliPay">
+            <param name="ios-package" value="AlipayPlugin" />
+            <param name="onload" value="true" />
+          </feature>
+        </config-file>
+
+        <config-file target="*-Info.plist" parent="CFBundleURLTypes">
+          <array>
+              <dict>
+                  <key>CFBundleURLName</key>
+                  <string>alipay</string>
+                  <key>CFBundleURLSchemes</key>
+                  <array>
+                      <string>a$PARTNER_ID</string>
+                  </array>
+              </dict>
+          </array>
+        </config-file>
+
+        <framework src="CoreTelephony.framework" weak="true" />
+        <framework src="Security.framework" weak="true" />
+        <framework src="SystemConfiguration.framework" weak="true" />
+        <framework src="CoreMotion.framework" weak="true" />
+        <framework src="CFNetwork.framework" weak="true" />
+        <framework src="libc++.tbd" weak="true" />
+
+        <framework src="src/ios/lib/AlipaySDK.framework" custom="true" />
+        <resource-file src="src/lib/AlipaySDK.bundle"/>
+
+        <header-file src="src/ios/AlipayPlugin.h"/>
+        <source-file src="src/ios/AlipayPlugin.m"/>
+
+    </platform>
+</plugin>

+ 109 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/src/android/AliPay.java

xqd
@@ -0,0 +1,109 @@
+package com.offbye.cordova.alipay;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.PluginResult;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.os.Handler;
+import android.os.Message;
+import android.text.TextUtils;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.alipay.sdk.app.PayTask;
+
+public class AliPay extends CordovaPlugin {
+
+	private static final int SDK_PAY_FLAG = 1;
+	private static String TAG = "AliPay";
+
+	private Handler mHandler = new Handler() {
+		public void handleMessage(Message msg) {
+			switch (msg.what) {
+			case SDK_PAY_FLAG: {
+				PayResult payResult = new PayResult((String) msg.obj);
+				/**
+				 * 同步返回的结果必须放置到服务端进行验证(验证的规则请看https://doc.open.alipay.com/doc2/
+				 * detail.htm?spm=0.0.0.0.xdvAU6&treeId=59&articleId=103665&
+				 * docType=1) 建议商户依赖异步通知
+				 */
+				String resultInfo = payResult.getResult();// 同步返回需要验证的信息
+
+				String resultStatus = payResult.getResultStatus();
+				if (TextUtils.equals(resultStatus, "9000")) {
+					Toast.makeText(cordova.getActivity(), "支付成功",
+							Toast.LENGTH_SHORT).show();
+				} else {
+
+					if (TextUtils.equals(resultStatus, "8000")) {
+						Toast.makeText(cordova.getActivity(), "支付结果确认中",
+								Toast.LENGTH_SHORT).show();
+					} else {
+						Toast.makeText(cordova.getActivity(), "支付失败",
+								Toast.LENGTH_SHORT).show();
+					}
+				}
+				break;
+			}
+			default:
+				break;
+			}
+		}
+	};
+
+	@Override
+	public boolean execute(String action, JSONArray args,
+			final CallbackContext callbackContext) throws JSONException {
+		PluginResult result = null;
+		if ("pay".equals(action)) {
+
+			 //订单信息在服务端签名后返回
+			 final String payInfo = args.getString(0);
+
+			 if (payInfo == null || payInfo.equals("") || payInfo.equals("null")) {
+				callbackContext.error("Please enter order information");
+			 	return true;
+			 }
+
+			cordova.getThreadPool().execute(new Runnable() {
+				@Override
+				public void run() {
+					Log.i(TAG, " 构造PayTask 对象 ");
+					PayTask alipay = new PayTask(cordova.getActivity());
+					Log.i(TAG, " 调用支付接口,获取支付结果 ");
+					String result = alipay.pay(payInfo, true);
+
+					// 更新主ui的Toast
+					Message msg = new Message();
+					msg.what = SDK_PAY_FLAG;
+					msg.obj = result;
+					mHandler.sendMessage(msg);
+
+					PayResult payResult = new PayResult(result);
+					if (TextUtils.equals(payResult.getResultStatus(), "9000")) {
+						Log.i(TAG, " 9000则代表支付成功,具体状态码代表含义可参考接口文档 ");
+						callbackContext.success(payResult.toJson());
+					} else {
+						Log.i(TAG, " 为非9000则代表可能支付失败 ");
+						if (TextUtils.equals(payResult.getResultStatus(),
+								"8000")) {
+							Log.i(TAG,
+									" 8000代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准(小概率状态) ");
+							callbackContext.success(payResult.toJson());
+						} else {
+							Log.i(TAG, " 其他值就可以判断为支付失败,包括用户主动取消支付,或者系统返回的错误 ");
+							callbackContext.error(payResult.toJson());
+						}
+					}
+				}
+			});
+			return true;
+		} else {
+			callbackContext.error("no such method:" + action);
+			return false;
+		}
+	}
+
+}

+ 1 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/src/android/PayResult.java

xqd
@@ -0,0 +1 @@
+package com.offbye.cordova.alipay;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONObject;

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 + "}";
	}
    public JSONObject toJson(){
        Map<String, String> payResultsMap = new HashMap<String, String>() {{
            put("resultStatus", resultStatus);
            put("memo", memo);
            put("result", result);
        }};
        return new JSONObject(payResultsMap);
    }

	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;
	}
}

BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/android/libs/alipaySdk-20160825.jar


+ 11 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/AlipayPlugin.h

xqd
@@ -0,0 +1,11 @@
+#import <Cordova/CDV.h>
+
+@interface AlipayPlugin : CDVPlugin
+
+@property(nonatomic,strong)NSString *partner;
+// @property(nonatomic,strong)NSString *seller;
+// @property(nonatomic,strong)NSString *privateKey;
+@property(nonatomic,strong)NSString *currentCallbackId;
+
+- (void) pay:(CDVInvokedUrlCommand*)command;
+@end

+ 83 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/AlipayPlugin.m

xqd
@@ -0,0 +1,83 @@
+#import "AlipayPlugin.h"
+#import <AlipaySDK/AlipaySDK.h>
+
+@implementation AlipayPlugin
+
+-(void)pluginInitialize{
+    CDVViewController *viewController = (CDVViewController *)self.viewController;
+    self.partner = [viewController.settings objectForKey:@"partner"];
+}
+
+- (void) pay:(CDVInvokedUrlCommand*)command
+{
+    self.currentCallbackId = command.callbackId;
+    //partner和seller获取失败,提示
+    if ([self.partner length] == 0)
+    {
+        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
+                                                        message:@"缺少partner。"
+                                                       delegate:self
+                                              cancelButtonTitle:@"确定"
+                                              otherButtonTitles:nil];
+        [alert show];
+        return;
+    }
+
+    //从API请求获取支付信息
+    NSString *signedString = [command argumentAtIndex:0];
+
+    if (signedString != nil) {
+
+        [[AlipaySDK defaultService] payOrder:signedString fromScheme:[NSString stringWithFormat:@"a%@", self.partner] callback:^(NSDictionary *resultDic) {
+            if ([[resultDic objectForKey:@"resultStatus"]  isEqual: @"9000"]) {
+                [self successWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
+            } else {
+                [self failWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
+            }
+            
+            NSLog(@"reslut = %@",resultDic);
+        }];
+
+    }
+}
+
+- (void)handleOpenURL:(NSNotification *)notification
+{
+    NSURL* url = [notification object];
+    
+    if ([url isKindOfClass:[NSURL class]] && [url.scheme isEqualToString:[NSString stringWithFormat:@"a%@", self.partner]])
+    {
+        [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
+            if ([[resultDic objectForKey:@"resultStatus"]  isEqual: @"9000"]) {
+                [self successWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
+            } else {
+                [self failWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
+            }
+        }];
+    }
+}
+
+- (void)successWithCallbackID:(NSString *)callbackID withMessage:(NSString *)message
+{
+    CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
+    [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
+}
+
+- (void)failWithCallbackID:(NSString *)callbackID withMessage:(NSString *)message
+{
+    CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message];
+    [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
+}
+- (void)successWithCallbackID:(NSString *)callbackID messageAsDictionary:(NSDictionary *)message
+{
+    CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
+    [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
+}
+
+- (void)failWithCallbackID:(NSString *)callbackID messageAsDictionary:(NSDictionary *)message
+{
+    CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:message];
+    [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
+}
+
+@end

BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/bar@2x.png


BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/refresh@2x.png


BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/refresh_click@2x.png


BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/shutdown@2x.png


BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.bundle/shutdown_click@2x.png


BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/AlipaySDK


+ 33 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/Headers/APayAuthInfo.h

xqd
@@ -0,0 +1,33 @@
+//
+//  APAuthInfo.h
+//  AliSDKDemo
+//
+//  Created by 方彬 on 14-7-18.
+//  Copyright (c) 2014年 Alipay.com. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface APayAuthInfo : NSObject
+
+@property(nonatomic, copy)NSString *appID;
+@property(nonatomic, copy)NSString *pid;
+@property(nonatomic, copy)NSString *redirectUri;
+
+/**
+ *  初始化AuthInfo
+ *
+ *  @param appIDStr     应用ID
+ *  @param productIDStr 产品码 该商户在aboss签约的产品,用户获取pid获取的参数
+ *  @param pidStr       商户ID   可不填
+ *  @param uriStr       授权的应用回调地址  比如:alidemo://auth
+ *
+ *  @return authinfo实例
+ */
+- (id)initWithAppID:(NSString *)appIDStr
+                pid:(NSString *)pidStr
+        redirectUri:(NSString *)uriStr;
+
+- (NSString *)description;
+- (NSString *)wapDescription;
+@end

+ 177 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/Headers/AlipaySDK.h

xqd
@@ -0,0 +1,177 @@
+//
+//  AlipaySDK.h
+//  AlipaySDK
+//
+//  Created by 方彬 on 14-4-28.
+//  Copyright (c) 2014年 Alipay. All rights reserved.
+//
+
+
+////////////////////////////////////////////////////////
+////////////////version:2.1  motify:2014.12.24//////////
+///////////////////Merry Christmas=。=//////////////////
+////////////////////////////////////////////////////////
+
+
+#import "APayAuthInfo.h"
+typedef enum {
+    ALIPAY_TIDFACTOR_IMEI,
+    ALIPAY_TIDFACTOR_IMSI,
+    ALIPAY_TIDFACTOR_TID,
+    ALIPAY_TIDFACTOR_CLIENTKEY,
+    ALIPAY_TIDFACTOR_VIMEI,
+    ALIPAY_TIDFACTOR_VIMSI,
+    ALIPAY_TIDFACTOR_CLIENTID,
+    ALIPAY_TIDFACTOR_APDID,
+    ALIPAY_TIDFACTOR_MAX
+} AlipayTidFactor;
+
+typedef void(^CompletionBlock)(NSDictionary *resultDic);
+
+@interface AlipaySDK : NSObject
+
+/**
+ *  创建支付单例服务
+ *
+ *  @return 返回单例对象
+ */
++ (AlipaySDK *)defaultService;
+
+/**
+ *  用于设置SDK使用的window,如果没有自行创建window无需设置此接口
+ */
+@property (nonatomic, weak) UIWindow *targetWindow;
+
+/**
+ *  支付接口
+ *
+ *  @param orderStr       订单信息
+ *  @param schemeStr      调用支付的app注册在info.plist中的scheme
+ *  @param compltionBlock 支付结果回调Block,用于wap支付结果回调(非跳转钱包支付)
+ */
+- (void)payOrder:(NSString *)orderStr
+      fromScheme:(NSString *)schemeStr
+        callback:(CompletionBlock)completionBlock;
+
+/**
+ *  处理钱包或者独立快捷app支付跳回商户app携带的支付结果Url
+ *
+ *  @param resultUrl        支付结果url
+ *  @param completionBlock  支付结果回调
+ */
+- (void)processOrderWithPaymentResult:(NSURL *)resultUrl
+                      standbyCallback:(CompletionBlock)completionBlock;
+
+
+
+/**
+ *  获取交易token。
+ *
+ *  @return 交易token,若无则为空。
+ */
+- (NSString *)fetchTradeToken;
+
+/**
+ *  是否已经使用过
+ *
+ *  @return YES为已经使用过,NO反之
+ */
+- (BOOL)isLogined;
+
+/**
+ *  当前版本号
+ *
+ *  @return 当前版本字符串
+ */
+- (NSString *)currentVersion;
+
+/**
+ *  当前版本号
+ *
+ *  @return tid相关信息
+ */
+- (NSString*)queryTidFactor:(AlipayTidFactor)factor;
+
+/**
+ *  測試所用,realse包无效
+ *
+ *  @param url  测试环境
+ */
+- (void)setUrl:(NSString *)url;
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////h5 拦截支付入口///////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  url order 获取接口
+ *
+ *  @param urlStr     拦截的 url string
+ *
+ *  @return 获取到的url order info
+ */
+- (NSString*)fetchOrderInfoFromH5PayUrl:(NSString*)urlStr;
+
+
+/**
+ *  url支付接口
+ *
+ *  @param orderStr       订单信息
+ *  @param schemeStr      调用支付的app注册在info.plist中的scheme
+ *  @param compltionBlock 支付结果回调Block
+ */
+- (void)payUrlOrder:(NSString *)orderStr
+         fromScheme:(NSString *)schemeStr
+           callback:(CompletionBlock)completionBlock;
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////授权1.0//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  快登授权
+ *  @param authInfo         需授权信息
+ *  @param completionBlock  授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效,
+                            需要调用方在appDelegate中调用processAuthResult:standbyCallback:方法获取授权结果
+ */
+- (void)authWithInfo:(APayAuthInfo *)authInfo
+             callback:(CompletionBlock)completionBlock;
+
+
+/**
+ *  处理授权信息Url
+ *
+ *  @param resultUrl        钱包返回的授权结果url
+ *  @param completionBlock  授权结果回调
+ */
+- (void)processAuthResult:(NSURL *)resultUrl
+          standbyCallback:(CompletionBlock)completionBlock;
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////授权2.0//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  快登授权2.0
+ *
+ *  @param infoStr          授权请求信息字符串
+ *  @param schemeStr        调用授权的app注册在info.plist中的scheme
+ *  @param completionBlock  授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效,
+                            需要调用方在appDelegate中调用processAuth_V2Result:standbyCallback:方法获取授权结果
+ */
+- (void)auth_V2WithInfo:(NSString *)infoStr
+             fromScheme:(NSString *)schemeStr
+               callback:(CompletionBlock)completionBlock;
+
+/**
+ *  处理授权信息Url
+ *
+ *  @param resultUrl        钱包返回的授权结果url
+ *  @param completionBlock  授权结果回调
+ */
+- (void)processAuth_V2Result:(NSURL *)resultUrl
+             standbyCallback:(CompletionBlock)completionBlock;
+
+@end

BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/Info.plist


BIN
miaomiao/plugins/cordova-plugin-offbye-alipay/src/ios/lib/AlipaySDK.framework/en.lproj/InfoPlist.strings


+ 9 - 0
miaomiao/plugins/cordova-plugin-offbye-alipay/www/AliPay.js

xqd
@@ -0,0 +1,9 @@
+var exec = require('cordova/exec');
+
+exports.pay = function (paymentInfo, successCallback, errorCallback) {   
+		if(!paymentInfo){
+			errorCallback && errorCallback("Please enter order information");  
+		}else{
+			exec(successCallback, errorCallback, "AliPay", "pay", [paymentInfo]);
+		}
+};

+ 3 - 2
miaomiao/plugins/fetch.json

xqd
@@ -94,8 +94,9 @@
     },
     "cordova-plugin-offbye-alipay": {
         "source": {
-            "type": "registry",
-            "id": "cordova-plugin-offbye-alipay@git+https://github.com/offbye/cordova-plugin-alipay.git"
+            "type": "git",
+            "url": "https://github.com/offbye/cordova-plugin-alipay.git",
+            "subdir": "."
         },
         "is_top_level": true,
         "variables": {