├── .gitattributes ├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── libraries │ │ ├── animated_vector_drawable_23_3_0.xml │ │ ├── api_82.xml │ │ ├── api_82_sources.xml │ │ ├── appcompat_v7_23_3_0.xml │ │ ├── hamcrest_core_1_3.xml │ │ ├── junit_4_12.xml │ │ ├── support_annotations_23_3_0.xml │ │ ├── support_v4_23_3_0.xml │ │ └── support_vector_drawable_23_3_0.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── workspace.xml ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libs │ ├── dom4j-1.6.1.jar │ ├── jdom.jar │ ├── jetty-client-7.6.0.RC4.jar │ ├── jetty-continuation-7.6.0.RC4.jar │ ├── jetty-deploy-7.6.0.RC4.jar │ ├── jetty-http-7.6.0.RC4.jar │ ├── jetty-io-7.6.0.RC4.jar │ ├── jetty-security-7.6.0.RC4.jar │ ├── jetty-server-7.6.0.RC4.jar │ ├── jetty-servlet-7.6.0.RC4.jar │ ├── jetty-util-7.6.0.RC4.jar │ ├── jetty-webapp-7.6.0.RC4.jar │ ├── jetty-xml-7.6.0.RC4.jar │ ├── jstl-1.2.jar │ └── servlet-api-2.5.jar ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── xposed_init │ ├── java │ └── cn │ │ └── sanlicun │ │ └── pay │ │ ├── App.java │ │ ├── Constans.java │ │ ├── MainActivity.java │ │ ├── PluginMain.java │ │ ├── SettingActivity.java │ │ ├── hook │ │ ├── AliBillPlugin.java │ │ ├── AliPayeePlugin.java │ │ ├── AliPlugin.java │ │ ├── IPlugin.java │ │ ├── ISubPlugin.java │ │ ├── WechatBillPlugin.java │ │ ├── WechatPayeePlugin.java │ │ └── WechatPlugin.java │ │ ├── model │ │ ├── BaseModel.java │ │ └── QrRetModel.java │ │ ├── net │ │ ├── Api.java │ │ ├── BaseApi.java │ │ └── INet.java │ │ ├── param │ │ └── PushParam.java │ │ ├── receiver │ │ ├── BillResultReceiver.java │ │ └── QrCodeReceiver.java │ │ ├── sqlite │ │ ├── DBHelper.java │ │ └── DBManager.java │ │ ├── util │ │ ├── LogUtils.java │ │ ├── PayHelperUtils.java │ │ ├── PreUtils.java │ │ ├── StringUtils.java │ │ └── Version.java │ │ └── web │ │ ├── AndroidLog.java │ │ ├── DefaultHandler.java │ │ ├── ServlertConfig.java │ │ ├── WebService.java │ │ └── servlet │ │ ├── BaseServlet.java │ │ └── PayServlet.java │ └── res │ ├── drawable │ ├── edit_shape.xml │ ├── ic_info_black_24dp.xml │ ├── ic_notifications_black_24dp.xml │ └── ic_sync_black_24dp.xml │ ├── layout │ ├── activity_main.xml │ └── activity_setting.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ ├── dimens.xml │ └── strings.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── pref_data_sync.xml │ ├── pref_general.xml │ ├── pref_headers.xml │ └── pref_notification.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Android 39 | 40 | 41 | Android > Lint > Accessibility 42 | 43 | 44 | Android > Lint > Correctness 45 | 46 | 47 | Android > Lint > Correctness > Messages 48 | 49 | 50 | Android > Lint > Internationalization 51 | 52 | 53 | Android > Lint > Performance 54 | 55 | 56 | Android > Lint > Security 57 | 58 | 59 | Android > Lint > Usability 60 | 61 | 62 | Android > Lint > Usability > Icons 63 | 64 | 65 | Android > Lint > Usability > Typography 66 | 67 | 68 | Concurrency annotation issuesJava 69 | 70 | 71 | Data flow issuesJava 72 | 73 | 74 | Groovy 75 | 76 | 77 | Initialization issuesJava 78 | 79 | 80 | Java 81 | 82 | 83 | Serialization issuesJava 84 | 85 | 86 | Threading issuesGroovy 87 | 88 | 89 | Threading issuesJava 90 | 91 | 92 | 93 | 94 | Android 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 116 | 117 | 118 | 119 | 120 | 1.8 121 | 122 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # alipay 2 | xponsed 下 先打开软件 在打开支付宝 回到软件进行测试 -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/.idea/.name: -------------------------------------------------------------------------------- 1 | app -------------------------------------------------------------------------------- /app/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | -------------------------------------------------------------------------------- /app/.idea/libraries/animated_vector_drawable_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/.idea/libraries/api_82.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/.idea/libraries/api_82_sources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/.idea/libraries/appcompat_v7_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/.idea/libraries/support_annotations_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/.idea/libraries/support_v4_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/.idea/libraries/support_vector_drawable_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | -------------------------------------------------------------------------------- /app/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | 5 | compileSdkVersion 25 6 | buildToolsVersion "26.0.0" 7 | useLibrary 'org.apache.http.legacy' 8 | defaultConfig { 9 | applicationId "cn.sanlicun.pay" 10 | minSdkVersion 14 11 | targetSdkVersion 25 12 | versionCode 8 13 | versionName "1.0.8" 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | 17 | 18 | 19 | ndk { 20 | //根据需要 自行选择添加的对应cpu类型的.so库。 21 | abiFilters 'armeabi', 'armeabi-v7a','arm64-v8a' 22 | // 还可以添加 'x86', 'x86_64', 'mips', 'mips64' 23 | } 24 | manifestPlaceholders = [ 25 | 26 | XG_ACCESS_ID:"2100299511", 27 | XG_ACCESS_KEY : "AENE71281JYY", 28 | ] 29 | 30 | 31 | 32 | } 33 | buildTypes { 34 | release { 35 | minifyEnabled false 36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 37 | } 38 | } 39 | 40 | 41 | 42 | sourceSets { 43 | main { 44 | jniLibs.srcDirs = ['libs'] 45 | } 46 | 47 | 48 | } 49 | } 50 | 51 | repositories { 52 | jcenter(); 53 | } 54 | 55 | dependencies { 56 | provided 'de.robv.android.xposed:api:82' 57 | compile fileTree(include: ['*.jar'], dir: 'libs') 58 | // androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 59 | // exclude group: 'com.android.support', module: 'support-annotations' 60 | // }) 61 | compile 'com.android.support:appcompat-v7:25.3.1' 62 | // compile 'com.android.support.constraint:constraint-layout:1.0.2' 63 | testCompile 'junit:junit:4.12' 64 | compile 'com.jiechic.library:xUtils:2.6.14' 65 | compile 'com.alibaba:fastjson:1.2.19' 66 | compile 'org.greenrobot:eventbus:3.0.0' 67 | compile 'com.mcxiaoke.volley:library:1.0.19' 68 | compile 'org.jsoup:jsoup:1.9.2' 69 | compile files('libs/jetty-client-7.6.0.RC4.jar') 70 | compile files('libs/jetty-continuation-7.6.0.RC4.jar') 71 | compile files('libs/jetty-deploy-7.6.0.RC4.jar') 72 | compile files('libs/jetty-http-7.6.0.RC4.jar') 73 | compile files('libs/jetty-io-7.6.0.RC4.jar') 74 | compile files('libs/jetty-security-7.6.0.RC4.jar') 75 | compile files('libs/jetty-server-7.6.0.RC4.jar') 76 | compile files('libs/jetty-servlet-7.6.0.RC4.jar') 77 | compile files('libs/jetty-util-7.6.0.RC4.jar') 78 | compile files('libs/jetty-webapp-7.6.0.RC4.jar') 79 | compile files('libs/jetty-xml-7.6.0.RC4.jar') 80 | compile files('libs/jstl-1.2.jar') 81 | compile files('libs/servlet-api-2.5.jar') 82 | compile files('libs/dom4j-1.6.1.jar') 83 | compile files('libs/jdom.jar') 84 | } 85 | -------------------------------------------------------------------------------- /app/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /app/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /app/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/libs/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /app/libs/jdom.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jdom.jar -------------------------------------------------------------------------------- /app/libs/jetty-client-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-client-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-continuation-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-continuation-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-deploy-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-deploy-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-http-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-http-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-io-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-io-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-security-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-security-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-server-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-server-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-servlet-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-servlet-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-util-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-util-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-webapp-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-webapp-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jetty-xml-7.6.0.RC4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jetty-xml-7.6.0.RC4.jar -------------------------------------------------------------------------------- /app/libs/jstl-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/jstl-1.2.jar -------------------------------------------------------------------------------- /app/libs/servlet-api-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDayNoMore/Hook/c9db9f9941fcb63b1bad7d8687408bf4a3296af9/app/libs/servlet-api-2.5.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -dontoptimize 19 | -dontpreverify 20 | 21 | -dontwarn cn.jpush.** 22 | -keep class cn.jpush.** { *; } 23 | -keep class * extends cn.jpush.android.helpers.JPushMessageReceiver { *; } 24 | 25 | -dontwarn cn.jiguang.** 26 | -keep class cn.jiguang.** { *; } 27 | -dontwarn com.google.** 28 | -keep class com.google.gson.** {*;} 29 | -keep class com.google.protobuf.** {*;} 30 | 31 | -keep public class * extends android.app.Service 32 | -keep public class * extends android.content.BroadcastReceiver 33 | -keep class com.tencent.android.tpush.** {* ;} 34 | -keep class com.tencent.mid.** {* ;} 35 | -keep class com.qq.taf.jce.** {*;} -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 29 | 32 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | cn.sanlicun.pay.PluginMain -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/App.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | 7 | /** 8 | * Created by 小饭 on 2018/7/6. 9 | */ 10 | 11 | public class App extends Application { 12 | public static Context ctx; 13 | 14 | @Override 15 | public void onCreate() { 16 | super.onCreate(); 17 | ctx=getApplicationContext(); 18 | } 19 | 20 | public static Context getCtx() { 21 | return ctx; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/Constans.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay; 2 | 3 | /** 4 | * Created by 小饭 on 2018/7/5. 5 | */ 6 | 7 | public class Constans { 8 | public static final String WECHAT_PACKAGE = "com.tencent.mm"; 9 | 10 | public static final String ACTION_LAUNCH_WECHAT_WALLET = "cn.sanlicun.action.wechat"; 11 | public static final String ACTION_LAUNCH_ALIPAY_WALLET = "cn.sanlicun.action.alipay"; 12 | 13 | public static final String ACTION_PAY_SUCCESS = "cn.sanlicun.pay.action.pay_success"; 14 | 15 | 16 | public static final String ALIPAY_PACKAGE = "com.eg.android.AlipayGphone"; 17 | public static final String ALIPAY_WALLET_ACTIVITY_NAME = "com.alipay.mobile.onsitepay9.payer.OspTabHostActivity"; 18 | public static final String ALIPAY_CORE_SERVICE_NAME = "com.alipay.android.phone.nfd.nfdservice.ui.app.NfdService"; 19 | 20 | public static final String SETMONEYACTIVITY="com.alipay.mobile.payee.ui.PayeeQRSetMoneyActivity"; 21 | public static final String ALIPAYNAME="com.eg.android.AlipayGphone"; 22 | public static final String SETAMOUNTRES="com.alipay.transferprod.rpc.result.ConsultSetAmountRes"; 23 | public static final String MARK = "mark"; 24 | public static final String MONEY = "money"; 25 | public static final String QRCODE_RESULT = "cn.sanlicun.qrcode_result"; 26 | public static final String WECHAT_QRCODE = "com.tencent.mm.plugin.collect.ui.CollectCreateQRCodeUI"; 27 | public static final String PAY_URL = "payurl"; 28 | public static final String TYPE = "type"; 29 | public static final String WECHAT = "wechat"; 30 | public static final String ALIPAY = "alipay"; 31 | public static final String BILL_NO = "bill_no"; 32 | public static final String BILL_MONEY = "bill_money"; 33 | public static final String BILL_MARK = "bill_mark"; 34 | public static final String BILL_TYPE = "bill_type"; 35 | 36 | public static final String WECHAT_WALLET="com.tencent.mm.wallet_core.ui.formview.WalletFormView"; 37 | 38 | public static final String WECHAT_SQL="com.tencent.wcdb.database.SQLiteDatabase"; 39 | public static final String ALI_SQL="com.alipay.android.phone.messageboxstatic.biz.dao.TradeDao"; 40 | 41 | 42 | public static final CharSequence QQ = "com.tencent.mobileqq"; 43 | public static final String ACTION_LAUNCH_QQ_WALLET = "cn.sanlicun.action.qq"; 44 | public static final String MESSAGE_RECEIVED_ACTION = "com.example.jpushdemo.MESSAGE_RECEIVED_ACTION"; 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/MainActivity.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay; 2 | 3 | 4 | import android.app.ActivityManager; 5 | import android.content.BroadcastReceiver; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.content.IntentFilter; 9 | import android.os.Bundle; 10 | import android.os.Handler; 11 | import android.os.Message; 12 | import android.support.v7.app.AppCompatActivity; 13 | import android.util.Log; 14 | import android.view.View; 15 | import android.view.WindowManager; 16 | import android.widget.TextView; 17 | 18 | import java.text.SimpleDateFormat; 19 | import java.util.Date; 20 | import java.util.UUID; 21 | 22 | import cn.sanlicun.pay.web.WebService; 23 | 24 | 25 | public class MainActivity extends AppCompatActivity { 26 | 27 | 28 | private static TextView tv; 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | 34 | setContentView(R.layout.activity_main); 35 | tv= (TextView) findViewById(R.id.info); 36 | Intent intent = new Intent(this, WebService.class); 37 | startService(intent); 38 | 39 | 40 | registerMessageReceiver(); 41 | 42 | findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() { 43 | @Override 44 | public void onClick(View v) { 45 | startAlipay(); 46 | 47 | } 48 | }); 49 | 50 | findViewById(R.id.btn2).setOnClickListener(new View.OnClickListener() { 51 | @Override 52 | public void onClick(View v) { 53 | startWechat(); 54 | 55 | } 56 | }); 57 | findViewById(R.id.btn3).setOnClickListener(new View.OnClickListener() { 58 | @Override 59 | public void onClick(View v) { 60 | startActivity(new Intent(MainActivity.this,SettingActivity.class)); 61 | } 62 | }); 63 | 64 | tv= (TextView) findViewById(R.id.info); 65 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 66 | } 67 | 68 | 69 | private void startWechat() { 70 | Intent intent = new Intent(Constans.ACTION_LAUNCH_WECHAT_WALLET); 71 | intent.putExtra(Constans.MARK, UUID.randomUUID().toString()); 72 | intent.putExtra(Constans.MONEY, "0.01"); 73 | sendBroadcast(intent); 74 | } 75 | 76 | void startAlipay() { 77 | isRunning(); 78 | Intent intent = new Intent(Constans.ACTION_LAUNCH_ALIPAY_WALLET); 79 | intent.putExtra(Constans.MARK, "我是一个测试demo"); 80 | intent.putExtra(Constans.MONEY, "0.01"); 81 | sendBroadcast(intent); 82 | 83 | } 84 | 85 | 86 | public boolean isRunning() { 87 | ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); 88 | for (ActivityManager.RunningServiceInfo rsi : am.getRunningServices(Integer.MAX_VALUE)) { 89 | String pkgName = rsi.service.getPackageName(); 90 | if (pkgName.equals(Constans.ALIPAY_PACKAGE)) { 91 | if (rsi.process.equals(Constans.ALIPAY_PACKAGE)) { 92 | return true; 93 | } 94 | } 95 | } 96 | return false; 97 | } 98 | 99 | 100 | 101 | //for receive customer msg from jpush server 102 | private MessageReceiver mMessageReceiver; 103 | 104 | public void registerMessageReceiver() { 105 | mMessageReceiver = new MessageReceiver(); 106 | IntentFilter filter = new IntentFilter(); 107 | filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); 108 | filter.addAction(Constans.MESSAGE_RECEIVED_ACTION); 109 | registerReceiver(mMessageReceiver, filter); 110 | } 111 | 112 | public class MessageReceiver extends BroadcastReceiver { 113 | 114 | @Override 115 | public void onReceive(Context context, Intent intent) { 116 | Log.i("tag", "MessageReceiver"); 117 | try { 118 | if (Constans.MESSAGE_RECEIVED_ACTION.equals(intent.getAction())) { 119 | String messge = intent.getStringExtra("msg"); 120 | Log.i("tag", "msg: "+messge); 121 | setCostomMsg(messge); 122 | } 123 | } catch (Exception e) { 124 | } 125 | } 126 | } 127 | 128 | 129 | 130 | public static void setCostomMsg(String paramString) 131 | { 132 | Message message = new Message(); 133 | message.what = 1; 134 | Bundle localBundle = new Bundle(); 135 | Date localDate = new Date(System.currentTimeMillis()); 136 | localBundle.putString("log", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(localDate) + ":" + " 结果:" + paramString); 137 | message.setData(localBundle); 138 | try 139 | { 140 | Log.i("tag","setCostomMsg"); 141 | handler.sendMessage(message); 142 | return; 143 | } 144 | catch (Exception e) 145 | { 146 | e.printStackTrace(); 147 | } 148 | } 149 | 150 | public static Handler handler = new Handler() 151 | { 152 | public void handleMessage(Message msg) 153 | { 154 | Log.i("tag", "handleMessage: "); 155 | String str =msg.getData().getString("log"); 156 | super.handleMessage(msg); 157 | if(str==null) return; 158 | tv.setText(tv.getText().toString()+"\r\n"+str); 159 | // if(str.length()>2000){ 160 | // tv.setText(""); 161 | // str=""; 162 | // } 163 | // tv.setText(str+"\r\n"+msg.getData().getString("log")); 164 | } 165 | }; 166 | 167 | 168 | @Override 169 | protected void onDestroy() { 170 | super.onDestroy(); 171 | Intent intent = new Intent(this, WebService.class); 172 | stopService(intent); 173 | } 174 | 175 | @Override 176 | public void onBackPressed() { 177 | moveTaskToBack(false); 178 | // super.onBackPressed(); //注释super,拦截返回键功能 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/PluginMain.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay; 2 | 3 | import cn.sanlicun.pay.hook.AliPlugin; 4 | import cn.sanlicun.pay.hook.WechatPlugin; 5 | import de.robv.android.xposed.IXposedHookLoadPackage; 6 | import de.robv.android.xposed.XposedBridge; 7 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 8 | 9 | 10 | /** 11 | * Created by qzj_ on 2016/5/9. 12 | */ 13 | public class PluginMain implements IXposedHookLoadPackage { 14 | 15 | public PluginMain() { 16 | XposedBridge.log("Now Loading HOHOalipay plugin..."); 17 | } 18 | 19 | 20 | @Override 21 | public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { 22 | 23 | new AliPlugin().load(lpparam); 24 | new WechatPlugin().load(lpparam); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/SettingActivity.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | import android.widget.Button; 7 | import android.widget.EditText; 8 | import android.widget.Toast; 9 | 10 | import cn.sanlicun.pay.util.PreUtils; 11 | 12 | public class SettingActivity extends AppCompatActivity implements View.OnClickListener { 13 | 14 | private EditText etAsyn, etSync, etSign, etAccount; 15 | private Button btnSubmit, btnBack; 16 | private PreUtils preUtils; 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_setting); 22 | initView(); 23 | initDate(); 24 | } 25 | 26 | private void initView() { 27 | etAccount = (EditText) findViewById(R.id.ed_account); 28 | etAsyn = (EditText) findViewById(R.id.ed_asyn); 29 | etSync = (EditText) findViewById(R.id.et_sync); 30 | etSign = (EditText) findViewById(R.id.ed_sign); 31 | btnBack = (Button) findViewById(R.id.btn_back); 32 | btnBack.setOnClickListener(this); 33 | btnSubmit = (Button) findViewById(R.id.btn_submit); 34 | btnSubmit.setOnClickListener(this); 35 | } 36 | 37 | private void initDate() { 38 | preUtils=new PreUtils(); 39 | String account = preUtils.getString(PreUtils.PRE_ACCOUNT, ""); 40 | String sign = preUtils.getString(PreUtils.PRE_SIGN, ""); 41 | String asyn = preUtils.getString(PreUtils.PRE_ASYN, ""); 42 | String sync = preUtils.getString(PreUtils.PRE_SYNC, ""); 43 | etAccount.setText(account); 44 | etSign.setText(sign); 45 | etSync.setText(sync); 46 | etAsyn.setText(asyn); 47 | } 48 | 49 | 50 | @Override 51 | public void onClick(View v) { 52 | switch (v.getId()) { 53 | case R.id.btn_submit: 54 | Submit(); 55 | 56 | break; 57 | case R.id.btn_back: 58 | SettingActivity.this.finish(); 59 | break; 60 | } 61 | 62 | } 63 | 64 | private void Submit() { 65 | String account = etAccount.getText().toString().trim(); 66 | String sign = etSign.getText().toString().trim(); 67 | String asyn = etAsyn.getText().toString().trim(); 68 | String sync = etSync.getText().toString().trim(); 69 | 70 | preUtils.setString(PreUtils.PRE_ACCOUNT, account); 71 | preUtils.setString(PreUtils.PRE_SIGN, sign); 72 | preUtils.setString(PreUtils.PRE_ASYN, asyn); 73 | preUtils.setString(PreUtils.PRE_SYNC, sync); 74 | Toast.makeText(SettingActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/AliBillPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.util.Log; 6 | 7 | import com.alibaba.fastjson.JSONObject; 8 | 9 | import cn.sanlicun.pay.Constans; 10 | import de.robv.android.xposed.XC_MethodHook; 11 | import de.robv.android.xposed.XposedBridge; 12 | import de.robv.android.xposed.XposedHelpers; 13 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 14 | 15 | /** 16 | * Created by 小饭 on 2018/7/11. 17 | */ 18 | 19 | public class AliBillPlugin implements ISubPlugin { 20 | @Override 21 | public void load(XC_LoadPackage.LoadPackageParam loadPackageParam, final Context ctx) { 22 | Log.i("tag","AliBillPlugin"); 23 | 24 | 25 | XposedBridge.hookAllMethods(XposedHelpers.findClass(Constans.ALI_SQL, loadPackageParam.classLoader), "insertMessageInfo", new XC_MethodHook() { 26 | @Override 27 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable { 28 | Log.i("tag","123"); 29 | String str1 = (String) XposedHelpers.callMethod(param.args[0], "toString"); 30 | 31 | String str2 = str1.replace("content='", "'"); 32 | if ((str2.contains("二维码收款")) || (str2.contains("收到一笔转账"))) { 33 | JSONObject localJSONObject = JSONObject.parseObject(str2); 34 | String str3 = localJSONObject.getString("content").replace("¥", ""); 35 | String str4 = localJSONObject.getString("assistMsg2"); 36 | String str5 = str1.replace("tradeNO=", "&"); 37 | // g.a("收到支付宝支付订单:" + str5 + "==" + str3 + "==" + str4); 38 | Intent localIntent = new Intent(); 39 | localIntent.putExtra(Constans.BILL_NO, str5); 40 | localIntent.putExtra(Constans.BILL_MONEY, str3); 41 | localIntent.putExtra(Constans.BILL_MARK, str4); 42 | localIntent.putExtra(Constans.BILL_TYPE, Constans.ALIPAY); 43 | localIntent.setAction(Constans.ACTION_PAY_SUCCESS); 44 | ctx.sendBroadcast(localIntent); 45 | } 46 | 47 | } 48 | }); 49 | 50 | 51 | 52 | 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/AliPayeePlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | import android.view.View; 9 | import android.widget.Button; 10 | 11 | import cn.sanlicun.pay.Constans; 12 | import cn.sanlicun.pay.util.PayHelperUtils; 13 | import cn.sanlicun.pay.util.StringUtils; 14 | import de.robv.android.xposed.XC_MethodHook; 15 | import de.robv.android.xposed.XposedBridge; 16 | import de.robv.android.xposed.XposedHelpers; 17 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 18 | 19 | /** 20 | * Created by 小饭 on 2018/7/11. 21 | */ 22 | 23 | public class AliPayeePlugin implements ISubPlugin { 24 | 25 | 26 | @Override 27 | public void load(XC_LoadPackage.LoadPackageParam loadPackageParam, final Context context) { 28 | final ClassLoader clazzLoader = loadPackageParam.classLoader; 29 | 30 | 31 | // 32 | XposedBridge.hookAllMethods(XposedHelpers.findClass("com.alipay.android.phone.messageboxstatic.biz.dao.ServiceDao", clazzLoader), "insertMessageInfo", new XC_MethodHook() 33 | { 34 | protected void beforeHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam) 35 | throws Throwable 36 | { 37 | try 38 | { 39 | XposedBridge.log("======商户服务start========="); 40 | 41 | String str = StringUtils.getTextCenter((String)XposedHelpers.callMethod(paramAnonymousMethodHookParam.args[0], "toString", new Object[0]), "extraInfo='", "'").replace("\\", ""); 42 | Log.i("tag", "http: "+str); 43 | if ((str.contains("收钱到账")) || (str.contains("收款到账"))) 44 | { 45 | Log.i("tag","http1"); 46 | str = PayHelperUtils.getCookieStr(clazzLoader); 47 | Log.i("tag","http2"+str); 48 | PayHelperUtils.getTradeInfo(context, str); 49 | Log.i("tag","http3"); 50 | } 51 | XposedBridge.log("======商户服务end========="); 52 | } 53 | catch (Exception localException) 54 | { 55 | Log.i("tag","ServiceDao:error"); 56 | } 57 | super.beforeHookedMethod(paramAnonymousMethodHookParam); 58 | } 59 | }); 60 | 61 | Object[] payeeArr = new Object[2]; 62 | payeeArr[0] = Bundle.class; 63 | payeeArr[1] = new XC_MethodHook() { 64 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam hookParam) { 65 | Log.i("tag","1"); 66 | 67 | Activity ctx = (Activity) hookParam.thisObject; 68 | 69 | try { 70 | 71 | Object tvMoney = XposedHelpers.findField(ctx.getClass(), "b").get(ctx); 72 | Object tvMark = XposedHelpers.findField(ctx.getClass(), "c").get(ctx); 73 | Intent intent = ctx.getIntent(); 74 | XposedHelpers.callMethod(tvMoney, "setText", intent.getStringExtra(Constans.MONEY)); 75 | XposedHelpers.callMethod(tvMark, "setText", intent.getStringExtra(Constans.MARK)); 76 | XposedHelpers.callMethod(tvMark, "setVisibility", View.VISIBLE); 77 | Button btn = ((Button) XposedHelpers.findField(ctx.getClass(), "e").get(ctx)); 78 | btn.performClick(); 79 | 80 | } catch (Exception e) { 81 | 82 | e.printStackTrace(); 83 | } 84 | } 85 | }; 86 | XposedHelpers.findAndHookMethod(Constans.SETMONEYACTIVITY, clazzLoader, "onCreate", payeeArr); 87 | 88 | 89 | Object[] payResArr = new Object[2]; 90 | payResArr[0] = XposedHelpers.findClass(Constans.SETAMOUNTRES, clazzLoader); 91 | payResArr[1] = new XC_MethodHook() { 92 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam hookParam) { 93 | Log.i("tag","2"); 94 | Activity ctx = (Activity) hookParam.thisObject; 95 | try { 96 | String money = (String) XposedHelpers.findField(ctx.getClass(), "g").get(ctx); 97 | String mark = (String) XposedHelpers.callMethod(XposedHelpers.findField(ctx.getClass(), "c").get(ctx), "getUbbStr"); 98 | Object localObject = hookParam.args[0]; 99 | String qrCodeUrl = (String) XposedHelpers.findField(localObject.getClass(), "qrCodeUrl").get(localObject); 100 | 101 | 102 | if (money != null) { 103 | 104 | Intent intent = new Intent(); 105 | intent.putExtra(Constans.MONEY, money); 106 | intent.putExtra(Constans.MARK, mark); 107 | intent.putExtra(Constans.TYPE, Constans.ALIPAY); 108 | intent.putExtra(Constans.PAY_URL, qrCodeUrl); 109 | intent.setAction(Constans.QRCODE_RESULT); 110 | PayHelperUtils.sendmsg(ctx,"生成付款码"+ Constans.ALIPAY+":"+qrCodeUrl); 111 | ctx.sendBroadcast(intent); 112 | 113 | } 114 | } catch (Exception e) { 115 | e.printStackTrace(); 116 | } 117 | } 118 | }; 119 | XposedHelpers.findAndHookMethod(Constans.SETMONEYACTIVITY, clazzLoader, "a", payResArr); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/AliPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.app.Activity; 4 | import android.app.ActivityManager; 5 | import android.app.Application; 6 | import android.content.BroadcastReceiver; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.content.IntentFilter; 10 | import android.util.Log; 11 | 12 | import cn.sanlicun.pay.Constans; 13 | import de.robv.android.xposed.XC_MethodHook; 14 | import de.robv.android.xposed.XposedBridge; 15 | import de.robv.android.xposed.XposedHelpers; 16 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 17 | 18 | import static cn.sanlicun.pay.Constans.ACTION_LAUNCH_ALIPAY_WALLET; 19 | 20 | /** 21 | * Created by 小饭 on 2018/7/6. 22 | */ 23 | 24 | public class AliPlugin implements IPlugin { 25 | private int isAlipay = 0; 26 | 27 | @Override 28 | public void load(final XC_LoadPackage.LoadPackageParam loadPackageParam) { 29 | ClassLoader clazzLoader = loadPackageParam.classLoader; 30 | 31 | if (loadPackageParam.packageName.contains(Constans.ALIPAYNAME)) { 32 | 33 | 34 | XposedHelpers.findAndHookMethod(Application.class, "onCreate", new XC_MethodHook() { 35 | @Override 36 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 37 | Context ctx = (Context) param.thisObject; 38 | if (Constans.ALIPAYNAME.equals(getProcessName((Context) param.thisObject)) && (isAlipay < 1)) { 39 | isAlipay++; 40 | registerLaunchReceiver((Context) param.thisObject, loadPackageParam.classLoader); 41 | Log.i("tag","========init========="); 42 | // new AliBillPlugin().load(loadPackageParam, ctx); 43 | new AliPayeePlugin().load(loadPackageParam, ctx); 44 | 45 | } 46 | 47 | 48 | } 49 | }); 50 | 51 | 52 | 53 | 54 | 55 | 56 | XposedHelpers.findAndHookMethod(Activity.class, "onDestroy", new XC_MethodHook() { 57 | @Override 58 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 59 | final Activity activity = (Activity) param.thisObject; 60 | String name = activity.getClass().getName(); 61 | 62 | } 63 | }); 64 | 65 | 66 | 67 | 68 | } 69 | } 70 | 71 | private void registerLaunchReceiver(Context context, final ClassLoader classLoader) { 72 | 73 | IntentFilter intentFilter = new IntentFilter(ACTION_LAUNCH_ALIPAY_WALLET); 74 | 75 | 76 | BroadcastReceiver receiver = new BroadcastReceiver() { 77 | @Override 78 | public void onReceive(Context context, Intent intent) { 79 | 80 | XposedBridge.log("receive action: 接受到广播"); 81 | XposedBridge.log("receive action: " + intent.getAction()); 82 | final Class clazz = XposedHelpers.findClass(Constans.SETMONEYACTIVITY, classLoader); 83 | 84 | String money = intent.getStringExtra(Constans.MONEY); 85 | String mark = intent.getStringExtra(Constans.MARK); 86 | launchWallet(context, clazz, money, mark); 87 | } 88 | }; 89 | 90 | context.registerReceiver(receiver, intentFilter); 91 | 92 | 93 | } 94 | 95 | private void launchWallet(Context context, Class clazz, String money, String mark) { 96 | 97 | Intent intent = new Intent(context, clazz); 98 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 99 | intent.putExtra(Constans.MARK, mark); 100 | intent.putExtra(Constans.MONEY, money); 101 | context.startActivity(intent); 102 | } 103 | 104 | public String getProcessName(Context context) { 105 | int pid = android.os.Process.myPid(); 106 | ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); 107 | for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) { 108 | if (processInfo.pid == pid) { 109 | return processInfo.processName; 110 | } 111 | } 112 | return null; 113 | } 114 | 115 | 116 | } 117 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/IPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 4 | 5 | /** 6 | * Created by 小饭 on 2018/7/6. 7 | */ 8 | 9 | public interface IPlugin { 10 | void load(final XC_LoadPackage.LoadPackageParam param) ; 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/ISubPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.content.Context; 4 | 5 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 6 | 7 | /** 8 | * Created by 小饭 on 2018/7/11. 9 | */ 10 | 11 | public interface ISubPlugin { 12 | void load(XC_LoadPackage.LoadPackageParam loadPackageParam, Context ctx) ; 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/WechatBillPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.text.TextUtils; 7 | import android.util.Log; 8 | 9 | import com.alibaba.fastjson.JSONObject; 10 | 11 | import cn.sanlicun.pay.Constans; 12 | import de.robv.android.xposed.XC_MethodHook; 13 | import de.robv.android.xposed.XposedHelpers; 14 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 15 | 16 | /** 17 | * Created by 小饭 on 2018/7/10. 18 | */ 19 | 20 | public class WechatBillPlugin implements ISubPlugin { 21 | @Override 22 | public void load(XC_LoadPackage.LoadPackageParam param, final Context ctx) { 23 | 24 | 25 | Object[] arrayOfObject1 = new Object[4]; 26 | arrayOfObject1[0] = String.class; 27 | arrayOfObject1[1] = String.class; 28 | arrayOfObject1[2] = ContentValues.class; 29 | arrayOfObject1[3] = new XC_MethodHook() { 30 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam) { 31 | } 32 | 33 | protected void beforeHookedMethod(XC_MethodHook.MethodHookParam methodHookParam) { 34 | Log.i("tag", "w3"); 35 | try { 36 | ContentValues localContentValues = (ContentValues) methodHookParam.args[2]; 37 | String str1 = (String) methodHookParam.args[0]; 38 | 39 | if (!TextUtils.isEmpty(str1)) { 40 | if (!str1.equals("message")) 41 | return; 42 | Integer localInteger = localContentValues.getAsInteger("type"); 43 | if ((localInteger != null) && (localInteger.intValue() == 318767153)) { 44 | String content = localContentValues.getAsString("content"); 45 | Log.i("tag","content:"+content); 46 | JSONObject localJSONObject = JSONObject.parseObject(content).getJSONObject("msg"); 47 | Log.i("tag", "w4"); 48 | String str2 = localJSONObject.getJSONObject("appmsg").getJSONObject("mmreader").getJSONObject("template_detail").getJSONObject("line_content").getJSONObject("topline").getJSONObject("value").getString("word").replace("¥", ""); 49 | Log.i("tag", "w5" + str2); 50 | String str3 = localJSONObject.getJSONObject("appmsg").getJSONObject("mmreader").getJSONObject("template_detail").getJSONObject("line_content").getJSONObject("lines").getJSONArray("line").getJSONObject(0).getJSONObject("value").getString("word"); 51 | Log.i("tag", "w6" + str3); 52 | String str4 = localJSONObject.getJSONObject("appmsg").getString("template_id"); 53 | Log.i("tag", "w7" + str3); 54 | // g.a("收到微信支付订单:" + str4 + "==" + str2 + "==" + str3); 55 | Intent localIntent = new Intent(); 56 | localIntent.putExtra(Constans.BILL_NO, str4); 57 | localIntent.putExtra(Constans.BILL_MONEY, str2); 58 | localIntent.putExtra(Constans.BILL_MARK, str3); 59 | localIntent.putExtra(Constans.BILL_TYPE, Constans.WECHAT); 60 | localIntent.setAction(Constans.ACTION_PAY_SUCCESS); 61 | Log.i("tag", "w" + str1); 62 | ctx.sendBroadcast(localIntent); 63 | 64 | return; 65 | } 66 | } 67 | } catch (Exception localException) { 68 | 69 | } 70 | } 71 | }; 72 | XposedHelpers.findAndHookMethod(Constans.WECHAT_SQL, param.classLoader, "insert", arrayOfObject1); 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/WechatPayeePlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.util.Log; 7 | import android.widget.Button; 8 | 9 | import cn.sanlicun.pay.Constans; 10 | import cn.sanlicun.pay.util.PayHelperUtils; 11 | import de.robv.android.xposed.XC_MethodHook; 12 | import de.robv.android.xposed.XposedBridge; 13 | import de.robv.android.xposed.XposedHelpers; 14 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 15 | 16 | /** 17 | * Created by 小饭 on 2018/7/11. 18 | *

19 | * 只支持6.6.7 20 | */ 21 | 22 | public class WechatPayeePlugin implements ISubPlugin { 23 | @Override 24 | public void load(XC_LoadPackage.LoadPackageParam loadPackageParam, final Context context) { 25 | final ClassLoader classLoader = loadPackageParam.classLoader; 26 | try { 27 | XposedBridge.hookAllMethods(XposedHelpers.findClass("com.tencent.mm.plugin.collect.b.s", classLoader), "a", new XC_MethodHook() { 28 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam) 29 | throws Throwable { 30 | Log.i("tag","w1"); 31 | if (PayHelperUtils.getVerName(context).equals("6.6.7")) { 32 | double d = ((Double) XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "hUL").get(paramAnonymousMethodHookParam.thisObject)).doubleValue(); 33 | String str = (String) XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "desc").get(paramAnonymousMethodHookParam.thisObject); 34 | String URL = (String) XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "hUK").get(paramAnonymousMethodHookParam.thisObject); 35 | XposedBridge.log(d + " " + str + " " + paramAnonymousMethodHookParam); 36 | XposedBridge.log("调用增加数据方法==>微信"); 37 | Intent localIntent = new Intent(); 38 | localIntent.putExtra("money", d); 39 | localIntent.putExtra("mark", str); 40 | localIntent.putExtra("type", "wechat"); 41 | localIntent.putExtra("payurl", URL); 42 | localIntent.setAction(Constans.QRCODE_RESULT); 43 | context.sendBroadcast(localIntent); 44 | } 45 | while (!PayHelperUtils.getVerName(context).equals("6.6.6")) { 46 | return; 47 | } 48 | double d = ((Double) XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "llG").get(paramAnonymousMethodHookParam.thisObject)).doubleValue(); 49 | String str = (String) XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "desc").get(paramAnonymousMethodHookParam.thisObject); 50 | String pay = (String) XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "llF").get(paramAnonymousMethodHookParam.thisObject); 51 | XposedBridge.log(d + " " + str + " " + paramAnonymousMethodHookParam); 52 | XposedBridge.log("调用增加数据方法==>微信"); 53 | Intent localIntent = new Intent(); 54 | localIntent.putExtra("money", d); 55 | localIntent.putExtra("mark", str); 56 | localIntent.putExtra("type", "wechat"); 57 | localIntent.putExtra("payurl", pay); 58 | Log.i("tag", "wPay: "+pay); 59 | localIntent.setAction(Constans.QRCODE_RESULT); 60 | context.sendBroadcast(localIntent); 61 | } 62 | 63 | protected void beforeHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam) 64 | throws Throwable { 65 | } 66 | }); 67 | try { 68 | XposedHelpers.findAndHookMethod("com.tencent.mm.plugin.collect.ui.CollectCreateQRCodeUI", classLoader, "initView", new Object[]{new XC_MethodHook() { 69 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam) 70 | throws Throwable { 71 | Log.i("tag","w2"); 72 | XposedBridge.log("Hook微信开始......"); 73 | XposedBridge.log("Hook微信开始......"); 74 | if (PayHelperUtils.getVerName(context).equals("6.6.7")) { 75 | Intent localObject1 = ((Activity) paramAnonymousMethodHookParam.thisObject).getIntent(); 76 | String mark = ((Intent) localObject1).getStringExtra("mark"); 77 | String money = ((Intent) localObject1).getStringExtra("money"); 78 | Object localObject2 = XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "hXD").get(paramAnonymousMethodHookParam.thisObject); 79 | XposedHelpers.callMethod(XposedHelpers.findField(XposedHelpers.findClass("com.tencent.mm.wallet_core.ui.formview.WalletFormView", classLoader), "uZy").get(localObject2), "setText", new Object[]{localObject1}); 80 | XposedHelpers.callStaticMethod(XposedHelpers.findClass("com.tencent.mm.plugin.collect.ui.CollectCreateQRCodeUI", classLoader), "a", new Object[]{paramAnonymousMethodHookParam.thisObject, mark}); 81 | XposedHelpers.callStaticMethod(XposedHelpers.findClass("com.tencent.mm.plugin.collect.ui.CollectCreateQRCodeUI", classLoader), "c", new Object[]{paramAnonymousMethodHookParam.thisObject}); 82 | ((Button) XposedHelpers.callMethod(paramAnonymousMethodHookParam.thisObject, "findViewById", new Object[]{Integer.valueOf(2131756838)})).performClick(); 83 | } 84 | while (!PayHelperUtils.getVerName(context).equals("6.6.6")) { 85 | return; 86 | } 87 | Object localObject1 = ((Activity) paramAnonymousMethodHookParam.thisObject).getIntent(); 88 | String str = ((Intent) localObject1).getStringExtra("mark"); 89 | localObject1 = ((Intent) localObject1).getStringExtra("money"); 90 | Object localObject2 = XposedHelpers.findField(paramAnonymousMethodHookParam.thisObject.getClass(), "loz").get(paramAnonymousMethodHookParam.thisObject); 91 | XposedHelpers.callMethod(XposedHelpers.findField(XposedHelpers.findClass("com.tencent.mm.wallet_core.ui.formview.WalletFormView", classLoader), "Aef").get(localObject2), "setText", new Object[]{localObject1}); 92 | localObject1 = XposedHelpers.findClass("com.tencent.mm.plugin.collect.ui.CollectCreateQRCodeUI", classLoader); 93 | XposedHelpers.callStaticMethod((Class) localObject1, "a", new Object[]{paramAnonymousMethodHookParam.thisObject, str}); 94 | XposedHelpers.callStaticMethod((Class) localObject1, "c", new Object[]{paramAnonymousMethodHookParam.thisObject}); 95 | ((Button) XposedHelpers.callMethod(paramAnonymousMethodHookParam.thisObject, "findViewById", new Object[]{Integer.valueOf(2131756780)})).performClick(); 96 | } 97 | 98 | protected void beforeHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam) 99 | throws Throwable { 100 | } 101 | }}); 102 | return; 103 | } catch (Exception paramClassLoader) { 104 | } 105 | } catch (Exception localException) { 106 | } 107 | 108 | // final ClassLoader classLoader = loadPackageParam.classLoader; 109 | // Object[] arrayOfObject2 = new Object[1]; 110 | // arrayOfObject2[0] = new XC_MethodHook() { 111 | // protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam) { 112 | // Activity ctx = (Activity) methodHookParam.thisObject; 113 | // try { 114 | // 115 | // Intent localIntent2 = (ctx).getIntent(); 116 | // String str3 = localIntent2.getStringExtra("mark"); 117 | // String str4 = localIntent2.getStringExtra("money"); 118 | // 119 | // Object localObject3 = XposedHelpers.findField(ctx.getClass(), "hXD").get(methodHookParam.thisObject); 120 | // XposedHelpers.callMethod(XposedHelpers.findField(XposedHelpers.findClass(Constans.WECHAT_WALLET, classLoader), "uZy").get(localObject3), "setText", str4); 121 | // Class localClass2 = XposedHelpers.findClass(Constans.WECHAT_QRCODE, classLoader); 122 | // Object[] arrayOfObject4 = new Object[2]; 123 | // arrayOfObject4[0] = ctx; 124 | // arrayOfObject4[1] = str3; 125 | // XposedHelpers.callStaticMethod(localClass2, "a", arrayOfObject4); 126 | // Object[] arrayOfObject5 = new Object[1]; 127 | // arrayOfObject5[0] = ctx; 128 | // XposedHelpers.callStaticMethod(localClass2, "c", arrayOfObject5); 129 | // Object localObject4 = ctx; 130 | // Object[] arrayOfObject6 = new Object[1]; 131 | // arrayOfObject6[0] = Integer.valueOf(2131756838); 132 | // ((Button) XposedHelpers.callMethod(localObject4, "findViewById", arrayOfObject6)).performClick(); 133 | // 134 | // 135 | // } catch (Exception e) { 136 | // e.printStackTrace(); 137 | // } 138 | // 139 | // } 140 | // 141 | // }; 142 | // XposedHelpers.findAndHookMethod(Constans.WECHAT_QRCODE, loadPackageParam.classLoader, "initView", arrayOfObject2); 143 | // 144 | // 145 | // XposedBridge.hookAllMethods(XposedHelpers.findClass(Constans.WECHAT_QRCODE, classLoader), "d", new XC_MethodHook() { 146 | // @Override 147 | // protected void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable { 148 | // super.afterHookedMethod(methodHookParam); 149 | // Activity ctx = (Activity) methodHookParam.thisObject; 150 | // Object[] args = methodHookParam.args; 151 | // 152 | // 153 | // Object o = args[3]; 154 | // String mark = String.valueOf( XposedHelpers.findField(o.getClass(), "desc").get(o)); 155 | // String pay_url = String.valueOf(XposedHelpers.findField(o.getClass(), "hUK").get(o)); 156 | // String money = String.valueOf(XposedHelpers.findField(o.getClass(), "hUL").get(o)); 157 | // 158 | // String bJg = String.valueOf( XposedHelpers.findField(o.getClass(), "bJg").get(o)); 159 | // XposedBridge.log("starting" + bJg); 160 | // Intent localIntent2 = new Intent(); 161 | // localIntent2.putExtra(Constans.MONEY, money); 162 | // localIntent2.putExtra(Constans.MARK, mark); 163 | // localIntent2.putExtra(Constans.TYPE, Constans.WECHAT); 164 | // localIntent2.putExtra(Constans.PAY_URL, pay_url); 165 | // localIntent2.setAction(Constans.QRCODE_RESULT); 166 | // ctx.sendBroadcast(localIntent2); 167 | // 168 | // } 169 | // }); 170 | 171 | 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/hook/WechatPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.hook; 2 | 3 | import android.app.Activity; 4 | import android.app.ActivityManager; 5 | import android.app.Application; 6 | import android.content.BroadcastReceiver; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.content.IntentFilter; 10 | import android.widget.Toast; 11 | 12 | import cn.sanlicun.pay.Constans; 13 | import de.robv.android.xposed.XC_MethodHook; 14 | import de.robv.android.xposed.XposedHelpers; 15 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 16 | 17 | import static cn.sanlicun.pay.Constans.ACTION_LAUNCH_WECHAT_WALLET; 18 | 19 | /** 20 | * Created by 小饭 on 2018/7/6. 21 | */ 22 | 23 | public class WechatPlugin implements IPlugin { 24 | public int wechat = 0; 25 | 26 | @Override 27 | public void load(final XC_LoadPackage.LoadPackageParam loadPackageParam) { 28 | 29 | final ClassLoader classLoader = loadPackageParam.classLoader; 30 | 31 | if (loadPackageParam.packageName.contains(Constans.WECHAT_PACKAGE)) { 32 | 33 | XposedHelpers.findAndHookMethod(Application.class, "onCreate", new XC_MethodHook() { 34 | @Override 35 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 36 | 37 | Context ctx = (Context) param.thisObject; 38 | 39 | Toast.makeText(ctx, "receive action:1 " + getProcessName((Context) param.thisObject) + ":" + wechat, Toast.LENGTH_LONG).show(); 40 | 41 | 42 | if (Constans.WECHAT_PACKAGE.equals(getProcessName((Context) param.thisObject)) && (wechat < 1)) { 43 | 44 | wechat++; 45 | registerLaunchReceiver((Context) param.thisObject, loadPackageParam.classLoader); 46 | new WechatPayeePlugin().load(loadPackageParam,ctx); 47 | new WechatBillPlugin().load(loadPackageParam,ctx); 48 | } 49 | } 50 | }); 51 | 52 | 53 | XposedHelpers.findAndHookMethod(Activity.class, "onDestroy", new XC_MethodHook() { 54 | @Override 55 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 56 | final Activity activity = (Activity) param.thisObject; 57 | String name = activity.getClass().getName(); 58 | 59 | } 60 | }); 61 | 62 | 63 | 64 | } 65 | 66 | 67 | } 68 | 69 | 70 | public String getProcessName(Context context) { 71 | int pid = android.os.Process.myPid(); 72 | ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); 73 | for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) { 74 | if (processInfo.pid == pid) { 75 | return processInfo.processName; 76 | } 77 | } 78 | return null; 79 | } 80 | 81 | 82 | private void registerLaunchReceiver(Context context, final ClassLoader classLoader) { 83 | 84 | 85 | IntentFilter intentFilter = new IntentFilter(ACTION_LAUNCH_WECHAT_WALLET); 86 | 87 | 88 | BroadcastReceiver receiver = new BroadcastReceiver() { 89 | @Override 90 | public void onReceive(Context context, Intent intent) { 91 | 92 | 93 | final Class walletActivityClass = XposedHelpers.findClass(Constans.WECHAT_QRCODE, classLoader); 94 | launchWallet(context, walletActivityClass, intent.getStringExtra(Constans.MARK), intent.getStringExtra(Constans.MONEY)); 95 | } 96 | }; 97 | 98 | context.registerReceiver(receiver, intentFilter); 99 | 100 | 101 | } 102 | 103 | private void launchWallet(Context context, Class walletActivityClass, String mark, String money) { 104 | 105 | 106 | Intent localIntent = new Intent(context, walletActivityClass); 107 | localIntent.putExtra(Constans.MARK, mark); 108 | localIntent.putExtra(Constans.MONEY, money); 109 | localIntent.addFlags(268435456); 110 | context.startActivity(localIntent); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/model/BaseModel.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.model; 2 | 3 | import android.util.Base64; 4 | 5 | import com.alibaba.fastjson.JSONObject; 6 | 7 | import java.io.Serializable; 8 | import java.io.UnsupportedEncodingException; 9 | import java.net.URLDecoder; 10 | 11 | /** 12 | * Created by 小饭 on 2018/7/6. 13 | */ 14 | 15 | public class BaseModel implements Serializable{ 16 | private int status = 0; 17 | private String msg = ""; 18 | private String data; 19 | 20 | public int getStatus() { 21 | return status; 22 | } 23 | 24 | public void setStatus(int status) { 25 | this.status = status; 26 | } 27 | 28 | public String getMsg() { 29 | return msg; 30 | } 31 | 32 | public void setMsg(String msg) { 33 | this.msg = msg; 34 | } 35 | 36 | public Object getData(Class clazz) { 37 | 38 | try { 39 | String encode = URLDecoder.decode(data, "utf-8"); 40 | 41 | 42 | String decode = new String(Base64.decode(encode, Base64.DEFAULT), "utf-8"); 43 | if (decode.startsWith("[")) { 44 | return JSONObject.parseArray(decode.substring(0,decode.lastIndexOf("]")+1), clazz); 45 | } else { 46 | return JSONObject.parseObject(decode.substring(0,decode.lastIndexOf("}")+1), clazz); 47 | } 48 | 49 | } catch (UnsupportedEncodingException e) { 50 | e.printStackTrace(); 51 | } 52 | 53 | 54 | return data; 55 | } 56 | 57 | public void setData(String data) { 58 | this.data = data; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/model/QrRetModel.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.model; 2 | 3 | /** 4 | * Created by 小饭 on 2018/7/6. 5 | */ 6 | 7 | public class QrRetModel extends BaseModel { 8 | 9 | private String money; 10 | private String mark; 11 | private String type; 12 | private String payUrl; 13 | 14 | public String getMoney() { 15 | return money; 16 | } 17 | 18 | public void setMoney(String money) { 19 | this.money = money; 20 | } 21 | 22 | public String getMark() { 23 | return mark; 24 | } 25 | 26 | public void setMark(String mark) { 27 | this.mark = mark; 28 | } 29 | 30 | public String getType() { 31 | return type; 32 | } 33 | 34 | public void setType(String type) { 35 | this.type = type; 36 | } 37 | 38 | public String getPayUrl() { 39 | return payUrl; 40 | } 41 | 42 | public void setPayUrl(String payUrl) { 43 | this.payUrl = payUrl; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/net/Api.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.net; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | /** 7 | * Created by 小饭 on 2018/7/4. 8 | */ 9 | 10 | public class Api extends BaseApi { 11 | 12 | /** 13 | * 上传url 14 | * @param context 15 | * @param param 16 | * @param clazz 17 | * @param TAG 18 | */ 19 | public static void PUSH_URL(Context context, Object param, final Class clazz, final int TAG) { 20 | // send(context, "/pay/api/5b29d566d2414", param, clazz, TAG); 21 | } 22 | 23 | 24 | 25 | /** 26 | * 上传支付结果 27 | * @param context 28 | * @param param 29 | * @param clazz 30 | * @param TAG 31 | */ 32 | public static void PUSH_ORDER_RESULT(Context context, Object param, final Class clazz, final int TAG) { 33 | Log.i("tag","send_result"); 34 | send(context, "/pay/notify/Index/notify", param, clazz, TAG); 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/net/BaseApi.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.net; 2 | 3 | import android.content.Context; 4 | import android.util.Base64; 5 | import android.util.Log; 6 | 7 | import com.alibaba.fastjson.JSONObject; 8 | import com.android.volley.Request; 9 | import com.android.volley.RequestQueue; 10 | import com.android.volley.Response; 11 | import com.android.volley.VolleyError; 12 | import com.android.volley.toolbox.StringRequest; 13 | import com.android.volley.toolbox.Volley; 14 | 15 | import java.io.UnsupportedEncodingException; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | import cn.sanlicun.pay.util.PayHelperUtils; 20 | 21 | 22 | /** 23 | * Created by 小饭 on 2018/7/4. 24 | */ 25 | 26 | public class BaseApi { 27 | 28 | 29 | private static final String TAG = "tag"; 30 | private static int index=0; 31 | 32 | public static void send(final Context context, String url, final Object param, final Class clazz, final int TAG) { 33 | 34 | 35 | if (!url.startsWith("http")) { 36 | url = "http://sanlicun.cn/" + url; 37 | } 38 | Log.d("tag", url); 39 | 40 | 41 | final RequestQueue requestQueue = Volley.newRequestQueue(context); 42 | 43 | 44 | final String finalUrl = url; 45 | StringRequest stringRequest = new StringRequest(Request.Method.POST, url, 46 | new Response.Listener() { 47 | @Override 48 | public void onResponse(String response) { 49 | Log.i("tag", "onResponse:" + response); 50 | if (response.equals("success")) { 51 | index=0; 52 | return; 53 | } 54 | 55 | if(index<3){ 56 | PayHelperUtils.sendmsg(context,"发送结果失败"); 57 | index++; 58 | send(context, finalUrl, param, clazz, TAG); 59 | } 60 | 61 | 62 | 63 | } 64 | }, new Response.ErrorListener() { 65 | @Override 66 | public void onErrorResponse(VolleyError error) { 67 | 68 | if(index<3){ 69 | PayHelperUtils.sendmsg(context,"发送结果失败"); 70 | index++; 71 | send(context, finalUrl, param, clazz, TAG); 72 | } 73 | 74 | 75 | } 76 | }) { 77 | @Override 78 | protected Map getParams() { 79 | //在这里设置需要post的参数 80 | Map map = new HashMap(); 81 | 82 | try { 83 | String p = new String(Base64.encode(JSONObject.toJSONString(param).getBytes(), Base64.DEFAULT), "utf-8"); 84 | Log.d("tag", p); 85 | 86 | map.put("param", p); 87 | } catch (UnsupportedEncodingException e) { 88 | e.printStackTrace(); 89 | } 90 | 91 | 92 | return map; 93 | } 94 | }; 95 | 96 | requestQueue.add(stringRequest); 97 | 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/net/INet.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.net; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Created by 小饭 on 2018/7/4. 7 | */ 8 | 9 | public interface INet { 10 | void fetch(int TAG); 11 | void response(int TAG, Object o); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/param/PushParam.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.param; 2 | 3 | /** 4 | * Created by 小饭 on 2018/7/6. 5 | */ 6 | 7 | public class PushParam { 8 | private Integer id; 9 | private String message; 10 | private String mark; 11 | private String pay_url; 12 | private String money; 13 | private String type; 14 | private String billNo; 15 | private String time; 16 | private int state;//1.已付款 2.未付款 17 | private String account; 18 | 19 | public String getAccount() { 20 | return account; 21 | } 22 | 23 | public void setAccount(String account) { 24 | this.account = account; 25 | } 26 | 27 | public Integer getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Integer id) { 32 | this.id = id; 33 | } 34 | 35 | 36 | 37 | public String getBillNo() { 38 | return billNo; 39 | } 40 | 41 | public void setBillNo(String billNo) { 42 | this.billNo = billNo; 43 | } 44 | 45 | public String getType() { 46 | return type; 47 | } 48 | 49 | public void setType(String type) { 50 | this.type = type; 51 | } 52 | 53 | public String getMark() { 54 | return mark; 55 | } 56 | 57 | public void setMark(String mark) { 58 | this.mark = mark; 59 | } 60 | 61 | public String getPay_url() { 62 | return pay_url; 63 | } 64 | 65 | public void setPay_url(String pay_url) { 66 | this.pay_url = pay_url; 67 | } 68 | 69 | public String getMoney() { 70 | return money; 71 | } 72 | 73 | public void setMoney(String money) { 74 | this.money = money; 75 | } 76 | 77 | public String getTime() { 78 | return time; 79 | } 80 | 81 | public void setTime(String time) { 82 | this.time = time; 83 | } 84 | 85 | public int getState() { 86 | return state; 87 | } 88 | 89 | public String getMessage() { 90 | return message; 91 | } 92 | 93 | public void setMessage(String message) { 94 | this.message = message; 95 | } 96 | 97 | public void setState(int state) { 98 | this.state = state; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/receiver/BillResultReceiver.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.receiver; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.util.Log; 7 | 8 | import com.lidroid.xutils.HttpUtils; 9 | import com.lidroid.xutils.exception.HttpException; 10 | import com.lidroid.xutils.http.RequestParams; 11 | import com.lidroid.xutils.http.ResponseInfo; 12 | import com.lidroid.xutils.http.callback.RequestCallBack; 13 | import com.lidroid.xutils.http.client.HttpRequest; 14 | 15 | import org.jsoup.Jsoup; 16 | import org.jsoup.select.Elements; 17 | 18 | import cn.sanlicun.pay.param.PushParam; 19 | import cn.sanlicun.pay.sqlite.DBManager; 20 | import cn.sanlicun.pay.util.PayHelperUtils; 21 | 22 | public class BillResultReceiver extends BroadcastReceiver { 23 | 24 | @Override 25 | public void onReceive(final Context context, Intent intent) { 26 | // Log.i("tag", "BillResultReceiver"); 27 | // String money = intent.getStringExtra(Constans.BILL_MONEY); 28 | // String mark = intent.getStringExtra(Constans.BILL_MARK); 29 | // String type = intent.getStringExtra(Constans.BILL_TYPE); 30 | // String billNo = intent.getStringExtra(Constans.BILL_NO); 31 | // PushParam pushParam = new PushParam(); 32 | // pushParam.setMark(mark); 33 | // pushParam.setMoney(money); 34 | // pushParam.setBillNo(billNo); 35 | // pushParam.setType(type); 36 | // Log.i("tag", "BillResultReceiver: mark:"+mark+"money:"+money+"billno:"+no+"type:"+type); 37 | 38 | final String tradeno = intent.getStringExtra("tradeno"); 39 | String cookie = intent.getStringExtra("cookie"); 40 | String url = "https://tradeeportlet.alipay.com/wireless/tradeDetail.htm?tradeNo=" + tradeno + "&source=channel&_from_url=https%3A%2F%2Frender.alipay.com%2Fp%2Fz%2Fmerchant-mgnt%2Fsimple-order._h_t_m_l_%3Fsource%3Dmdb_card"; 41 | HttpUtils localHttpUtils = new HttpUtils(15000); 42 | localHttpUtils.configResponseTextCharset("GBK"); 43 | RequestParams localRequestParams = new RequestParams(); 44 | localRequestParams.addHeader("Cookie", cookie); 45 | localHttpUtils.send(HttpRequest.HttpMethod.GET, url, localRequestParams, new RequestCallBack() { 46 | @Override 47 | public void onSuccess(ResponseInfo responseInfo) { 48 | Log.i("tag", "onMessageEvent:" + responseInfo.result); 49 | Object localObject = Jsoup.parse((String) responseInfo.result).getElementsByClass("trade-info-value"); 50 | if (((Elements) localObject).size() >= 5) { 51 | String paramAnonymousResponseInfo = ((Elements) localObject).get(0).ownText(); 52 | String xx = ((Elements) localObject).get(1).ownText(); 53 | String xxx = ((Elements) localObject).get(2).ownText(); 54 | localObject = ((Elements) localObject).get(3).ownText(); 55 | PayHelperUtils.sendmsg(context,"付款成功alipay:订单号:"+ tradeno + "金额:" + paramAnonymousResponseInfo + "备注:" + (String) localObject); 56 | Log.i("tag", "收到支付宝订单,订单号:" + tradeno + "金额:" + paramAnonymousResponseInfo + "备注:" + (String) localObject+"xx:"+xx+"xxx:"+xxx); 57 | PushParam pushParam = new PushParam(); 58 | pushParam.setMark((String) localObject); 59 | pushParam.setMoney(paramAnonymousResponseInfo); 60 | pushParam.setBillNo(tradeno); 61 | pushParam.setType("alipay"); 62 | pushParam.setState(1); 63 | DBManager dbManager=new DBManager(context); 64 | dbManager.updatePay(pushParam); 65 | // Api.PUSH_ORDER_RESULT(context, pushParam, String.class, 1); 66 | } 67 | 68 | } 69 | 70 | @Override 71 | public void onFailure(HttpException error, String msg) { 72 | Log.i("tag", "服务器异常1"); 73 | } 74 | }); 75 | 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/receiver/QrCodeReceiver.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.receiver; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.util.Log; 7 | 8 | import cn.sanlicun.pay.Constans; 9 | import cn.sanlicun.pay.param.PushParam; 10 | import cn.sanlicun.pay.sqlite.DBManager; 11 | 12 | public class QrCodeReceiver extends BroadcastReceiver { 13 | 14 | @Override 15 | public void onReceive(Context context, Intent intent) { 16 | 17 | String money = intent.getStringExtra(Constans.MONEY); 18 | String mark = intent.getStringExtra(Constans.MARK); 19 | String type = intent.getStringExtra(Constans.TYPE); 20 | String payUrl = intent.getStringExtra(Constans.PAY_URL); 21 | if(mark.contains("test")) return; 22 | PushParam pushParam = new PushParam(); 23 | pushParam.setMark(mark); 24 | pushParam.setMoney(money); 25 | pushParam.setPay_url(payUrl); 26 | pushParam.setType(type); 27 | pushParam.setState(0); 28 | Log.i("tag", "pay: "+payUrl); 29 | 30 | DBManager dbManager=new DBManager(context); 31 | dbManager.addPay(pushParam); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/sqlite/DBHelper.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.sqlite; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | /** 8 | * =========================================== 9 | * 作者 :曾立强 3042938728@qq.com 10 | * 时间 :2018/2/6 11 | * 描述 : 12 | * ============================================ 13 | */ 14 | 15 | public class DBHelper extends SQLiteOpenHelper { 16 | private static final String DATABASE_NAME = "sign.db"; 17 | private static final int DATABASE_VERSION = 1; 18 | 19 | public DBHelper(Context context) { 20 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 21 | } 22 | 23 | 24 | 25 | 26 | 27 | @Override 28 | public void onCreate(SQLiteDatabase db) { 29 | db.execSQL("CREATE TABLE IF NOT EXISTS pay" + 30 | "(_id INTEGER PRIMARY KEY AUTOINCREMENT,pay_url VARCHAR,mark VARCHAR,money VARCHAR,type VARCHAR,billNo VARCHAR,time VARCHAR,state INTEGER)"); 31 | } 32 | 33 | @Override 34 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/sqlite/DBManager.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.sqlite; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Context; 5 | import android.database.Cursor; 6 | import android.database.sqlite.SQLiteDatabase; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | import cn.sanlicun.pay.param.PushParam; 12 | 13 | /** 14 | * =========================================== 15 | * 作者 :曾立强 3042938728@qq.com 16 | * 时间 :2018/2/6 17 | * 描述 : 18 | * ============================================ 19 | */ 20 | 21 | public class DBManager { 22 | private DBHelper helper; 23 | private SQLiteDatabase db; 24 | 25 | public DBManager(Context context) { 26 | helper = new DBHelper(context); 27 | db = helper.getWritableDatabase(); 28 | } 29 | 30 | // "(_id INTEGER PRIMARY KEY AUTOINCREMENT,pay_url VARCHAR,mark VARCHAR,money VARCHAR,type VARCHAR,billNo VARCHAR,time VARCHAR)"); 31 | 32 | public void addPay(PushParam bean) { 33 | db.beginTransaction(); //开始事务 34 | try { 35 | 36 | db.execSQL("INSERT INTO pay VALUES(null,?,?,?,?,?,?,?)", new Object[]{bean.getPay_url(), bean.getMark(), bean.getMoney(), bean.getType(), bean.getBillNo(), bean.getTime(),bean.getState()}); 37 | db.setTransactionSuccessful(); //设置事务成功完成 38 | } finally { 39 | db.endTransaction(); //结束事务 40 | } 41 | } 42 | 43 | 44 | public void updatePay(PushParam bean) { 45 | ContentValues cv = new ContentValues(); 46 | cv.put("pay_url", bean.getPay_url()); 47 | cv.put("mark", bean.getMark()); 48 | cv.put("type", bean.getType()); 49 | cv.put("billNo", bean.getBillNo()); 50 | cv.put("time", bean.getTime()); 51 | cv.put("state",bean.getState()); 52 | db.update("pay", cv, "pay_url = ?", new String[]{String.valueOf(bean.getPay_url())}); 53 | } 54 | 55 | public void deletePay(PushParam bean) { 56 | db.delete("pay", "_id = ?", new String[]{String.valueOf(bean.getId())}); 57 | } 58 | 59 | /** 60 | * "(_id INTEGER PRIMARY KEY AUTOINCREMENT,pay_url VARCHAR, 61 | * mark VARCHAR, 62 | * money VARCHAR, 63 | * type VARCHAR, 64 | * billNo VARCHAR, 65 | * time VARCHAR)"); 66 | */ 67 | 68 | public List queryPay(String mark,String money){ 69 | List pushBeens = new ArrayList<>(); 70 | Cursor c = db.rawQuery("SELECT * FROM pay where mark= ? and money= ? ", new String[]{mark, money}); 71 | while (c.moveToNext()) { 72 | PushParam bean = new PushParam(); 73 | bean.setId(c.getInt(c.getColumnIndex("_id"))); 74 | bean.setPay_url(c.getString(c.getColumnIndex("pay_url"))); 75 | bean.setMark(c.getString(c.getColumnIndex("mark"))); 76 | bean.setMoney(c.getString(c.getColumnIndex("money"))); 77 | bean.setType(c.getString(c.getColumnIndex("type"))); 78 | bean.setTime(c.getString(c.getColumnIndex("time"))); 79 | bean.setBillNo(c.getString(c.getColumnIndex("billNo"))); 80 | bean.setState(c.getInt(c.getColumnIndex("state"))); 81 | pushBeens.add(bean); 82 | } 83 | c.close(); 84 | return pushBeens; 85 | 86 | } 87 | 88 | 89 | public void closeDB() { 90 | db.close(); 91 | } 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/util/LogUtils.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.util; 2 | import android.util.Log; 3 | 4 | 5 | public class LogUtils { 6 | public static final int LEVEL_NONE = 0; 7 | public static final int LEVEL_ERROR =1; 8 | public static final int LEVEL_WARN = 2; 9 | public static final int LEVEL_INFO = 3; 10 | public static final int LEVEL_DEBUG = 4; 11 | public static final int LEVEL_VERBOSE = 5; 12 | private static String mTag = "LogUtils"; 13 | private static int mDebuggable = LEVEL_VERBOSE; 14 | public static void v(String msg) { 15 | if (mDebuggable >= LEVEL_VERBOSE) { 16 | Log.v(mTag, msg); 17 | } 18 | } 19 | 20 | public static void d(String msg) { 21 | if (mDebuggable >= LEVEL_DEBUG) { 22 | Log.d(mTag, msg); 23 | } 24 | } 25 | 26 | public static void i(String msg) { 27 | if (mDebuggable >= LEVEL_INFO) { 28 | Log.i(mTag, msg); 29 | } 30 | } 31 | 32 | public static void w(String msg) { 33 | if (mDebuggable >= LEVEL_WARN) { 34 | Log.w(mTag, msg); 35 | } 36 | } 37 | 38 | public static void w(Throwable tr) { 39 | if (mDebuggable >= LEVEL_WARN) { 40 | Log.w(mTag, "", tr); 41 | } 42 | } 43 | public static void w(String msg, Throwable tr) { 44 | if (mDebuggable >= LEVEL_WARN && null != msg) { 45 | Log.w(mTag, msg, tr); 46 | } 47 | } 48 | 49 | public static void e(String msg) { 50 | if (mDebuggable >= LEVEL_ERROR) { 51 | Log.e(mTag, msg); 52 | } 53 | } 54 | 55 | public static void e(Throwable tr) { 56 | if (mDebuggable >= LEVEL_ERROR) { 57 | Log.e(mTag, "", tr); 58 | } 59 | } 60 | 61 | public static void e(String msg, Throwable tr) { 62 | if (mDebuggable >= LEVEL_ERROR && null != msg) { 63 | Log.e(mTag, msg, tr); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/util/PayHelperUtils.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.util; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.pm.PackageManager; 6 | import android.util.Log; 7 | 8 | import com.lidroid.xutils.HttpUtils; 9 | import com.lidroid.xutils.exception.HttpException; 10 | import com.lidroid.xutils.http.RequestParams; 11 | import com.lidroid.xutils.http.ResponseInfo; 12 | import com.lidroid.xutils.http.callback.RequestCallBack; 13 | import com.lidroid.xutils.http.client.HttpRequest; 14 | 15 | import org.json.JSONArray; 16 | import org.json.JSONObject; 17 | 18 | import java.text.SimpleDateFormat; 19 | import java.util.Date; 20 | 21 | import cn.sanlicun.pay.Constans; 22 | import de.robv.android.xposed.XposedHelpers; 23 | 24 | /** 25 | * =========================================== 26 | * 作者 :曾立强 3042938728@qq.com 27 | * 时间 :2018/8/8 28 | * 描述 : 29 | * ============================================ 30 | */ 31 | 32 | public class PayHelperUtils { 33 | 34 | public static String getCookieStr(ClassLoader paramClassLoader) { 35 | XposedHelpers.callStaticMethod(XposedHelpers.findClass("com.alipay.mobile.common.transportext.biz.appevent.AmnetUserInfo", paramClassLoader), "getSessionid", new Object[0]); 36 | Context localContext = (Context) XposedHelpers.callStaticMethod(XposedHelpers.findClass("com.alipay.mobile.common.transportext.biz.shared.ExtTransportEnv", paramClassLoader), "getAppContext", new Object[0]); 37 | if (localContext != null) { 38 | if (XposedHelpers.callStaticMethod(XposedHelpers.findClass("com.alipay.mobile.common.helper.ReadSettingServerUrl", paramClassLoader), "getInstance", new Object[0]) != null) { 39 | return (String) XposedHelpers.callStaticMethod(XposedHelpers.findClass("com.alipay.mobile.common.transport.http.GwCookieCacheHelper", paramClassLoader), "getCookie", new Object[]{".alipay.com"}); 40 | } 41 | Log.i("tag", "异常readSettingServerUrl为空"); 42 | return ""; 43 | } 44 | Log.i("tag", "异常context为空"); 45 | return ""; 46 | } 47 | 48 | public static void getTradeInfo(final Context paramContext, final String paramString) { 49 | Log.i("tag", "getTradeInfo:1 "); 50 | long l = System.currentTimeMillis(); 51 | String str1 = getCurrentDate(); 52 | String str2 = "https://mbillexprod.alipay.com/enterprise/simpleTradeOrderQuery.json?beginTime=" + (l - 864000000L) + "&limitTime=" + l + "&pageSize=20&pageNum=1&channelType=ALL"; 53 | HttpUtils localHttpUtils = new HttpUtils(15000); 54 | localHttpUtils.configResponseTextCharset("GBK"); 55 | RequestParams localRequestParams = new RequestParams(); 56 | localRequestParams.addHeader("Cookie", paramString); 57 | localRequestParams.addHeader("Referer", "https://render.alipay.com/p/z/merchant-mgnt/simple-order.html?beginTime=" + str1 + "&endTime=" + str1 + "&fromBill=true&channelType=ALL"); 58 | localHttpUtils.send(HttpRequest.HttpMethod.GET, str2, localRequestParams, new RequestCallBack() { 59 | public void onFailure(HttpException paramAnonymousHttpException, String paramAnonymousString) { 60 | // PayHelperUtils.sendmsg(PayHelperUtils.this, "服务器异常" + paramAnonymousString); 61 | Log.i("tag", "服务器异常"); 62 | } 63 | 64 | public void onSuccess(ResponseInfo paramAnonymousResponseInfo) { 65 | String result = (String) paramAnonymousResponseInfo.result; 66 | try { 67 | Log.i("tag", "getTradeInfo2" + result); 68 | JSONArray array = new JSONObject(result).getJSONObject("result").getJSONArray("list"); 69 | if ((array != null) && (array.length() > 0)) { 70 | String json = array.getJSONObject(0).getString("tradeNo"); 71 | Log.i("tag", "getTradeInfo3" + json); 72 | Intent localIntent = new Intent(); 73 | localIntent.putExtra("tradeno", json); 74 | localIntent.putExtra("cookie", paramString); 75 | localIntent.setAction(Constans.ACTION_PAY_SUCCESS); 76 | paramContext.sendBroadcast(localIntent); 77 | // EventBus.getDefault().post(new MessageEvent(MessageEvent.MessageType.TRADENORECEIVED_ACTION,json,paramString)); 78 | } 79 | return; 80 | } catch (Exception p) { 81 | // PayHelperUtils.sendmsg(PayHelperUtils.this, "getTradeInfo异常" + paramAnonymousResponseInfo.getMessage()); 82 | Log.i("tag", "getTradeInfo异常" + p.getMessage()); 83 | } 84 | } 85 | }); 86 | } 87 | 88 | public static String getCurrentDate() { 89 | Date localDate = new Date(System.currentTimeMillis()); 90 | return new SimpleDateFormat("yyyy-MM-dd").format(localDate); 91 | } 92 | 93 | public static void getPay(String money, String mark, String type, Context context) { 94 | Intent intent = new Intent(); 95 | if (type.equals("alipay")) { 96 | intent.setAction(Constans.ACTION_LAUNCH_ALIPAY_WALLET); 97 | intent.putExtra(Constans.MARK, mark); 98 | intent.putExtra(Constans.MONEY, money); 99 | } 100 | context.sendBroadcast(intent); 101 | 102 | 103 | } 104 | public static String getVerName(Context paramContext) 105 | { 106 | try 107 | { 108 | String str = paramContext.getPackageManager().getPackageInfo(paramContext.getPackageName(), 0).versionName; 109 | return str; 110 | } 111 | catch (PackageManager.NameNotFoundException localNameNotFoundException) 112 | { 113 | // sendmsg(paramContext, "getVerName异常" + localNameNotFoundException.getMessage()); 114 | } 115 | return ""; 116 | } 117 | 118 | public static void sendmsg(Context paramContext, String paramString) 119 | { 120 | Log.i("tag", "sendmsg: "+paramString); 121 | Intent localIntent = new Intent(); 122 | localIntent.putExtra("msg", paramString); 123 | localIntent.setAction(Constans.MESSAGE_RECEIVED_ACTION); 124 | paramContext.sendBroadcast(localIntent); 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/util/PreUtils.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.util; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.util.Base64; 6 | 7 | import org.json.JSONArray; 8 | import org.json.JSONException; 9 | import org.json.JSONObject; 10 | import org.json.JSONStringer; 11 | import org.json.JSONTokener; 12 | 13 | import java.io.ByteArrayInputStream; 14 | import java.io.ByteArrayOutputStream; 15 | import java.io.IOException; 16 | import java.io.ObjectInputStream; 17 | import java.io.ObjectOutputStream; 18 | import java.io.Serializable; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | import cn.sanlicun.pay.App; 23 | 24 | /** 25 | * Created by Administrator on 2017/6/21. 26 | */ 27 | public class PreUtils { 28 | public static Context ctx; 29 | 30 | 31 | public static final String PRE_SPACE_BEAN = "bean";//对象存储空间 32 | public static final String PRE_ASYN = "asyn";//架构 33 | public static final String PRE_SYNC="sync"; 34 | public static final String PRE_SIGN="sign"; 35 | public static final String PRE_ACCOUNT="account"; 36 | 37 | private static SharedPreferences sp;// 单例 38 | private static PreUtils instance;// 单例 39 | public PreUtils() { 40 | ctx = App.getCtx(); 41 | sp = ctx.getSharedPreferences(PRE_SPACE_BEAN, 42 | Context.MODE_PRIVATE); 43 | } 44 | 45 | public static synchronized void init() { 46 | if (instance == null) { 47 | instance = new PreUtils(); 48 | } 49 | } 50 | 51 | public static PreUtils getInstance() { 52 | if (instance == null) { 53 | throw new RuntimeException("class should init!"); 54 | } 55 | return instance; 56 | } 57 | 58 | /* 59 | * 存取对象 60 | * */ 61 | 62 | public static void SaveBean(String key, Object obj) { 63 | if (obj instanceof Serializable) {// obj必须实现Serializable接口,否则会出问题 64 | try { 65 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 66 | ObjectOutputStream oos = new ObjectOutputStream(baos); 67 | oos.writeObject(obj); 68 | String string64 = new String(Base64.encode(baos.toByteArray(), 69 | 0)); 70 | SharedPreferences.Editor editor = sp.edit(); 71 | editor.putString(key, string64).commit(); 72 | } catch (IOException e) { 73 | e.printStackTrace(); 74 | } 75 | 76 | } else { 77 | throw new IllegalArgumentException( 78 | "the obj must implement Serializble"); 79 | } 80 | 81 | } 82 | 83 | 84 | public static Object getBean(String key) { 85 | Object obj = null; 86 | try { 87 | String base64 = sp.getString(key, ""); 88 | if (base64.equals("")) { 89 | return null; 90 | } 91 | byte[] base64Bytes = Base64.decode(base64.getBytes(), 1); 92 | ByteArrayInputStream bais = new ByteArrayInputStream(base64Bytes); 93 | ObjectInputStream ois = new ObjectInputStream(bais); 94 | obj = ois.readObject(); 95 | } catch (Exception e) { 96 | e.printStackTrace(); 97 | } 98 | return obj; 99 | } 100 | 101 | 102 | public static void setInt(String key, int value) { 103 | sp.edit().putInt(key, value).commit(); 104 | } 105 | 106 | public static int getInt(String key, int defValue) { 107 | return sp.getInt(key, defValue); 108 | } 109 | 110 | 111 | public static void setString(String key, String value) { 112 | sp.edit().putString(key, value).commit(); 113 | } 114 | 115 | public static String getString(String key, String defValue) { 116 | return sp.getString(key, defValue); 117 | } 118 | 119 | public static void setBoolean(String key, Boolean bool) { 120 | sp.edit().putBoolean(key, bool).commit(); 121 | } 122 | 123 | 124 | public static Boolean getBoolean(String key, Boolean defbool) { 125 | return sp.getBoolean(key, defbool); 126 | } 127 | 128 | 129 | public static Map getMap(String key) { 130 | Map mage2nameMap = new HashMap<>(); 131 | String age2name = sp.getString(key, null); 132 | if (age2name.length() > 0) { 133 | JSONTokener jsonTokener = new JSONTokener(age2name); 134 | try { 135 | JSONArray jsonArray = (JSONArray) jsonTokener.nextValue(); 136 | for (int i = 0; i < jsonArray.length(); i++) { 137 | JSONObject jsonObject = jsonArray.getJSONObject(i); 138 | mage2nameMap.put(jsonObject.getInt("age"), jsonObject.getString("name")); 139 | } 140 | } catch (JSONException e) { 141 | e.printStackTrace(); 142 | } 143 | } 144 | return mage2nameMap; 145 | } 146 | 147 | public static void putMap(String key, Map age2nameMap) { 148 | if (age2nameMap != null) { 149 | JSONStringer jsonStringer = new JSONStringer(); 150 | try { 151 | jsonStringer.array(); 152 | for (Integer integer : age2nameMap.keySet()) { 153 | jsonStringer.object(); 154 | jsonStringer.key("age"); 155 | jsonStringer.value(integer); 156 | jsonStringer.key("name"); 157 | jsonStringer.value(age2nameMap.get(integer)); 158 | jsonStringer.endObject(); 159 | } 160 | jsonStringer.endArray(); 161 | } catch (JSONException e) { 162 | e.printStackTrace(); 163 | } 164 | sp.edit().putString(key, jsonStringer.toString()).commit(); 165 | } 166 | } 167 | 168 | 169 | 170 | 171 | } 172 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/util/StringUtils.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.util; 2 | 3 | /** 4 | * =========================================== 5 | * 作者 :曾立强 3042938728@qq.com 6 | * 时间 :2018/8/7 7 | * 描述 : 8 | * ============================================ 9 | */ 10 | 11 | public class StringUtils { 12 | 13 | public static String getTextCenter(String paramString1, String paramString2, String paramString3) 14 | { 15 | try 16 | { 17 | int i = paramString1.indexOf(paramString2) + paramString2.length(); 18 | paramString1 = paramString1.substring(i, paramString1.indexOf(paramString3, i)); 19 | return paramString1; 20 | } 21 | catch (Exception p) 22 | { 23 | p.printStackTrace(); 24 | } 25 | return "error"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/util/Version.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.util; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageManager; 5 | 6 | /** 7 | * Created by 小饭 on 2018/7/6. 8 | */ 9 | 10 | public class Version { 11 | /** 12 | * 13 | * @param paramContext 14 | * @return 15 | */ 16 | public static String getVersion(Context paramContext) 17 | { 18 | try 19 | { 20 | String str = paramContext.getPackageManager().getPackageInfo(paramContext.getPackageName(), 0).versionName; 21 | return str; 22 | } 23 | catch (PackageManager.NameNotFoundException localNameNotFoundException) 24 | { 25 | 26 | } 27 | return ""; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/web/AndroidLog.java: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | //$Id: AndroidLog.java 391 2011-02-08 01:06:04Z janb.webtide $ 3 | //Copyright 2008 Mort Bay Consulting Pty. Ltd. 4 | //------------------------------------------------------------------------ 5 | //Licensed under the Apache License, Version 2.0 (the "License"); 6 | //you may not use this file except in compliance with the License. 7 | //You may obtain a copy of the License at 8 | //http://www.apache.org/licenses/LICENSE-2.0 9 | //Unless required by applicable law or agreed to in writing, software 10 | //distributed under the License is distributed on an "AS IS" BASIS, 11 | //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | //See the License for the specific language governing permissions and 13 | //limitations under the License. 14 | //======================================================================== 15 | 16 | package cn.sanlicun.pay.web; 17 | 18 | import android.util.Log; 19 | 20 | import org.eclipse.jetty.util.log.Logger; 21 | 22 | public class AndroidLog implements Logger 23 | { 24 | public static final String __JETTY_TAG = "Jetty"; 25 | public static boolean __isIgnoredEnabled = false; 26 | public String _name; 27 | 28 | 29 | 30 | 31 | public AndroidLog() 32 | { 33 | this ("org.mortbay.ijetty.AndroidLog"); 34 | } 35 | 36 | public AndroidLog(String name) 37 | { 38 | _name = name; 39 | } 40 | 41 | public String getName () 42 | { 43 | return _name; 44 | } 45 | 46 | 47 | public void debug(Throwable th) 48 | { 49 | if (Log.isLoggable(__JETTY_TAG, Log.DEBUG)) 50 | { 51 | Log.d(__JETTY_TAG, "", th); 52 | } 53 | } 54 | 55 | public void debug(String msg, Throwable th) 56 | { 57 | if (Log.isLoggable(__JETTY_TAG, Log.DEBUG)) 58 | { 59 | Log.d(__JETTY_TAG, msg, th); 60 | } 61 | } 62 | 63 | public void debug(String msg, Object... args) 64 | { 65 | if (Log.isLoggable(__JETTY_TAG, Log.DEBUG)) 66 | { 67 | Log.d(__JETTY_TAG, msg); 68 | } 69 | } 70 | 71 | public Logger getLogger(String name) 72 | { 73 | return new AndroidLog(name); 74 | } 75 | 76 | public void info(String msg, Object... args) 77 | { 78 | Log.i(__JETTY_TAG, msg); 79 | } 80 | 81 | public void info(Throwable th) 82 | { 83 | Log.i(__JETTY_TAG, "", th); 84 | } 85 | 86 | public void info(String msg, Throwable th) 87 | { 88 | Log.i(__JETTY_TAG, msg, th); 89 | } 90 | 91 | public boolean isDebugEnabled() 92 | { 93 | return Log.isLoggable(__JETTY_TAG, Log.DEBUG); 94 | } 95 | 96 | public void warn(Throwable th) 97 | { 98 | if (Log.isLoggable(__JETTY_TAG, Log.WARN)) 99 | Log.e(__JETTY_TAG, "", th); 100 | } 101 | 102 | public void warn(String msg, Object... args) 103 | { 104 | if (Log.isLoggable(__JETTY_TAG, Log.WARN)) 105 | Log.w(__JETTY_TAG, msg); 106 | } 107 | 108 | public void warn(String msg, Throwable th) 109 | { 110 | if (Log.isLoggable(__JETTY_TAG, Log.ERROR)) 111 | Log.e(__JETTY_TAG, msg, th); 112 | } 113 | 114 | public boolean isIgnoredEnabled () 115 | { 116 | return __isIgnoredEnabled; 117 | } 118 | 119 | 120 | public void ignore(Throwable ignored) 121 | { 122 | if (__isIgnoredEnabled) 123 | Log.w(__JETTY_TAG, "IGNORED", ignored); 124 | } 125 | 126 | public void setIgnoredEnabled(boolean enabled) 127 | { 128 | __isIgnoredEnabled = enabled; 129 | } 130 | 131 | public void setDebugEnabled(boolean enabled) 132 | { 133 | 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/web/DefaultHandler.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.web; 2 | 3 | import org.eclipse.jetty.server.Request; 4 | 5 | import java.io.IOException; 6 | import java.io.OutputStream; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | public class DefaultHandler extends org.eclipse.jetty.server.handler.DefaultHandler { 13 | 14 | 15 | public DefaultHandler() { 16 | 17 | } 18 | 19 | public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) 20 | throws IOException, ServletException { 21 | if (response.isCommitted() || baseRequest.isHandled()) 22 | return; 23 | 24 | baseRequest.setHandled(true); 25 | // String method = request.getMethod();//请求方式 26 | request.getRequestURI();// 请求路径 27 | 28 | System.out.println("URI" + request.getRequestURI()); 29 | System.out.println("URL" + request.getRequestURI()); 30 | response.setStatus(HttpServletResponse.SC_OK); 31 | // response.setContentType(MimeTypes.TEXT_JSON); 32 | String str = "我是返回内容"; 33 | byte[] b = str.getBytes(); 34 | response.setContentLength(b.length); 35 | OutputStream out = response.getOutputStream(); 36 | out.write(b); 37 | out.close(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/web/ServlertConfig.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.web; 2 | 3 | import org.eclipse.jetty.servlet.ServletContextHandler; 4 | import org.eclipse.jetty.servlet.ServletHolder; 5 | 6 | import cn.sanlicun.pay.web.servlet.PayServlet; 7 | 8 | 9 | public class ServlertConfig { 10 | public static void config(ServletContextHandler handler) { 11 | handler.addServlet(new ServletHolder(new PayServlet()), "/getpay"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/web/WebService.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.web; 2 | 3 | import android.app.Notification; 4 | import android.app.Service; 5 | import android.content.Intent; 6 | import android.os.Environment; 7 | import android.os.Handler; 8 | import android.os.IBinder; 9 | import android.widget.Toast; 10 | 11 | import org.eclipse.jetty.server.Server; 12 | import org.eclipse.jetty.servlet.ServletContextHandler; 13 | 14 | import java.io.File; 15 | 16 | public class WebService extends Service { 17 | 18 | private Server server; 19 | 20 | private Handler handler = new Handler(); 21 | 22 | @Override 23 | public IBinder onBind(Intent intent) { 24 | return null; 25 | } 26 | 27 | @Override 28 | public void onStart(Intent intent, int startId) { 29 | super.onStart(intent, startId); 30 | startForeground(9999, new Notification()); 31 | startServer(); 32 | } 33 | 34 | @Override 35 | public void onDestroy() { 36 | stopServer(); 37 | super.onDestroy(); 38 | } 39 | 40 | private void startServer() { 41 | if (server != null) { 42 | Toast.makeText(this, "服务器已经开启", Toast.LENGTH_SHORT).show(); 43 | return; 44 | } 45 | new Thread(new StartRunnable()).start(); 46 | } 47 | 48 | private void stopServer() { 49 | if (server != null) { 50 | new Thread(new StopRunnable()).start(); 51 | } 52 | } 53 | 54 | class StartRunnable implements Runnable { 55 | @Override 56 | public void run() { 57 | try { 58 | File JETTY_DIR = new File( 59 | Environment.getExternalStorageDirectory(), "jetty"); 60 | // Set jetty.home 61 | System.setProperty("jetty.home", JETTY_DIR.getAbsolutePath()); 62 | 63 | // ipv6 workaround for froyo 64 | System.setProperty("java.net.preferIPv6Addresses", "false"); 65 | 66 | server = new Server(8080); 67 | // server.setHandler(new DefaultHandler()); 68 | ServletContextHandler contextHandler = new ServletContextHandler( 69 | ServletContextHandler.SESSIONS); 70 | contextHandler.setContextPath("/"); 71 | server.setHandler(contextHandler); 72 | ServlertConfig.config(contextHandler); 73 | 74 | server.start(); 75 | server.join(); 76 | } catch (Exception e) { 77 | server = null; 78 | toastOnUiThread("服务器启动失败"); 79 | } 80 | } 81 | } 82 | 83 | class StopRunnable implements Runnable { 84 | @Override 85 | public void run() { 86 | try { 87 | server.stop(); 88 | server = null; 89 | toastOnUiThread("服务器关闭"); 90 | } catch (Exception e) { 91 | e.printStackTrace(); 92 | toastOnUiThread("服务器关闭失败"); 93 | } 94 | } 95 | } 96 | 97 | private void toastOnUiThread(final String toast) { 98 | handler.post(new Runnable() { 99 | 100 | @Override 101 | public void run() { 102 | Toast.makeText(WebService.this, toast, 103 | Toast.LENGTH_SHORT).show(); 104 | } 105 | }); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/web/servlet/BaseServlet.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.web.servlet; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | public class BaseServlet extends HttpServlet { 11 | private static final long serialVersionUID = 1L; 12 | 13 | @Override 14 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 15 | this.doGet(req, resp); 16 | } 17 | 18 | @Override 19 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 20 | super.doGet(req, resp); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sanlicun/pay/web/servlet/PayServlet.java: -------------------------------------------------------------------------------- 1 | package cn.sanlicun.pay.web.servlet; 2 | 3 | import android.text.TextUtils; 4 | import android.util.Log; 5 | 6 | import com.alibaba.fastjson.JSON; 7 | 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | import java.util.List; 11 | 12 | import javax.servlet.ServletException; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | 16 | import cn.sanlicun.pay.App; 17 | import cn.sanlicun.pay.param.PushParam; 18 | import cn.sanlicun.pay.sqlite.DBManager; 19 | import cn.sanlicun.pay.util.PayHelperUtils; 20 | import cn.sanlicun.pay.util.PreUtils; 21 | 22 | /** 23 | * =========================================== 24 | * 作者 :曾立强 3042938728@qq.com 25 | * 时间 :2018/8/9 26 | * 描述 : 27 | * ============================================ 28 | */ 29 | 30 | public class PayServlet extends BaseServlet { 31 | @Override 32 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 33 | resp.setStatus(HttpServletResponse.SC_OK); 34 | Log.i("tag","PayServlet"); 35 | resp.setCharacterEncoding("UTF-8"); 36 | resp.setContentType("application/json; charset=utf-8"); 37 | PushParam pushParam = new PushParam(); 38 | String money = req.getParameter("money"); 39 | String mark = req.getParameter("mark"); 40 | String type = req.getParameter("type"); 41 | Log.i("tag","PayServlet:money"+money+"mark:"+mark+"type:"+type); 42 | 43 | PrintWriter out = null; 44 | try { 45 | out = resp.getWriter(); 46 | if (isEmpty(money, mark, type)) { 47 | Log.i("tag","PayServlet1"); 48 | pushParam.setMessage("参数为空"); 49 | out.write(JSON.toJSONString(pushParam)); 50 | return; 51 | } 52 | double dMoney = Double.parseDouble(money); 53 | if (type.equals("alipay")) { 54 | Log.i("tag","PayServlet2"); 55 | if (dMoney > 50000) { 56 | Log.i("tag","PayServlet3"); 57 | pushParam.setMessage("单笔现金转账不能超过50000"); 58 | out.write(JSON.toJSONString(pushParam)); 59 | return; 60 | } 61 | Log.i("tag","PayServlet4"); 62 | PayHelperUtils.getPay(money, mark, type, App.getCtx()); 63 | Log.i("tag","PayServlet5"); 64 | Thread.sleep(2000); 65 | Log.i("tag","PayServlet6"); 66 | DBManager dbManager = new DBManager(App.getCtx()); 67 | List pushParams = dbManager.queryPay(mark, money); 68 | if (pushParams.size() == 0) { 69 | Log.i("tag","PayServlet7"); 70 | pushParam.setMessage("请求超时"); 71 | out.write(JSON.toJSONString(pushParam)); 72 | return; 73 | } else { 74 | Log.i("tag","PayServlet8"); 75 | PushParam respPP = pushParams.get(0); 76 | String account= PreUtils.getString(PreUtils.PRE_ACCOUNT,""); 77 | if(account!=null&&!account.equals("")){ 78 | respPP.setAccount(account); 79 | } 80 | out.write(JSON.toJSONString(respPP)); 81 | return; 82 | } 83 | } 84 | 85 | 86 | } catch (IOException e) { 87 | e.printStackTrace(); 88 | } catch (InterruptedException e) { 89 | e.printStackTrace(); 90 | } finally { 91 | if (out != null) { 92 | out.close(); 93 | } 94 | 95 | } 96 | } 97 | 98 | private boolean isEmpty(String... params) { 99 | for (String s : params) { 100 | if (TextUtils.isEmpty(s)) { 101 | return true; 102 | } 103 | } 104 | return false; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/edit_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 12 | 13 | 14 | 24 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sync_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 17 |