Commit cb7ee015826479a9e7a385a5a08d021e2bceb645
1 parent
e0b73d8b
二部商城集成
支付集成
Showing
57 changed files
with
1608 additions
and
38 deletions
app/strike/build.gradle
| @@ -179,6 +179,7 @@ dependencies { | @@ -179,6 +179,7 @@ dependencies { | ||
| 179 | implementation project(path: ':core:imageload') | 179 | implementation project(path: ':core:imageload') |
| 180 | implementation project(path: ':module:xiaojiasoundbox') | 180 | implementation project(path: ':module:xiaojiasoundbox') |
| 181 | implementation project(path: ':module:pedometer') | 181 | implementation project(path: ':module:pedometer') |
| 182 | + implementation project(path: ':module:shopcity') | ||
| 182 | // implementation project(path: ':module:shanghaishop') | 183 | // implementation project(path: ':module:shanghaishop') |
| 183 | implementation project(path: ':library_baidumap') | 184 | implementation project(path: ':library_baidumap') |
| 184 | implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0' | 185 | implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0' |
app/strike/src/main/AndroidManifest.xml
| @@ -17,6 +17,8 @@ | @@ -17,6 +17,8 @@ | ||
| 17 | android:roundIcon="@mipmap/ic_launcher_round" | 17 | android:roundIcon="@mipmap/ic_launcher_round" |
| 18 | android:supportsRtl="true" | 18 | android:supportsRtl="true" |
| 19 | android:theme="@style/AppTheme"> | 19 | android:theme="@style/AppTheme"> |
| 20 | + <activity android:name="com.cnlive.strike.demo.activity.HappyChinaActivity"></activity> | ||
| 21 | + | ||
| 20 | <provider | 22 | <provider |
| 21 | android:name="androidx.core.content.FileProvider" | 23 | android:name="androidx.core.content.FileProvider" |
| 22 | android:authorities="${applicationId}.fileprovider" | 24 | android:authorities="${applicationId}.fileprovider" |
| @@ -44,7 +46,6 @@ | @@ -44,7 +46,6 @@ | ||
| 44 | <activity android:name="com.cnlive.strike.demo.activity.DemoActivity" /> | 46 | <activity android:name="com.cnlive.strike.demo.activity.DemoActivity" /> |
| 45 | <activity android:name="com.cnlive.strike.imgutil.ImgActivity" /> | 47 | <activity android:name="com.cnlive.strike.imgutil.ImgActivity" /> |
| 46 | <activity android:name="com.cnlive.strike.MainActivity"> | 48 | <activity android:name="com.cnlive.strike.MainActivity"> |
| 47 | - | ||
| 48 | <intent-filter> | 49 | <intent-filter> |
| 49 | <action android:name="android.intent.action.MAIN" /> | 50 | <action android:name="android.intent.action.MAIN" /> |
| 50 | 51 |
app/strike/src/main/java/com/cnlive/strike/demo/activity/DemoMvpActivity.java
| @@ -8,7 +8,6 @@ import android.text.TextUtils; | @@ -8,7 +8,6 @@ import android.text.TextUtils; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | 9 | ||
| 10 | import androidx.annotation.NonNull; | 10 | import androidx.annotation.NonNull; |
| 11 | -import androidx.annotation.Nullable; | ||
| 12 | import androidx.databinding.ViewDataBinding; | 11 | import androidx.databinding.ViewDataBinding; |
| 13 | 12 | ||
| 14 | import com.alibaba.android.arouter.launcher.ARouter; | 13 | import com.alibaba.android.arouter.launcher.ARouter; |
| @@ -30,15 +29,16 @@ import com.cnlive.core.libs.base.util.AlertUtil; | @@ -30,15 +29,16 @@ import com.cnlive.core.libs.base.util.AlertUtil; | ||
| 30 | import com.cnlive.core.libs.base.util.OpenServiceHelpUtil; | 29 | import com.cnlive.core.libs.base.util.OpenServiceHelpUtil; |
| 31 | import com.cnlive.core.libs.base.util.QMUITipDialogUtil; | 30 | import com.cnlive.core.libs.base.util.QMUITipDialogUtil; |
| 32 | import com.cnlive.core.libs.base.util.StatusBarConfig; | 31 | import com.cnlive.core.libs.base.util.StatusBarConfig; |
| 32 | +import com.cnlive.core.libs.base.util.ToastUtil; | ||
| 33 | import com.cnlive.core.network.HttpConn; | 33 | import com.cnlive.core.network.HttpConn; |
| 34 | import com.cnlive.core.network.NetCallBack; | 34 | import com.cnlive.core.network.NetCallBack; |
| 35 | import com.cnlive.core.network.model.BaseResult; | 35 | import com.cnlive.core.network.model.BaseResult; |
| 36 | import com.cnlive.core.network.request.BaseRequest; | 36 | import com.cnlive.core.network.request.BaseRequest; |
| 37 | +import com.cnlive.module.shop.ui.activity.ShopHomeActivity; | ||
| 37 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 38 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 38 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 39 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 39 | import com.cnlive.strike.demo.activity.presenter.DemoActivityPresenter; | 40 | import com.cnlive.strike.demo.activity.presenter.DemoActivityPresenter; |
| 40 | import com.cnlive.strike.demo.activity.view.DemoActivityView; | 41 | import com.cnlive.strike.demo.activity.view.DemoActivityView; |
| 41 | -import com.cnlive.strike.demo.exoplayer.demo.PlayerActivity; | ||
| 42 | import com.cnlive.strike.demo.exoplayer.demo.SampleChooserActivity; | 42 | import com.cnlive.strike.demo.exoplayer.demo.SampleChooserActivity; |
| 43 | import com.cnlive.strike.network.api.ApiService; | 43 | import com.cnlive.strike.network.api.ApiService; |
| 44 | import com.cnlive.strike.network.api.ApiTimeService; | 44 | import com.cnlive.strike.network.api.ApiTimeService; |
| @@ -150,6 +150,13 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity | @@ -150,6 +150,13 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity | ||
| 150 | // UserService.getInstance(me).getAppAccount().getFaceUrl()); | 150 | // UserService.getInstance(me).getAppAccount().getFaceUrl()); |
| 151 | } | 151 | } |
| 152 | }); | 152 | }); |
| 153 | + | ||
| 154 | + //二部电商首页 | ||
| 155 | + binding.btnShopcity.setOnClickListener(view -> { | ||
| 156 | + AlertUtil.showDeftToast(DemoMvpActivity.this,"商城部分版本待升级适配"); | ||
| 157 | +// startActivity(new Intent(DemoMvpActivity.this, ShopHomeActivity.class)); | ||
| 158 | + }); | ||
| 159 | + | ||
| 153 | //获取Handler,onDestory自动解除 | 160 | //获取Handler,onDestory自动解除 |
| 154 | binding.btnHandler.setOnClickListener(new View.OnClickListener() { | 161 | binding.btnHandler.setOnClickListener(new View.OnClickListener() { |
| 155 | @Override | 162 | @Override |
app/strike/src/main/java/com/cnlive/strike/demo/activity/HappyChinaActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.demo.activity; | ||
| 2 | + | ||
| 3 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 4 | + | ||
| 5 | +import android.graphics.Color; | ||
| 6 | +import android.os.Bundle; | ||
| 7 | + | ||
| 8 | +import com.cnlive.cloud.R; | ||
| 9 | +import com.cnlive.core.libs.base.util.StatusBarUtil; | ||
| 10 | +import com.cnlive.module.common.utils.SystemBarUtils; | ||
| 11 | +import com.cnlive.strike.happychina.event.HappyChinaColorChangeEvent; | ||
| 12 | +import com.cnlive.strike.happychina.ui.fragment.HappyChinaFragment; | ||
| 13 | + | ||
| 14 | +import org.greenrobot.eventbus.EventBus; | ||
| 15 | +import org.greenrobot.eventbus.Subscribe; | ||
| 16 | +import org.greenrobot.eventbus.ThreadMode; | ||
| 17 | + | ||
| 18 | +public class HappyChinaActivity extends AppCompatActivity { | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 22 | + super.onCreate(savedInstanceState); | ||
| 23 | + setContentView(R.layout.activity_happy_china); | ||
| 24 | + SystemBarUtils.setStatusBarColor(this, Color.WHITE); | ||
| 25 | + StatusBarUtil.setStatusBarWrite(this); | ||
| 26 | + EventBus.getDefault().register(this); | ||
| 27 | + | ||
| 28 | + getSupportFragmentManager().beginTransaction().replace(R.id.mFrameLayout, HappyChinaFragment.newInstance(false)).commit(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + protected void onDestroy() { | ||
| 33 | + super.onDestroy(); | ||
| 34 | + EventBus.getDefault().unregister(this); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Subscribe(threadMode = ThreadMode.MAIN) | ||
| 38 | + public void onHappyChinaColorChange(HappyChinaColorChangeEvent event) { | ||
| 39 | + // 字段说明: | ||
| 40 | + // backgroundColor:背景颜色,可能为null | ||
| 41 | + // statusBarMode:状态栏文字颜色,可能为null | ||
| 42 | + // selectedTextColor:选中的文字颜色,可能为null | ||
| 43 | + // otherTextColor:未选中的文字颜色,可能为null | ||
| 44 | + } | ||
| 45 | +} |
app/strike/src/main/res/layout/activity_demo_mvp_main.xml
| @@ -71,6 +71,13 @@ | @@ -71,6 +71,13 @@ | ||
| 71 | android:text="路径工具" /> | 71 | android:text="路径工具" /> |
| 72 | 72 | ||
| 73 | <Button | 73 | <Button |
| 74 | + android:id="@+id/btn_shopcity" | ||
| 75 | + android:layout_width="match_parent" | ||
| 76 | + android:layout_height="wrap_content" | ||
| 77 | + android:layout_margin="5dp" | ||
| 78 | + android:text="二部商城首页" /> | ||
| 79 | + | ||
| 80 | + <Button | ||
| 74 | android:id="@+id/btn_handler" | 81 | android:id="@+id/btn_handler" |
| 75 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
| 76 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
app/strike/src/main/res/layout/activity_happy_china.xml
0 → 100644
app/strike/src/main/res/values/strings.xml
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<!-- Copyright (C) 2016 The Android Open Source Project | 1 | +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2016 The Android Open Source Project |
| 3 | 2 | ||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. | 4 | you may not use this file except in compliance with the License. |
| @@ -15,62 +14,62 @@ | @@ -15,62 +14,62 @@ | ||
| 15 | --> | 14 | --> |
| 16 | <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | 15 | <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> |
| 17 | 16 | ||
| 18 | - <string name="application_name">ExoPlayer</string> | 17 | + <string name="application_name">ExoPlayer</string> |
| 19 | 18 | ||
| 20 | - <string name="track_selection_title">Select tracks</string> | 19 | + <string name="track_selection_title">Select tracks</string> |
| 21 | 20 | ||
| 22 | - <string name="unexpected_intent_action">Unexpected intent action: <xliff:g id="action">%1$s</xliff:g></string> | 21 | + <string name="unexpected_intent_action">Unexpected intent action: <xliff:g id="action">%1$s</xliff:g></string> |
| 23 | 22 | ||
| 24 | - <string name="error_cleartext_not_permitted">Cleartext traffic not permitted</string> | 23 | + <string name="error_cleartext_not_permitted">Cleartext traffic not permitted</string> |
| 25 | 24 | ||
| 26 | - <string name="error_generic">Playback failed</string> | 25 | + <string name="error_generic">Playback failed</string> |
| 27 | 26 | ||
| 28 | - <string name="error_unrecognized_abr_algorithm">Unrecognized ABR algorithm</string> | 27 | + <string name="error_unrecognized_abr_algorithm">Unrecognized ABR algorithm</string> |
| 29 | 28 | ||
| 30 | - <string name="error_unrecognized_stereo_mode">Unrecognized stereo mode</string> | 29 | + <string name="error_unrecognized_stereo_mode">Unrecognized stereo mode</string> |
| 31 | 30 | ||
| 32 | - <string name="error_drm_unsupported_before_api_18">Protected content not supported on API levels below 18</string> | 31 | + <string name="error_drm_unsupported_before_api_18">Protected content not supported on API levels below 18</string> |
| 33 | 32 | ||
| 34 | - <string name="error_drm_unsupported_scheme">This device does not support the required DRM scheme</string> | 33 | + <string name="error_drm_unsupported_scheme">This device does not support the required DRM scheme</string> |
| 35 | 34 | ||
| 36 | - <string name="error_drm_unknown">An unknown DRM error occurred</string> | 35 | + <string name="error_drm_unknown">An unknown DRM error occurred</string> |
| 37 | 36 | ||
| 38 | - <string name="error_no_decoder">This device does not provide a decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> | 37 | + <string name="error_no_decoder">This device does not provide a decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> |
| 39 | 38 | ||
| 40 | - <string name="error_no_secure_decoder">This device does not provide a secure decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> | 39 | + <string name="error_no_secure_decoder">This device does not provide a secure decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> |
| 41 | 40 | ||
| 42 | - <string name="error_querying_decoders">Unable to query device decoders</string> | 41 | + <string name="error_querying_decoders">Unable to query device decoders</string> |
| 43 | 42 | ||
| 44 | - <string name="error_instantiating_decoder">Unable to instantiate decoder <xliff:g id="decoder_name">%1$s</xliff:g></string> | 43 | + <string name="error_instantiating_decoder">Unable to instantiate decoder <xliff:g id="decoder_name">%1$s</xliff:g></string> |
| 45 | 44 | ||
| 46 | - <string name="error_unsupported_video">Media includes video tracks, but none are playable by this device</string> | 45 | + <string name="error_unsupported_video">Media includes video tracks, but none are playable by this device</string> |
| 47 | 46 | ||
| 48 | - <string name="error_unsupported_audio">Media includes audio tracks, but none are playable by this device</string> | 47 | + <string name="error_unsupported_audio">Media includes audio tracks, but none are playable by this device</string> |
| 49 | 48 | ||
| 50 | - <string name="storage_permission_denied">Permission to access storage was denied</string> | 49 | + <string name="storage_permission_denied">Permission to access storage was denied</string> |
| 51 | 50 | ||
| 52 | - <string name="sample_list_load_error">One or more sample lists failed to load</string> | 51 | + <string name="sample_list_load_error">One or more sample lists failed to load</string> |
| 53 | 52 | ||
| 54 | - <string name="ima_not_loaded">Playing sample without ads, as the IMA extension was not loaded</string> | 53 | + <string name="ima_not_loaded">Playing sample without ads, as the IMA extension was not loaded</string> |
| 55 | 54 | ||
| 56 | - <string name="unsupported_ads_in_concatenation">Playing sample without ads, as ads are not supported in concatenations</string> | 55 | + <string name="unsupported_ads_in_concatenation">Playing sample without ads, as ads are not supported in concatenations</string> |
| 57 | 56 | ||
| 58 | - <string name="download_start_error">Failed to start download</string> | 57 | + <string name="download_start_error">Failed to start download</string> |
| 59 | 58 | ||
| 60 | - <string name="download_playlist_unsupported">This demo app does not support downloading playlists</string> | 59 | + <string name="download_playlist_unsupported">This demo app does not support downloading playlists</string> |
| 61 | 60 | ||
| 62 | - <string name="download_drm_unsupported">This demo app does not support downloading protected content</string> | 61 | + <string name="download_drm_unsupported">This demo app does not support downloading protected content</string> |
| 63 | 62 | ||
| 64 | - <string name="download_scheme_unsupported">This demo app only supports downloading http streams</string> | 63 | + <string name="download_scheme_unsupported">This demo app only supports downloading http streams</string> |
| 65 | 64 | ||
| 66 | - <string name="download_live_unsupported">This demo app does not support downloading live content</string> | 65 | + <string name="download_live_unsupported">This demo app does not support downloading live content</string> |
| 67 | 66 | ||
| 68 | - <string name="download_ads_unsupported">IMA does not support offline ads</string> | 67 | + <string name="download_ads_unsupported">IMA does not support offline ads</string> |
| 69 | 68 | ||
| 70 | - <string name="prefer_extension_decoders">Prefer extension decoders</string> | 69 | + <string name="prefer_extension_decoders">Prefer extension decoders</string> |
| 71 | 70 | ||
| 72 | - <string name="random_abr">Enable random ABR</string> | 71 | + <string name="random_abr">Enable random ABR</string> |
| 73 | 72 | ||
| 74 | - <string name="tunneling">Request multimedia tunneling</string> | 73 | + <string name="tunneling">Request multimedia tunneling</string> |
| 75 | 74 | ||
| 76 | </resources> | 75 | </resources> |
build.gradle
| @@ -139,7 +139,15 @@ allprojects { | @@ -139,7 +139,15 @@ allprojects { | ||
| 139 | url 'http://android.nexus.cnlive.com/repository/cnlive-shop/' | 139 | url 'http://android.nexus.cnlive.com/repository/cnlive-shop/' |
| 140 | credentials { username = 'shop'; password = 'ShangHa1' } | 140 | credentials { username = 'shop'; password = 'ShangHa1' } |
| 141 | } | 141 | } |
| 142 | - //------------------ 资源库配置 END------------------ | 142 | + |
| 143 | + // 技术2部仓库地址 | ||
| 144 | + maven { | ||
| 145 | + url 'http://wjjshop.cnlive.com:9188/repository/cnlive-modules/' | ||
| 146 | + credentials { username = "cnlive-android"; password = "cnlive123" } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + maven { url 'https://dl.bintray.com/granzon/cnliveLibs' }// 技术2部幸福中国依赖 | ||
| 150 | + //------------------ 资源库配置 recyclerviewAnimatorsEND------------------ | ||
| 143 | maven { url 'https://dl.bintray.com/umsdk/release' } | 151 | maven { url 'https://dl.bintray.com/umsdk/release' } |
| 144 | //关联微博 | 152 | //关联微博 |
| 145 | maven { url "https://dl.bintray.com/thelasterstar/maven/" } | 153 | maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| @@ -183,4 +191,14 @@ ext { | @@ -183,4 +191,14 @@ ext { | ||
| 183 | //七牛 | 191 | //七牛 |
| 184 | qiniuAndroidSdk = '7.3.11' | 192 | qiniuAndroidSdk = '7.3.11' |
| 185 | libUpload = '2.0.6' | 193 | libUpload = '2.0.6' |
| 194 | + circleimageview = '3.0.1' | ||
| 195 | + libMenu = '1.0.8' | ||
| 196 | + appArch = '1.2.8' | ||
| 197 | + imsdk = '3.3.2.14394.14395' | ||
| 198 | + recyclerviewAnimators = '2.2.6' | ||
| 199 | + | ||
| 200 | + //视讯云相关 | ||
| 201 | + libCnUtil = '3.1.5' | ||
| 186 | } | 202 | } |
| 203 | + | ||
| 204 | + |
cloud/app_pay/.gitignore
0 → 100644
| 1 | +/build |
cloud/app_pay/build.gradle
0 → 100644
| 1 | +apply plugin: 'com.android.library' | ||
| 2 | + | ||
| 3 | +android { | ||
| 4 | + compileSdkVersion 29 | ||
| 5 | + buildToolsVersion "29.0.2" | ||
| 6 | + | ||
| 7 | + | ||
| 8 | + defaultConfig { | ||
| 9 | + minSdkVersion 16 | ||
| 10 | + targetSdkVersion 29 | ||
| 11 | + versionCode 1 | ||
| 12 | + versionName "1.0" | ||
| 13 | + | ||
| 14 | + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
| 15 | + consumerProguardFiles 'consumer-rules.pro' | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + buildTypes { | ||
| 19 | + release { | ||
| 20 | + minifyEnabled false | ||
| 21 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +dependencies { | ||
| 28 | + implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
| 29 | + implementation 'androidx.appcompat:appcompat:1.0.2' | ||
| 30 | + testImplementation 'junit:junit:4.12' | ||
| 31 | + androidTestImplementation 'androidx.test:runner:1.1.1' | ||
| 32 | + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' | ||
| 33 | + //视讯云SDK | ||
| 34 | + implementation "com.cnlive:lib_cnutil:$rootProject.libCnUtil" | ||
| 35 | + implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1' | ||
| 36 | + implementation files('libs/alipaySdk-20180601.jar') | ||
| 37 | + implementation files('libs/UPPayAssistEx.jar') | ||
| 38 | +} |
cloud/app_pay/consumer-rules.pro
0 → 100644
cloud/app_pay/libs/UPPayAssistEx.jar
0 → 100644
No preview for this file type
cloud/app_pay/libs/UPPayPluginExPro.jar
0 → 100644
No preview for this file type
cloud/app_pay/libs/alipaySdk-20180601.jar
0 → 100644
No preview for this file type
cloud/app_pay/proguard-rules.pro
0 → 100644
| 1 | +# Add project specific ProGuard rules here. | ||
| 2 | +# You can control the set of applied configuration files using the | ||
| 3 | +# proguardFiles setting in build.gradle. | ||
| 4 | +# | ||
| 5 | +# For more details, see | ||
| 6 | +# http://developer.android.com/guide/developing/tools/proguard.html | ||
| 7 | + | ||
| 8 | +# If your project uses WebView with JS, uncomment the following | ||
| 9 | +# and specify the fully qualified class name to the JavaScript interface | ||
| 10 | +# class: | ||
| 11 | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| 12 | +# public *; | ||
| 13 | +#} | ||
| 14 | + | ||
| 15 | +# Uncomment this to preserve the line number information for | ||
| 16 | +# debugging stack traces. | ||
| 17 | +#-keepattributes SourceFile,LineNumberTable | ||
| 18 | + | ||
| 19 | +# If you keep the line number information, uncomment this to | ||
| 20 | +# hide the original source file name. | ||
| 21 | +#-renamesourcefileattribute SourceFile |
cloud/app_pay/src/androidTest/java/com/cnlive/strike/pay/ExampleInstrumentedTest.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | ||
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
| 7 | + | ||
| 8 | +import org.junit.Test; | ||
| 9 | +import org.junit.runner.RunWith; | ||
| 10 | + | ||
| 11 | +import static org.junit.Assert.*; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Instrumented test, which will execute on an Android device. | ||
| 15 | + * | ||
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 17 | + */ | ||
| 18 | +@RunWith(AndroidJUnit4.class) | ||
| 19 | +public class ExampleInstrumentedTest { | ||
| 20 | + @Test | ||
| 21 | + public void useAppContext() { | ||
| 22 | + // Context of the app under test. | ||
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
| 24 | + | ||
| 25 | + assertEquals("com.cnlive.strike.pay.test", appContext.getPackageName()); | ||
| 26 | + } | ||
| 27 | +} |
cloud/app_pay/src/main/AndroidManifest.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + package="com.cnlive.strike.pay"> | ||
| 4 | + | ||
| 5 | + <uses-permission android:name="android.permission.INTERNET" /> | ||
| 6 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 7 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 8 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
| 9 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
| 10 | + | ||
| 11 | + <!--union pay permission start--> | ||
| 12 | + <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> | ||
| 13 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
| 14 | + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
| 15 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 16 | + <uses-permission android:name="android.permission.NFC" /> | ||
| 17 | + | ||
| 18 | + <uses-feature android:name="android.hardware.nfc.hce" /> | ||
| 19 | + <uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD" /> | ||
| 20 | + <!--union pay permission end--> | ||
| 21 | + | ||
| 22 | + <application> | ||
| 23 | + | ||
| 24 | + <!--支付宝支付 --> | ||
| 25 | + <activity | ||
| 26 | + android:name="com.alipay.sdk.app.H5PayActivity" | ||
| 27 | + android:screenOrientation="portrait" /> | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + <!--union pay start--> | ||
| 31 | + <uses-library | ||
| 32 | + android:name="org.simalliance.openmobileapi" | ||
| 33 | + android:required="false" /> | ||
| 34 | + | ||
| 35 | + <activity | ||
| 36 | + android:name="com.unionpay.uppay.PayActivity" | ||
| 37 | + android:configChanges="orientation|keyboardHidden" | ||
| 38 | + android:excludeFromRecents="true" | ||
| 39 | + android:label="@string/app_name" | ||
| 40 | + android:screenOrientation="portrait" | ||
| 41 | + android:windowSoftInputMode="adjustResize" /> | ||
| 42 | + | ||
| 43 | + <activity | ||
| 44 | + android:name="com.unionpay.UPPayWapActivity" | ||
| 45 | + android:configChanges="orientation|keyboardHidden" | ||
| 46 | + android:screenOrientation="portrait" | ||
| 47 | + android:windowSoftInputMode="adjustResize" /> | ||
| 48 | + <!--union pay end--> | ||
| 49 | + | ||
| 50 | + </application> | ||
| 51 | + | ||
| 52 | +</manifest> | ||
| 0 | \ No newline at end of file | 53 | \ No newline at end of file |
cloud/app_pay/src/main/assets/data.bin
0 → 100644
No preview for this file type
cloud/app_pay/src/main/java/com/cnlive/strike/pay/IPay.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by gujun on 2017/5/2. | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | +public interface IPay { | ||
| 8 | + int PAY_TYPE_ALI = 3; | ||
| 9 | + int PAY_TYPE_WX = 1; | ||
| 10 | + int PAY_TYPE_UNION = 9; | ||
| 11 | + | ||
| 12 | + int ERR_WX_UNKNOWN = 0; | ||
| 13 | + int ERR_WX_COMM = -1; | ||
| 14 | + int ERR_WX_USER_CANCEL = -2; | ||
| 15 | + int ERR_WX_SENT_FAILED = -3; | ||
| 16 | + int ERR_WX_AUTH_DENIED = -4; | ||
| 17 | + int ERR_WX_UNSUPPORT = -5; | ||
| 18 | + int ERR_WX_NOT_INSTALLED = -6; | ||
| 19 | + | ||
| 20 | + String ERR_MSG_WX_UNKNOWN = "未知错误"; | ||
| 21 | + String ERR_MSG_WX_COMM = "支付失败,可能的原因:签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常等。"; | ||
| 22 | + String ERR_MSG_WX_USER_CANCEL = "用户取消,无需处理。发生场景:用户不支付了,点击取消,返回APP。"; | ||
| 23 | + String ERR_MSG_WX_SENT_FAILED = "发送失败"; | ||
| 24 | + String ERR_MSG_WX_AUTH_DENIED = "鉴权失败"; | ||
| 25 | + String ERR_MSG_WX_UNSUPPORT = "不支持错误"; | ||
| 26 | + String ERR_MSG_WX_NOT_INSTALLED = "未发现微信客户端"; | ||
| 27 | + | ||
| 28 | + int ERR_ALI_RESULT_DOING = -10; | ||
| 29 | + int ERR_ALI_FAIL = -11; | ||
| 30 | + int ERR_ALI_CANCEL = -12; | ||
| 31 | + int ERR_ALI_NET = -13; | ||
| 32 | + int ERR_ALI_UNKNOWN = -14; | ||
| 33 | + int ERR_ALI_OTHER = -15; | ||
| 34 | + | ||
| 35 | + String ERR_MSG_ALI_RESULT_DOING = "正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态"; | ||
| 36 | + String ERR_MSG_ALI_FAIL = "订单支付失败"; | ||
| 37 | + String ERR_MSG_ALI_CANCEL = "用户中途取消"; | ||
| 38 | + String ERR_MSG_ALI_NET = "网络连接出错"; | ||
| 39 | + String ERR_MSG_ALI_UNKNOWN = "支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态"; | ||
| 40 | + String ERR_MSG_ALI_OTHER = " 其它支付错误"; | ||
| 41 | + | ||
| 42 | + int ERR_UNION_FAIL = -31; | ||
| 43 | + int ERR_UNION_CANCEL = -32; | ||
| 44 | + String ERR_MSG_UNION_FAIL = "订单支付失败"; | ||
| 45 | + String ERR_MSG_UNION_CANCEL = "用户中途取消"; | ||
| 46 | + String ERR_MSG_UNION_PAY_DATA_NULL = "银联支付回调的data异常"; | ||
| 47 | + | ||
| 48 | + int ERR_UNSUPPORT = -20; | ||
| 49 | + int ERR_PREPAY = -21; | ||
| 50 | + int ERR_PREPAY_RESULT = -22; | ||
| 51 | + int ERR_PREPAY_NET = -23; | ||
| 52 | + | ||
| 53 | + String ERR_MSG_UNSUPPORT = "暂不支持此支付方式"; | ||
| 54 | + String ERR_MSG_PREPAY = "预支付接口请求失败"; | ||
| 55 | + String ERR_MSG_PREPAY_RESULT = "预支付接口返回错误信息"; | ||
| 56 | + String ERR_MSG_PREPAY_NET = "网络连接出错"; | ||
| 57 | + | ||
| 58 | + String PROBE_WX = "weixin"; | ||
| 59 | + String PROBE_ALI = "ali"; | ||
| 60 | + String PROBE_UNION = "union"; | ||
| 61 | + String PROBE_PAY_STATE_SUCCESS = "success"; | ||
| 62 | + String PROBE_PAY_STATE_FAIL = "fail"; | ||
| 63 | + String PROBE_PAY_STATE_CANCEL = "cancel"; | ||
| 64 | + | ||
| 65 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayStatusCallback.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by gujun on 2017/5/2. | ||
| 5 | + * 支付sdk回调 | ||
| 6 | + */ | ||
| 7 | + | ||
| 8 | +public interface PayStatusCallback { | ||
| 9 | + void onStartCallPayPage(int payType); | ||
| 10 | + | ||
| 11 | + void onSuccess(int payType); | ||
| 12 | + | ||
| 13 | + void onFail(int payType, int errorCode, String errorMsg); | ||
| 14 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayToALi.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.annotation.SuppressLint; | ||
| 4 | +import android.app.Activity; | ||
| 5 | +import android.os.Handler; | ||
| 6 | +import android.os.Message; | ||
| 7 | +import android.text.TextUtils; | ||
| 8 | +import android.util.Log; | ||
| 9 | + | ||
| 10 | +import com.alipay.sdk.app.PayTask; | ||
| 11 | +import com.cnlive.strike.pay.model.AliPayResult; | ||
| 12 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 13 | +import com.cnlive.strike.pay.model.Result; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Created by gujun on 2017/5/2. | ||
| 17 | + */ | ||
| 18 | +public class PayToALi { | ||
| 19 | + private static final String TAG = "PayToALi"; | ||
| 20 | + | ||
| 21 | + private static final int SDK_PAY_FLAG = 1; | ||
| 22 | + | ||
| 23 | + public static void startPay(final Activity activity, final PayCloudResponse payCloudResponse, final String appOrderId) { | ||
| 24 | + | ||
| 25 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 26 | + | ||
| 27 | + if (payCloudResponse == null || payCloudResponse.getData() == null || TextUtils.isEmpty(payCloudResponse.getData().getAlipay_app())) { | ||
| 28 | + if (payStatusCallback != null) | ||
| 29 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_PREPAY_RESULT, IPay.ERR_MSG_PREPAY_RESULT + payCloudResponse.toString()); | ||
| 30 | + | ||
| 31 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 32 | + return; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + if (payStatusCallback != null) | ||
| 36 | + payStatusCallback.onStartCallPayPage(IPay.PAY_TYPE_ALI); | ||
| 37 | + | ||
| 38 | + try { | ||
| 39 | + //签名拼接支付信息操作交由后台 | ||
| 40 | + Log.d(TAG, "ExternalPartner start pay "); | ||
| 41 | + | ||
| 42 | + // start the pay. | ||
| 43 | + Runnable payRunnable = new Runnable() { | ||
| 44 | + @Override | ||
| 45 | + public void run() { | ||
| 46 | + PayTask alipay = new PayTask(activity); | ||
| 47 | + String result = alipay.pay(payCloudResponse.getData().getAlipay_app(), true); | ||
| 48 | + | ||
| 49 | + Message msg = new Message(); | ||
| 50 | + msg.what = SDK_PAY_FLAG; | ||
| 51 | + msg.obj = new AliPayResult(appOrderId, result); | ||
| 52 | + alipayHandler.sendMessage(msg); | ||
| 53 | + } | ||
| 54 | + }; | ||
| 55 | + | ||
| 56 | + Thread payThread = new Thread(payRunnable); | ||
| 57 | + payThread.start(); | ||
| 58 | + | ||
| 59 | + } catch (Exception ex) { | ||
| 60 | + | ||
| 61 | + if (payStatusCallback != null) | ||
| 62 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_OTHER, IPay.ERR_MSG_ALI_OTHER + (ex != null ? ex.getMessage() : "调用支付宝支付方法异常")); | ||
| 63 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 64 | + if (ex!=null) | ||
| 65 | + Log.e(TAG, "alipay error".concat(ex.getMessage()), ex); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + // ============================================================================================ | ||
| 71 | + // 支付宝不用动的 | ||
| 72 | + // ============================================================================================ | ||
| 73 | + @SuppressLint("HandlerLeak") | ||
| 74 | + private static Handler alipayHandler = new Handler() { | ||
| 75 | + @Override | ||
| 76 | + public void handleMessage(Message msg) { | ||
| 77 | + switch (msg.what) { | ||
| 78 | + case SDK_PAY_FLAG: | ||
| 79 | + AliPayResult aliPayResult = (AliPayResult) msg.obj; | ||
| 80 | + String orderId = aliPayResult.getOrderId(); | ||
| 81 | + | ||
| 82 | + Result resultObj = new Result(aliPayResult.getResult()); | ||
| 83 | + String resultStatus = resultObj.resultStatus; | ||
| 84 | + | ||
| 85 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(orderId); | ||
| 86 | + | ||
| 87 | + // 判断resultStatus 为“9000”则代表支付成功,具体状态码代表含义可参考接口文档 | ||
| 88 | + if (resultStatus.equals("9000")) { | ||
| 89 | + if (payStatusCallback != null) | ||
| 90 | + payStatusCallback.onSuccess(IPay.PAY_TYPE_ALI); | ||
| 91 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_SUCCESS); | ||
| 92 | + } else { | ||
| 93 | + if (resultStatus.equals("8000")) { | ||
| 94 | + //正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 | ||
| 95 | + if (payStatusCallback != null) | ||
| 96 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_RESULT_DOING, IPay.ERR_MSG_ALI_RESULT_DOING); | ||
| 97 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 98 | + } else if (resultStatus.equals("4000")) { | ||
| 99 | + //订单支付失败 | ||
| 100 | + if (payStatusCallback != null) | ||
| 101 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_FAIL, IPay.ERR_MSG_ALI_FAIL); | ||
| 102 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 103 | + } else if (resultStatus.equals("6001")) { | ||
| 104 | + //用户中途取消 | ||
| 105 | + if (payStatusCallback != null) | ||
| 106 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_CANCEL, IPay.ERR_MSG_ALI_CANCEL); | ||
| 107 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 108 | + } else if (resultStatus.equals("6002")) { | ||
| 109 | + //网络连接出错 | ||
| 110 | + if (payStatusCallback != null) | ||
| 111 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_NET, IPay.ERR_MSG_ALI_NET); | ||
| 112 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 113 | + } else if (resultStatus.equals("6004")) { | ||
| 114 | + //支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 | ||
| 115 | + if (payStatusCallback != null) | ||
| 116 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_UNKNOWN, IPay.ERR_MSG_ALI_UNKNOWN); | ||
| 117 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 118 | + } else { | ||
| 119 | + //其它支付错误 | ||
| 120 | + if (payStatusCallback != null) | ||
| 121 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_OTHER, IPay.ERR_MSG_ALI_OTHER); | ||
| 122 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + PayUtil.removePayCallback(orderId); | ||
| 126 | + break; | ||
| 127 | + default: | ||
| 128 | + break; | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + }; | ||
| 132 | + | ||
| 133 | + | ||
| 134 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayToUnion.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.content.Intent; | ||
| 5 | + | ||
| 6 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 7 | +import com.unionpay.UPPayAssistEx; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +public class PayToUnion { | ||
| 11 | + | ||
| 12 | + public static void startPay(Context context, PayCloudResponse payCloudResponse, final String appOrderId) { | ||
| 13 | + startPay(context, payCloudResponse, appOrderId, false); | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + public static void startPay(Context context, PayCloudResponse payCloudResponse, final String appOrderId, boolean isDebug) { | ||
| 17 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 18 | + | ||
| 19 | + if (payCloudResponse == null || payCloudResponse.getData() == null || payCloudResponse.getData().getUnion_app() == null) { | ||
| 20 | + if (payStatusCallback != null) | ||
| 21 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_PREPAY_RESULT, IPay.ERR_MSG_PREPAY_RESULT + payCloudResponse.toString()); | ||
| 22 | + | ||
| 23 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_FAIL); | ||
| 24 | + return; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + if (payStatusCallback != null) | ||
| 28 | + payStatusCallback.onStartCallPayPage(IPay.PAY_TYPE_UNION); | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + UPPayAssistEx.startPay(context, null, null, payCloudResponse.getData().getUnion_app(), getPayMode(isDebug)); | ||
| 32 | + | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public static void unionPayOnActivityResult(String appOrderId, Intent data) { | ||
| 36 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 37 | + if (payStatusCallback == null) return; | ||
| 38 | + | ||
| 39 | + if (data == null || data.getExtras() == null) { | ||
| 40 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_UNION_CANCEL, IPay.ERR_MSG_UNION_CANCEL); | ||
| 41 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 42 | + return; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + String str = data.getExtras().getString("pay_result"); | ||
| 46 | + | ||
| 47 | + if ("success".equalsIgnoreCase(str)) { | ||
| 48 | + payStatusCallback.onSuccess(IPay.PAY_TYPE_UNION); | ||
| 49 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_SUCCESS); | ||
| 50 | + } else if ("fail".equalsIgnoreCase(str)) { | ||
| 51 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_UNION_FAIL, IPay.ERR_MSG_UNION_FAIL); | ||
| 52 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_FAIL); | ||
| 53 | + } else if ("cancel".equalsIgnoreCase(str)) { | ||
| 54 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_UNION_CANCEL, IPay.ERR_MSG_UNION_CANCEL); | ||
| 55 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + PayUtil.removePayCallback(appOrderId); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /***************************************************************** | ||
| 62 | + * mMode参数解释: "00" - 启动银联正式环境 "01" - 连接银联测试环境 | ||
| 63 | + *****************************************************************/ | ||
| 64 | + private static String getPayMode(boolean isDebug) { | ||
| 65 | + return isDebug ? "01" : "00"; | ||
| 66 | + } | ||
| 67 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayToWX.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 6 | +import com.tencent.mm.opensdk.modelpay.PayReq; | ||
| 7 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | ||
| 8 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Created by gujun on 2017/5/2. | ||
| 12 | + */ | ||
| 13 | +public class PayToWX { | ||
| 14 | + | ||
| 15 | + private static IWXAPI api; | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 判断是否安装了微信客户端 | ||
| 19 | + */ | ||
| 20 | + public static boolean isWXAppInstalledAndSupported(Context context) { | ||
| 21 | + if (api == null) | ||
| 22 | + api = WXAPIFactory.createWXAPI(context, PayUtil.getWxAppId()); | ||
| 23 | + | ||
| 24 | + return api.isWXAppInstalled(); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public static void startPay(Context context, PayCloudResponse payCloudResponse, final String appOrderId) { | ||
| 28 | + | ||
| 29 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 30 | + | ||
| 31 | + if (payCloudResponse == null || payCloudResponse.getData() == null || payCloudResponse.getData().getWx_app() == null) { | ||
| 32 | + if (payStatusCallback != null) | ||
| 33 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_PREPAY_RESULT, IPay.ERR_MSG_PREPAY_RESULT + payCloudResponse.toString()); | ||
| 34 | + | ||
| 35 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 36 | + return; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + if (isWXAppInstalledAndSupported(context)) { | ||
| 40 | + if (payStatusCallback != null) | ||
| 41 | + payStatusCallback.onStartCallPayPage(IPay.PAY_TYPE_WX); | ||
| 42 | + | ||
| 43 | + genPayReq(api, payCloudResponse, appOrderId); | ||
| 44 | + | ||
| 45 | + } else { | ||
| 46 | + if (payStatusCallback != null) | ||
| 47 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_NOT_INSTALLED, IPay.ERR_MSG_WX_NOT_INSTALLED); | ||
| 48 | + | ||
| 49 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 生成签名参数 | ||
| 56 | + * | ||
| 57 | + * @param payCloudResponse | ||
| 58 | + */ | ||
| 59 | + private static void genPayReq(IWXAPI msgApi, PayCloudResponse payCloudResponse, String appOrderId) { | ||
| 60 | + PayReq req = new PayReq(); | ||
| 61 | + req.appId = payCloudResponse.getData().getWx_app().getAppid(); | ||
| 62 | + req.partnerId = payCloudResponse.getData().getWx_app().getPartnerid(); | ||
| 63 | + req.prepayId = payCloudResponse.getData().getWx_app().getPrepayid(); | ||
| 64 | + req.packageValue = "Sign=WXPay"; | ||
| 65 | + req.nonceStr = payCloudResponse.getData().getWx_app().getNoncestr(); | ||
| 66 | + req.timeStamp = payCloudResponse.getData().getWx_app().getTimestamp(); | ||
| 67 | + req.sign = payCloudResponse.getData().getWx_app().getSign(); | ||
| 68 | + req.extData = appOrderId; | ||
| 69 | + | ||
| 70 | + // 发起支付请求 | ||
| 71 | + msgApi.registerApp(PayUtil.getWxAppId()); | ||
| 72 | + msgApi.sendReq(req); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayUtil.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.text.TextUtils; | ||
| 7 | +import android.util.Log; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +import com.cnlive.libs.util.Config; | ||
| 11 | +import com.cnlive.libs.util.NetUtil; | ||
| 12 | +import com.cnlive.libs.util.ProbeUtil; | ||
| 13 | +import com.cnlive.libs.util.b; | ||
| 14 | +import com.cnlive.libs.util.data.okhttp3.Call; | ||
| 15 | +import com.cnlive.libs.util.data.okhttp3.Response; | ||
| 16 | +import com.cnlive.libs.util.data.okhttpUtil.callback.GenericsCallback; | ||
| 17 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 18 | +import com.cnlive.strike.pay.network.HttpRequest; | ||
| 19 | + | ||
| 20 | +import java.lang.reflect.ParameterizedType; | ||
| 21 | +import java.util.HashMap; | ||
| 22 | +import java.util.Map; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Created by gujun on 2017/5/2. | ||
| 26 | + */ | ||
| 27 | + | ||
| 28 | +public class PayUtil { | ||
| 29 | + | ||
| 30 | + private static String wxAppId; | ||
| 31 | + //标记对应的订单回调 | ||
| 32 | + public static Map<String, PayStatusCallback> callbackMap = new HashMap<>(); | ||
| 33 | + | ||
| 34 | + public static void init(String weixinAppId) { | ||
| 35 | + wxAppId = weixinAppId; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public static String getWxAppId() { | ||
| 39 | + return wxAppId; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public static void startPay(final Context context, | ||
| 43 | + final int payType, | ||
| 44 | + final String orderId, | ||
| 45 | + String body, | ||
| 46 | + int totalMoney, | ||
| 47 | + String notify_url, | ||
| 48 | + String account, | ||
| 49 | + String user_id, | ||
| 50 | + String frmId, | ||
| 51 | + Map<String, String> extraParams, | ||
| 52 | + final PayStatusCallback callback) { | ||
| 53 | + //初始化统计 | ||
| 54 | + ProbeUtil.probeApp(Config.SDK_PAY, Config.SDK_PAY_VERSION, Config.EVENT_PAY, "", "", ""); | ||
| 55 | + | ||
| 56 | + HttpRequest.prePay(payType, orderId, body, totalMoney, notify_url, account, user_id,frmId,extraParams, new TestCallback<PayCloudResponse>() { | ||
| 57 | + @Override | ||
| 58 | + public void onError(Call call, Exception e) { | ||
| 59 | + Log.e("PayUtil", "异常 : ", e); | ||
| 60 | + if (callback != null) { | ||
| 61 | + if (!NetUtil.checkNetwork(context)) { | ||
| 62 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_PREPAY_NET, IPay.ERR_MSG_PREPAY_NET); | ||
| 63 | + } else { | ||
| 64 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_PREPAY, IPay.ERR_MSG_PREPAY + ":" + e.getMessage()); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @Override | ||
| 71 | + public void onResponse(PayCloudResponse response, Exception e) { | ||
| 72 | + if (response != null) { | ||
| 73 | + if ("0".equals(response.getErrorCode())) { | ||
| 74 | + | ||
| 75 | + if (!TextUtils.isEmpty(orderId) && callback != null) | ||
| 76 | + callbackMap.put(orderId, callback); | ||
| 77 | + | ||
| 78 | + if (payType == IPay.PAY_TYPE_WX) { | ||
| 79 | + PayToWX.startPay(context, response, orderId); | ||
| 80 | + } else if (payType == IPay.PAY_TYPE_ALI) { | ||
| 81 | + PayToALi.startPay((Activity) context, response, orderId); | ||
| 82 | + } else if (payType == IPay.PAY_TYPE_UNION) { | ||
| 83 | + PayToUnion.startPay(context, response, orderId); | ||
| 84 | + } else { | ||
| 85 | + if (callback != null) | ||
| 86 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_UNSUPPORT, IPay.ERR_MSG_UNSUPPORT); | ||
| 87 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 88 | + } | ||
| 89 | + } else { | ||
| 90 | + int errorCodeOpen; | ||
| 91 | + try { | ||
| 92 | + errorCodeOpen = Integer.valueOf(response.getErrorCode()); | ||
| 93 | + } catch (Exception e1) { | ||
| 94 | + errorCodeOpen = IPay.ERR_PREPAY_RESULT; | ||
| 95 | + } | ||
| 96 | + if (callback != null) | ||
| 97 | + callback.onFail(getCallbackPayType(payType), errorCodeOpen, response.getErrorMessage()); | ||
| 98 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 99 | + } | ||
| 100 | + } else { | ||
| 101 | + if (callback != null) | ||
| 102 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_PREPAY, IPay.ERR_MSG_PREPAY + ":" + e.getMessage()); | ||
| 103 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + //电商调用 | ||
| 110 | + public static void startPay(final Context context, | ||
| 111 | + final int payType, | ||
| 112 | + final String orderId, | ||
| 113 | + String body, | ||
| 114 | + int totalMoney, | ||
| 115 | + String notify_url, | ||
| 116 | + String account, | ||
| 117 | + String user_id, | ||
| 118 | + Map<String, String> extraParams, | ||
| 119 | + final PayStatusCallback callback) { | ||
| 120 | + startPay(context,payType,orderId,body,totalMoney,notify_url,account,user_id,null,extraParams,callback); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 银联的callback走的是OnActivityResult,所以使用银联的话再Activity的OnActivityResult()方法中调用一下此方法,通过PayStatusCallback进行回调 | ||
| 125 | + * | ||
| 126 | + * @param appOrderId | ||
| 127 | + * @param data | ||
| 128 | + */ | ||
| 129 | + public static void unionPayOnActivityResult(String appOrderId, Intent data) { | ||
| 130 | + PayToUnion.unionPayOnActivityResult(appOrderId, data); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public abstract static class TestCallback<T> extends GenericsCallback<T> { | ||
| 134 | + b mGenericsSerializator = new b(); | ||
| 135 | + | ||
| 136 | + public TestCallback() { | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public T parseNetworkResponse(Response var1, Exception var2) throws Exception { | ||
| 140 | + String var3 = var1.body().string(); | ||
| 141 | + Class var4 = (Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; | ||
| 142 | + if (var4 == String.class) { | ||
| 143 | + return (T) var3; | ||
| 144 | + } else { | ||
| 145 | + T var5 = (T) this.mGenericsSerializator.transform(var3, var4); | ||
| 146 | + return var5; | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + private static int getCallbackPayType(int payType) { | ||
| 152 | + return payType; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + private static String getProbePayType(int payType) { | ||
| 156 | + return payType == IPay.PAY_TYPE_WX ? IPay.PROBE_WX : (payType == IPay.PAY_TYPE_ALI ? IPay.PROBE_ALI : (payType == IPay.PAY_TYPE_UNION ? IPay.PROBE_UNION : "")); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public static void probeApp(String orderId, int payType, String payState) { | ||
| 160 | + ProbeUtil.probeApp(Config.SDK_PAY, Config.SDK_PAY_VERSION, Config.EVENT_PAY_STATE, orderId, getProbePayType(payType), payState); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public static PayStatusCallback getPayCallback(String orderId) { | ||
| 164 | + if (TextUtils.isEmpty(orderId)) return null; | ||
| 165 | + if (callbackMap != null && callbackMap.containsKey(orderId)) { | ||
| 166 | + return callbackMap.get(orderId); | ||
| 167 | + } | ||
| 168 | + return null; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public static void removePayCallback(String orderId) { | ||
| 172 | + if (TextUtils.isEmpty(orderId)) return; | ||
| 173 | + if (callbackMap != null && callbackMap.containsKey(orderId)) { | ||
| 174 | + callbackMap.remove(orderId); | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/AliPayResult.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; /** * Created by gujun on 2017/5/2. * 支付handler传递的数据封装对象 */ public class AliPayResult { private String orderId; private String result; public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public AliPayResult(String orderId, String result) { this.orderId = orderId; this.result = result; } } | ||
| 0 | \ No newline at end of file | 2 | \ No newline at end of file |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/PayCloudResponse.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.comment.model.ErrorMessage; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by gujun on 2017/4/10. | ||
| 8 | + * 支付云返回的数据 | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +public class PayCloudResponse extends ErrorMessage { | ||
| 12 | + | ||
| 13 | + private PayCloudResponseData data; | ||
| 14 | + | ||
| 15 | + public PayCloudResponseData getData() { | ||
| 16 | + return data; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setData(PayCloudResponseData data) { | ||
| 20 | + this.data = data; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public String toString() { | ||
| 25 | + return "PayCloudResponse{" + | ||
| 26 | + "data=" + data + | ||
| 27 | + '}'; | ||
| 28 | + } | ||
| 29 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/PayCloudResponseData.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.model.BaseData; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by gujun on 2017/4/10. | ||
| 8 | + * 支付云返回的数据 | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +public class PayCloudResponseData extends BaseData { | ||
| 12 | + | ||
| 13 | + private String notify_url; | ||
| 14 | + private String order_id; | ||
| 15 | + private String alipay_app; | ||
| 16 | + private WxApp wx_app; | ||
| 17 | + private String union_app; | ||
| 18 | + | ||
| 19 | + public String getNotify_url() { | ||
| 20 | + return notify_url; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setNotify_url(String notify_url) { | ||
| 24 | + this.notify_url = notify_url; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getOrder_id() { | ||
| 28 | + return order_id; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setOrder_id(String order_id) { | ||
| 32 | + this.order_id = order_id; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getAlipay_app() { | ||
| 36 | + return alipay_app; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setAlipay_app(String alipay_app) { | ||
| 40 | + this.alipay_app = alipay_app; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public WxApp getWx_app() { | ||
| 44 | + return wx_app; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setWx_app(WxApp wx_app) { | ||
| 48 | + this.wx_app = wx_app; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public String getUnion_app() { | ||
| 52 | + return union_app; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setUnion_app(String union_app) { | ||
| 56 | + this.union_app = union_app; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public String toString() { | ||
| 61 | + return "PayCloudResponseData{" + | ||
| 62 | + "notify_url='" + notify_url + '\'' + | ||
| 63 | + ", order_id='" + order_id + '\'' + | ||
| 64 | + ", alipay_app='" + alipay_app + '\'' + | ||
| 65 | + ", wx_app=" + wx_app + | ||
| 66 | + ", union_app='" + union_app + '\'' + | ||
| 67 | + '}'; | ||
| 68 | + } | ||
| 69 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/Result.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; /** * Created by gujun on 2017/5/2. * 支付宝返回的支付result对象转换 */ public class Result { public String resultStatus; public String result; public String memo; public Result(String rawResult) { try { String[] resultParams = rawResult.split(";"); for (String resultParam : resultParams) { if (resultParam.startsWith("resultStatus")) { resultStatus = gatValue(resultParam, "resultStatus"); } if (resultParam.startsWith("result")) { result = gatValue(resultParam, "result"); } if (resultParam.startsWith("memo")) { memo = gatValue(resultParam, "memo"); } } } catch (Exception e) { if (e!=null) e.printStackTrace(); } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } private String gatValue(String content, String key) { String prefix = key + "={"; return content.substring(content.indexOf(prefix) + prefix.length(), content.lastIndexOf("}")); } } | ||
| 0 | \ No newline at end of file | 2 | \ No newline at end of file |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/WxApp.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.model.BaseData; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by gujun on 2017/5/2. | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +public class WxApp extends BaseData { | ||
| 11 | + private String appid; | ||
| 12 | + private String partnerid; | ||
| 13 | + private String prepayid; | ||
| 14 | + private String noncestr; | ||
| 15 | + private String timestamp; | ||
| 16 | + private String sign; | ||
| 17 | + | ||
| 18 | + public String getAppid() { | ||
| 19 | + return appid; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setAppid(String appid) { | ||
| 23 | + this.appid = appid; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public String getPartnerid() { | ||
| 27 | + return partnerid; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setPartnerid(String partnerid) { | ||
| 31 | + this.partnerid = partnerid; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getPrepayid() { | ||
| 35 | + return prepayid; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setPrepayid(String prepayid) { | ||
| 39 | + this.prepayid = prepayid; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public String getNoncestr() { | ||
| 43 | + return noncestr; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setNoncestr(String noncestr) { | ||
| 47 | + this.noncestr = noncestr; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public String getTimestamp() { | ||
| 51 | + return timestamp; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setTimestamp(String timestamp) { | ||
| 55 | + this.timestamp = timestamp; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public String getSign() { | ||
| 59 | + return sign; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setSign(String sign) { | ||
| 63 | + this.sign = sign; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public String toString() { | ||
| 68 | + return "WxApp{" + | ||
| 69 | + "appid='" + appid + '\'' + | ||
| 70 | + ", partnerid='" + partnerid + '\'' + | ||
| 71 | + ", prepayid='" + prepayid + '\'' + | ||
| 72 | + ", noncestr='" + noncestr + '\'' + | ||
| 73 | + ", timestamp='" + timestamp + '\'' + | ||
| 74 | + ", sign='" + sign + '\'' + | ||
| 75 | + '}'; | ||
| 76 | + } | ||
| 77 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/network/HttpRequest.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.network; | ||
| 2 | + | ||
| 3 | +import android.text.TextUtils; | ||
| 4 | + | ||
| 5 | +import com.cnlive.libs.util.Config; | ||
| 6 | +import com.cnlive.libs.util.HttpUtils; | ||
| 7 | +import com.cnlive.libs.util.data.okhttpUtil.callback.GenericsCallback; | ||
| 8 | + | ||
| 9 | +import java.util.HashMap; | ||
| 10 | +import java.util.Iterator; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Created by gujun on 2017/5/2. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +public class HttpRequest { | ||
| 18 | + | ||
| 19 | + private static final String PREPAY_URL_RELEASE = "https://api.cnlive.com/open/api2/unifypay/prepay"; | ||
| 20 | + | ||
| 21 | + private static final String PREPAY_URL = PREPAY_URL_RELEASE; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 调支付云预支付接口 | ||
| 25 | + * | ||
| 26 | + * @param payType 微信 1 支付宝 3 | ||
| 27 | + * @param orderId 订单号 | ||
| 28 | + * @param body 订单简介 | ||
| 29 | + * @param totalMoney 订单总额 (分)单位 | ||
| 30 | + * @param notify_url 支付成功的回调地址 | ||
| 31 | + * @param account 微信支付需要的 | ||
| 32 | + * @param user_id 业务系统用户ID | ||
| 33 | + * @param extraParams 业务回传参数可以使用多个参数,由业务系统自行使用。但有长度限制, | ||
| 34 | + * 所有attach 的总字符长度不能超过300。 例如: attach.phone=13523455432 | ||
| 35 | + */ | ||
| 36 | + public static void prePay(final int payType, | ||
| 37 | + String orderId, | ||
| 38 | + String body, | ||
| 39 | + int totalMoney, | ||
| 40 | + String notify_url, | ||
| 41 | + String account, | ||
| 42 | + String user_id, | ||
| 43 | + String frmId, | ||
| 44 | + Map<String, String> extraParams, | ||
| 45 | + GenericsCallback callback) { | ||
| 46 | + | ||
| 47 | + Map<String, String> params = new HashMap<>(); | ||
| 48 | + | ||
| 49 | + if (!TextUtils.isEmpty(account)) | ||
| 50 | + params.put("account", account); | ||
| 51 | + | ||
| 52 | + if (!TextUtils.isEmpty(user_id)) | ||
| 53 | + params.put("user_id", user_id); | ||
| 54 | + | ||
| 55 | + if (extraParams != null && extraParams.size() > 0) { | ||
| 56 | + Iterator<Map.Entry<String, String>> it = extraParams.entrySet().iterator(); | ||
| 57 | + while (it.hasNext()) { | ||
| 58 | + Map.Entry<String, String> entry = it.next(); | ||
| 59 | + params.put("attach.".concat(entry.getKey()), entry.getValue()); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +// params.put("timestamp",time);lib_util里面添加了 | ||
| 63 | + params.put("appId", Config.getAppId()); | ||
| 64 | + params.put("out_trade_no", orderId); | ||
| 65 | + params.put("body", body); | ||
| 66 | + params.put("total_fee", totalMoney + ""); | ||
| 67 | + params.put("notify_url", notify_url); | ||
| 68 | + params.put("type", payType + ""); | ||
| 69 | + if(frmId != null)params.put("frmId", frmId); | ||
| 70 | + | ||
| 71 | + HttpUtils.doPostAsyn(PREPAY_URL, params, callback); | ||
| 72 | + | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/ui/WXPayActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.ui; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | + | ||
| 5 | +import com.cnlive.strike.pay.IPay; | ||
| 6 | +import com.cnlive.strike.pay.PayStatusCallback; | ||
| 7 | +import com.cnlive.strike.pay.PayUtil; | ||
| 8 | +import com.tencent.mm.opensdk.constants.ConstantsAPI; | ||
| 9 | +import com.tencent.mm.opensdk.modelbase.BaseReq; | ||
| 10 | +import com.tencent.mm.opensdk.modelbase.BaseResp; | ||
| 11 | +import com.tencent.mm.opensdk.modelpay.PayResp; | ||
| 12 | +import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * Created by gujun on 2017/5/4. | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +public class WXPayActivity extends Activity implements IWXAPIEventHandler { | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void onReq(BaseReq baseReq) { | ||
| 22 | + | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public void onResp(BaseResp baseResp) { | ||
| 27 | + PayResp payResp = (PayResp) baseResp; | ||
| 28 | + | ||
| 29 | + String orderId = payResp.extData; | ||
| 30 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(orderId); | ||
| 31 | + if (payStatusCallback == null) { | ||
| 32 | + this.finish(); | ||
| 33 | + return; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) { | ||
| 37 | + if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) { | ||
| 38 | + payStatusCallback.onSuccess(IPay.PAY_TYPE_WX); | ||
| 39 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_SUCCESS); | ||
| 40 | + } else { | ||
| 41 | + if (baseResp.errCode == BaseResp.ErrCode.ERR_COMM) { | ||
| 42 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_COMM, IPay.ERR_MSG_WX_COMM); | ||
| 43 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 44 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) { | ||
| 45 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_USER_CANCEL, IPay.ERR_MSG_WX_USER_CANCEL); | ||
| 46 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 47 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_SENT_FAILED) { | ||
| 48 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_SENT_FAILED, IPay.ERR_MSG_WX_SENT_FAILED); | ||
| 49 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 50 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_AUTH_DENIED) { | ||
| 51 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_AUTH_DENIED, IPay.ERR_MSG_WX_AUTH_DENIED); | ||
| 52 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 53 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_UNSUPPORT) { | ||
| 54 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_UNSUPPORT, IPay.ERR_MSG_WX_UNSUPPORT); | ||
| 55 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 56 | + } else { | ||
| 57 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_UNKNOWN, IPay.ERR_MSG_WX_UNKNOWN); | ||
| 58 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + this.finish(); | ||
| 63 | + } | ||
| 64 | +} |
cloud/app_pay/src/main/jniLibs/armeabi-v7a/libentryexpro.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi-v7a/libuptsmaddon.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi-v7a/libuptsmaddonmi.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi/libentryexpro.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi/libuptsmaddon.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi/libuptsmaddonmi.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/res/layout/pay_result.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | + | ||
| 3 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 4 | + style="@style/NavPage"> | ||
| 5 | + | ||
| 6 | + <TextView | ||
| 7 | + android:layout_width="fill_parent" | ||
| 8 | + android:layout_height="fill_parent" | ||
| 9 | + android:gravity="center" | ||
| 10 | + android:textColor="#ff000000" | ||
| 11 | + android:textSize="20sp" | ||
| 12 | + android:text="@string/pay_result_tip"/> | ||
| 13 | + | ||
| 14 | +</LinearLayout> | ||
| 0 | \ No newline at end of file | 15 | \ No newline at end of file |
cloud/app_pay/src/main/res/values/pay_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- WXPayEntryActivity --> | ||
| 4 | + <string name="pay_result_tip">这个界面用于显示第三方app通过微信支付的结果</string> | ||
| 5 | + <string name="pay_result_callback_msg" formatted="false">微信支付结果:%s</string> | ||
| 6 | +</resources> | ||
| 0 | \ No newline at end of file | 7 | \ No newline at end of file |
cloud/app_pay/src/main/res/values/pay_styles.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- 微信支付布局用到的 --> | ||
| 4 | + <style name="NavPage"> | ||
| 5 | + <item name="android:layout_width">fill_parent</item> | ||
| 6 | + <item name="android:layout_height">fill_parent</item> | ||
| 7 | + <item name="android:orientation">vertical</item> | ||
| 8 | + <item name="android:gravity">center_horizontal</item> | ||
| 9 | + <item name="android:background">#FFE1E8EB</item> | ||
| 10 | + </style> | ||
| 11 | +</resources> | ||
| 0 | \ No newline at end of file | 12 | \ No newline at end of file |
cloud/app_pay/src/main/res/values/strings.xml
0 → 100644
cloud/app_pay/src/test/java/com/cnlive/strike/pay/ExampleUnitTest.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import org.junit.Test; | ||
| 4 | + | ||
| 5 | +import static org.junit.Assert.*; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Example local unit test, which will execute on the development machine (host). | ||
| 9 | + * | ||
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 11 | + */ | ||
| 12 | +public class ExampleUnitTest { | ||
| 13 | + @Test | ||
| 14 | + public void addition_isCorrect() { | ||
| 15 | + assertEquals(4, 2 + 2); | ||
| 16 | + } | ||
| 17 | +} | ||
| 0 | \ No newline at end of file | 18 | \ No newline at end of file |
module/shanghaishop/build.gradle
| @@ -27,7 +27,7 @@ dependencies { | @@ -27,7 +27,7 @@ dependencies { | ||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | /** 圆形图片处理 androidx **/ | 29 | /** 圆形图片处理 androidx **/ |
| 30 | - implementation 'de.hdodenhof:circleimageview:3.0.1' | 30 | + implementation "de.hdodenhof:circleimageview:$rootProject.circleimageview" |
| 31 | 31 | ||
| 32 | /*下拉刷新 上拉加载更多*/ | 32 | /*下拉刷新 上拉加载更多*/ |
| 33 | implementation 'com.github.Aspsine:SwipeToLoadLayout:1.0.4' | 33 | implementation 'com.github.Aspsine:SwipeToLoadLayout:1.0.4' |
module/shopcity/.gitignore
0 → 100644
| 1 | +/build |
module/shopcity/build.gradle
0 → 100644
| 1 | +apply plugin: 'com.android.library' | ||
| 2 | + | ||
| 3 | +android { | ||
| 4 | +// compileSdkVersion 29 | ||
| 5 | +// buildToolsVersion "29.0.2" | ||
| 6 | +// | ||
| 7 | +// | ||
| 8 | +// defaultConfig { | ||
| 9 | +// minSdkVersion 16 | ||
| 10 | +// targetSdkVersion 29 | ||
| 11 | +// versionCode 1 | ||
| 12 | +// versionName "1.0" | ||
| 13 | +// | ||
| 14 | +// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
| 15 | +// consumerProguardFiles 'consumer-rules.pro' | ||
| 16 | +// } | ||
| 17 | + | ||
| 18 | + buildTypes { | ||
| 19 | + release { | ||
| 20 | + minifyEnabled false | ||
| 21 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +dependencies { | ||
| 28 | + implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
| 29 | + | ||
| 30 | + implementation 'androidx.appcompat:appcompat:1.0.2' | ||
| 31 | + testImplementation 'junit:junit:4.12' | ||
| 32 | + androidTestImplementation 'androidx.test:runner:1.1.1' | ||
| 33 | + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + def moduleVersion = "0.3.7-alpha01" | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + annotationProcessor "com.google.dagger:dagger-android-processor:2.16" | ||
| 40 | + // 刷新控件 | ||
| 41 | + implementation "com.scwang.smartrefresh:SmartRefreshLayout:$rootProject.SmartRefreshLayout" | ||
| 42 | + implementation "com.scwang.smartrefresh:SmartRefreshHeader:$rootProject.SmartRefreshHeader" | ||
| 43 | + // 圆形图片 | ||
| 44 | + implementation "de.hdodenhof:circleimageview:$rootProject.circleimageview" | ||
| 45 | + // MagicIndicator | ||
| 46 | + implementation("com.github.SherlockGougou:MagicIndicator:1.6.0") { | ||
| 47 | + exclude group: 'com.android.support' | ||
| 48 | + } | ||
| 49 | + // recyclerview-animators | ||
| 50 | + implementation("jp.wasabeef:recyclerview-animators:$rootProject.recyclerviewAnimators") { | ||
| 51 | + exclude group: 'com.android.support'// 内部引入了27.1.1的appcompat-v7包和support-annotations | ||
| 52 | + } | ||
| 53 | + // 视讯云支付sdk | ||
| 54 | +// implementation 'com.cnlive:lib_cnpay:1.0.9' | ||
| 55 | + // span | ||
| 56 | + api 'com.zrq:spanbuilder:1.0.5' | ||
| 57 | + // 选择的dialog(版本升级了) | ||
| 58 | + api 'com.contrarywind:Android-PickerView:4.1.6' | ||
| 59 | + // shape button | ||
| 60 | + api 'com.github.medyo:fancybuttons:1.9.0' | ||
| 61 | + // 高德定位 | ||
| 62 | + implementation "com.amap.api:location:latest.integration" | ||
| 63 | + // 高德地图3D | ||
| 64 | + api 'com.amap.api:3dmap:6.6.0' | ||
| 65 | + // 搜索功能 | ||
| 66 | + api 'com.amap.api:search:6.5.0.1' | ||
| 67 | + // 轮播图 | ||
| 68 | + api 'com.youth.banner:banner:1.4.10' | ||
| 69 | + // 圆角图片 | ||
| 70 | + implementation 'com.makeramen:roundedimageview:2.3.0' | ||
| 71 | + // 图片选择 | ||
| 72 | + api 'com.cnlive.module:matisse:0.0.1' | ||
| 73 | + // divider | ||
| 74 | + api('com.zrq:divider:1.0.1') { | ||
| 75 | + exclude group: 'com.android.support' | ||
| 76 | + } | ||
| 77 | + // PhotoView | ||
| 78 | + api('com.github.chrisbanes:PhotoView:2.1.4') { | ||
| 79 | + exclude group: 'com.android.support' | ||
| 80 | + } | ||
| 81 | + // DiscreteScrollView | ||
| 82 | + api('com.yarolegovich:discrete-scrollview:1.4.9') { | ||
| 83 | + exclude group: 'com.android.support' | ||
| 84 | + } | ||
| 85 | + // baseAdapter | ||
| 86 | + api "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.42" | ||
| 87 | + // 状态栏 | ||
| 88 | + api "com.jaeger.statusbarutil:library:1.5.1" | ||
| 89 | + // EventBus | ||
| 90 | + api "org.greenrobot:eventbus:3.1.1" | ||
| 91 | + // RxLifecycle | ||
| 92 | + api("com.trello.rxlifecycle2:rxlifecycle:2.2.2") { | ||
| 93 | + exclude module: 'rxjava'// rxJava | ||
| 94 | + } | ||
| 95 | + //没有 | ||
| 96 | + api("com.trello.rxlifecycle2:rxlifecycle-components:2.2.2") { | ||
| 97 | + exclude group: 'com.android.support'// 内部引入了27.1.1的appcompat-v7包和support-annotations | ||
| 98 | + exclude module: 'rxjava'// rxJava | ||
| 99 | + } | ||
| 100 | + // Anko Commons | ||
| 101 | + api "org.jetbrains.anko:anko-commons:0.10.5" | ||
| 102 | + api "org.jetbrains.anko:anko-support-v4-commons:0.10.5"// Support-v4 (only Anko Commons) | ||
| 103 | + // Dagger2 | ||
| 104 | + api "com.google.dagger:dagger:2.16" | ||
| 105 | + annotationProcessor "com.google.dagger:dagger-compiler:2.16" | ||
| 106 | + // dagger-android | ||
| 107 | + api "com.google.dagger:dagger-android:2.16" | ||
| 108 | + api "com.google.dagger:dagger-android-support:2.16" | ||
| 109 | + api("com.cnlive.module:shop:$moduleVersion") { | ||
| 110 | + transitive = false | ||
| 111 | + } | ||
| 112 | + api("com.cnlive.module:base:$moduleVersion") { | ||
| 113 | + transitive = false | ||
| 114 | + } | ||
| 115 | + api("com.cnlive.module:common:$moduleVersion") { | ||
| 116 | + transitive = false | ||
| 117 | + } | ||
| 118 | + api("com.cnlive.module:repast:$moduleVersion") { | ||
| 119 | + transitive = false | ||
| 120 | + } | ||
| 121 | + api("com.cnlive.module:ar:$moduleVersion") { | ||
| 122 | + transitive = false | ||
| 123 | + } | ||
| 124 | + // happy-china | ||
| 125 | + api("com.cnlive.module:happy-china:$moduleVersion") { | ||
| 126 | + transitive = false | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + api("com.cnlive.module:local-life:$moduleVersion") { | ||
| 130 | + transitive = false | ||
| 131 | + } | ||
| 132 | + // ******** 工具 ******** | ||
| 133 | + // kotlin环境 | ||
| 134 | + api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21" | ||
| 135 | + // systembartint | ||
| 136 | + api 'com.readystatesoftware.systembartint:systembartint:1.0.4' | ||
| 137 | + | ||
| 138 | + // 文字垂直滚动 | ||
| 139 | + api 'com.sunfusheng:marqueeview:1.2.0' | ||
| 140 | + // 流式布局 | ||
| 141 | + api 'com.hyman:flowlayout-lib:1.1.2' | ||
| 142 | + // gif //没有 | ||
| 143 | + api 'pl.droidsonroids.gif:android-gif-drawable:1.2.8' | ||
| 144 | + // 网家家支付 | ||
| 145 | + api "com.cnlive.libs:wjjpay:1.0.5" | ||
| 146 | + | ||
| 147 | + api "com.oushangfeng:PinnedSectionItemDecoration:1.3.2" | ||
| 148 | + | ||
| 149 | + // snap | ||
| 150 | + implementation 'com.github.rubensousa:gravitysnaphelper-compat:2.0' | ||
| 151 | + // 模糊 | ||
| 152 | + implementation "com.wonderkiln:blurkit:1.0.0" | ||
| 153 | + // LayoutManager | ||
| 154 | + implementation "com.beloo.widget:ChipsLayoutManager:0.3.7@aar" | ||
| 155 | + | ||
| 156 | + //CNLiveLibs | ||
| 157 | + implementation "com.cnlive.libs:base:1.7.6.18" | ||
| 158 | + implementation "com.cnlive.libs:emoj:$rootProject.libEmoj" | ||
| 159 | + implementation "com.cnlive.libs:noober_menu:$rootProject.libMenu" | ||
| 160 | +// implementation "com.cnlive.libs:arch:$rootProject.appArch" | ||
| 161 | + //七牛上传 | ||
| 162 | + implementation "com.qiniu:qiniu-android-sdk:$rootProject.qiniuAndroidSdk" | ||
| 163 | + // 阴影布局 | ||
| 164 | + api 'com.github.lihangleo2:ShadowLayout:2.0.1' | ||
| 165 | + | ||
| 166 | + api 'com.github.lihangleo2:ShadowLayout:2.0.1' | ||
| 167 | + | ||
| 168 | + api "com.tencent.imsdk:imsdk:$rootProject.imsdk" | ||
| 169 | + | ||
| 170 | + implementation project(path: ':cloud:user') | ||
| 171 | + implementation project(path: ':cloud:app_pay') | ||
| 172 | + implementation project(path: ':module:shanghaishop') | ||
| 173 | + implementation project(path: ':core:base') | ||
| 174 | +} |
module/shopcity/consumer-rules.pro
0 → 100644
module/shopcity/proguard-rules.pro
0 → 100644
| 1 | +# Add project specific ProGuard rules here. | ||
| 2 | +# You can control the set of applied configuration files using the | ||
| 3 | +# proguardFiles setting in build.gradle. | ||
| 4 | +# | ||
| 5 | +# For more details, see | ||
| 6 | +# http://developer.android.com/guide/developing/tools/proguard.html | ||
| 7 | + | ||
| 8 | +# If your project uses WebView with JS, uncomment the following | ||
| 9 | +# and specify the fully qualified class name to the JavaScript interface | ||
| 10 | +# class: | ||
| 11 | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| 12 | +# public *; | ||
| 13 | +#} | ||
| 14 | + | ||
| 15 | +# Uncomment this to preserve the line number information for | ||
| 16 | +# debugging stack traces. | ||
| 17 | +#-keepattributes SourceFile,LineNumberTable | ||
| 18 | + | ||
| 19 | +# If you keep the line number information, uncomment this to | ||
| 20 | +# hide the original source file name. | ||
| 21 | +#-renamesourcefileattribute SourceFile |
module/shopcity/src/androidTest/java/com/clive/happychina/shopcity/ExampleInstrumentedTest.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | ||
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
| 7 | + | ||
| 8 | +import org.junit.Test; | ||
| 9 | +import org.junit.runner.RunWith; | ||
| 10 | + | ||
| 11 | +import static org.junit.Assert.*; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Instrumented test, which will execute on an Android device. | ||
| 15 | + * | ||
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 17 | + */ | ||
| 18 | +@RunWith(AndroidJUnit4.class) | ||
| 19 | +public class ExampleInstrumentedTest { | ||
| 20 | + @Test | ||
| 21 | + public void useAppContext() { | ||
| 22 | + // Context of the app under test. | ||
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
| 24 | + | ||
| 25 | + assertEquals("com.clive.happychina.shopcity.test", appContext.getPackageName()); | ||
| 26 | + } | ||
| 27 | +} |
module/shopcity/src/main/AndroidManifest.xml
0 → 100644
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + package="com.clive.happychina.shopcity" > | ||
| 3 | + | ||
| 4 | + <uses-permission android:name="android.permission.INTERNET" /> | ||
| 5 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 6 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 7 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
| 8 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
| 9 | + | ||
| 10 | + <application | ||
| 11 | + android:allowBackup="true" | ||
| 12 | + android:label="@string/app_name" | ||
| 13 | + android:supportsRtl="true" | ||
| 14 | + android:vmSafeMode="true"> | ||
| 15 | + <activity | ||
| 16 | + android:name=".OrderListShopActivity" | ||
| 17 | + android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | ||
| 18 | + android:screenOrientation="portrait" /> | ||
| 19 | + <activity android:name=".ShopWebActivity"></activity> | ||
| 20 | + </application> | ||
| 21 | + | ||
| 22 | +</manifest> |
module/shopcity/src/main/java/com/clive/happychina/shopcity/OrderListShopActivity.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.graphics.Color; | ||
| 4 | +import android.os.Bundle; | ||
| 5 | + | ||
| 6 | +import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 7 | +import com.cnlive.module.common.utils.SystemBarUtils; | ||
| 8 | +import com.cnlive.module.shop.ui.fragment.OrderListFragment; | ||
| 9 | + | ||
| 10 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 11 | + | ||
| 12 | +public class OrderListShopActivity extends AppCompatActivity { | ||
| 13 | + | ||
| 14 | + @Override | ||
| 15 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 16 | + super.onCreate(savedInstanceState); | ||
| 17 | + setContentView(R.layout.activity_order_list_shop); | ||
| 18 | + SystemBarUtils.setStatusBarColor(this, Color.WHITE); | ||
| 19 | + StatusBarUtil.setStatusBarWrite(this); | ||
| 20 | + getSupportFragmentManager().beginTransaction().add(R.id.containers, new OrderListFragment()).commit(); | ||
| 21 | + } | ||
| 22 | +} |
module/shopcity/src/main/java/com/clive/happychina/shopcity/ShopServiceImpl.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.net.Uri; | ||
| 7 | +import android.text.TextUtils; | ||
| 8 | + | ||
| 9 | +import com.alibaba.android.arouter.facade.annotation.Route; | ||
| 10 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 11 | +import com.cnlive.cloud.user.auth.UserService; | ||
| 12 | +import com.cnlive.libs.base.application.AppConfig; | ||
| 13 | +import com.cnlive.libs.base.arouter.user.OpenUserService; | ||
| 14 | +import com.cnlive.module.common.router.ShopService; | ||
| 15 | +import com.cnlive.strike.pay.IPay; | ||
| 16 | + | ||
| 17 | +import org.jetbrains.annotations.NotNull; | ||
| 18 | + | ||
| 19 | +import androidx.annotation.Nullable; | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * 描述: | ||
| 24 | + * | ||
| 25 | + * @author zhangrq | ||
| 26 | + * 2018/10/23 11:27 | ||
| 27 | + */ | ||
| 28 | +@Route(path = "/service/shop") | ||
| 29 | +public class ShopServiceImpl implements ShopService { | ||
| 30 | + private Context context; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public void init(Context context) { | ||
| 34 | + this.context = context; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Nullable | ||
| 38 | + @Override | ||
| 39 | + public String getUid() { | ||
| 40 | + // TODO 传入你们的用户id,可以传null | ||
| 41 | + if(context == null || UserService.getUid(context) == null) return null; | ||
| 42 | + return UserService.getUid(context); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Nullable | ||
| 46 | + @Override | ||
| 47 | + public String getAccount(int payType) { | ||
| 48 | + // TODO 传入你们支付时用的Account | ||
| 49 | + if (payType == IPay.PAY_TYPE_ALI) { | ||
| 50 | + // 支付宝 | ||
| 51 | + return ""; | ||
| 52 | + } else if (payType == IPay.PAY_TYPE_WX) { | ||
| 53 | + // 微信 | ||
| 54 | + // TODO 改成正式Account | ||
| 55 | + return AppConfig.getPayAccount(); | ||
| 56 | + } else if (payType == IPay.PAY_TYPE_UNION) { | ||
| 57 | + // 银联 | ||
| 58 | + return "ztyl"; | ||
| 59 | + } | ||
| 60 | + return ""; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public void jumpToScanActivity(Activity activity, int i) { | ||
| 65 | + // TODO 跳到扫码页面,这个目前没对接不用处理 | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean checkUserLogin(@NotNull Context context) { | ||
| 70 | + OpenUserService service = (OpenUserService) ARouter.getInstance().build("/cnCheckUser/cnCheckUserService").navigation(context); | ||
| 71 | + if (service != null) { | ||
| 72 | + return service.userHasLogin(UserService.getUid(context)); | ||
| 73 | + } | ||
| 74 | + return !TextUtils.isEmpty(UserService.getUid(context)); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public void jumpToActivityByUri(@NotNull Activity activity, @NotNull Uri uri) { | ||
| 79 | + //web页面直接跳转点播视频等 | ||
| 80 | +// UriJump.jumpToView(activity, uri); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public void jumpToHQYWShopHomeActivity(@NotNull Activity activity) { | ||
| 85 | + //跳转环球优物 ---商城首页 | ||
| 86 | + Intent intent = new Intent(activity, cn.cnlive.b2c.MainActivity.class); | ||
| 87 | + activity.startActivity(intent); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public void jumpWJJLoginProcess(@NotNull Activity activity, @NotNull String s) { | ||
| 92 | + //检测是否登录并跳转 | ||
| 93 | + OpenUserService service = (OpenUserService) ARouter.getInstance().build("/cnCheckUser/cnCheckUserService").navigation(context); | ||
| 94 | + if (service != null) { | ||
| 95 | + service.userHasLogin(UserService.getUid(context), s, false); | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | +} |
module/shopcity/src/main/java/com/clive/happychina/shopcity/ShopWebActivity.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.os.Bundle; | ||
| 6 | + | ||
| 7 | +import com.alibaba.android.arouter.facade.annotation.Route; | ||
| 8 | +import com.cnlive.module.common.utils.JumpToActivityUtils; | ||
| 9 | + | ||
| 10 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 11 | + | ||
| 12 | +@Route(path = "/cnshopCity/ShopWebActivity") | ||
| 13 | +public class ShopWebActivity extends AppCompatActivity { | ||
| 14 | + | ||
| 15 | + public static void startActivity(Context context,String type,String to,String shop_type) { | ||
| 16 | + Intent intent = new Intent(context, ShopWebActivity.class); | ||
| 17 | + intent.putExtra("type",type); | ||
| 18 | + intent.putExtra("to",to); | ||
| 19 | + intent.putExtra("shop_type",shop_type); | ||
| 20 | + context.startActivity(intent); | ||
| 21 | + } | ||
| 22 | + @Override | ||
| 23 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 24 | + super.onCreate(savedInstanceState); | ||
| 25 | + setContentView(R.layout.activity_shop_web); | ||
| 26 | + Intent intent = getIntent(); | ||
| 27 | + JumpToActivityUtils.jumpToActivityByType(this, | ||
| 28 | + intent.getStringExtra("type"), intent.getStringExtra("to"), intent.getStringExtra("shop_type")); | ||
| 29 | + finish(); | ||
| 30 | + } | ||
| 31 | +} |
module/shopcity/src/main/res/layout/activity_order_list_shop.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + android:orientation="vertical" | ||
| 8 | + tools:context="com.clive.happychina.shopcity.OrderListShopActivity"> | ||
| 9 | + | ||
| 10 | + <com.cnlive.module.base.widgets.HeaderBar | ||
| 11 | + android:layout_width="match_parent" | ||
| 12 | + android:layout_height="48dp" | ||
| 13 | + app:titleText="我的订单" /> | ||
| 14 | + | ||
| 15 | + <View style="@style/horizontallLine" /> | ||
| 16 | + | ||
| 17 | + <FrameLayout | ||
| 18 | + android:id="@+id/containers" | ||
| 19 | + android:layout_width="match_parent" | ||
| 20 | + android:layout_height="match_parent" | ||
| 21 | + android:background="@color/white" /> | ||
| 22 | +</LinearLayout> |
module/shopcity/src/main/res/layout/activity_shop_web.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + tools:context="com.clive.happychina.shopcity.ShopWebActivity"> | ||
| 8 | + | ||
| 9 | +</android.support.constraint.ConstraintLayout> |
module/shopcity/src/main/res/values/strings.xml
0 → 100644
module/shopcity/src/test/java/com/clive/happychina/shopcity/ExampleUnitTest.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import org.junit.Test; | ||
| 4 | + | ||
| 5 | +import static org.junit.Assert.*; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Example local unit test, which will execute on the development machine (host). | ||
| 9 | + * | ||
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 11 | + */ | ||
| 12 | +public class ExampleUnitTest { | ||
| 13 | + @Test | ||
| 14 | + public void addition_isCorrect() { | ||
| 15 | + assertEquals(4, 2 + 2); | ||
| 16 | + } | ||
| 17 | +} | ||
| 0 | \ No newline at end of file | 18 | \ No newline at end of file |
settings.gradle
| 1 | include ':app:strike' | 1 | include ':app:strike' |
| 2 | //基础库 | 2 | //基础库 |
| 3 | include ':core:base',':core:network',':core:imageload' ,':core:app_qr',':core:database' | 3 | include ':core:base',':core:network',':core:imageload' ,':core:app_qr',':core:database' |
| 4 | -include ':cloud:user',':cloud:pay',':cloud:third_tool',':cloud:video' | ||
| 5 | -include ':module:xiaojiasoundbox',':module:pedometer',':module:shanghaishop' | 4 | +include ':cloud:user',':cloud:pay',':cloud:third_tool',':cloud:video',':cloud:app_pay' |
| 5 | +include ':module:xiaojiasoundbox',':module:pedometer',':module:shanghaishop',':module:shopcity' | ||
| 6 | include ':library_baidumap' | 6 | include ':library_baidumap' |
| 7 | rootProject.name='ModuleStrike' | 7 | rootProject.name='ModuleStrike' |