android+wifi+bridge,Android接入说明

Android接入说明

Android商户APP端前期准备

1.获取到统一SDK aar包.并放入android项目libs文件夹内(拷贝或者覆盖包时,请clean工程和重新build)

2.项目gradle配置SDK aar包,配置如下:

APP Gradle增加如下配置:

//向上兼容android系统

compileSdkVersion 26

defaultConfig {

}

repositories {

flatDir {

dirs 'libs'

}

}

//支付SDK

dependencies {

compile 'com.android.support:appcompat-v7:26.0.0'

compile(name: 'open-sdk-release-1.0.2', ext: 'aar') //支付AAR名称

}

3.AndroidMainfest.xml注册如下Activity:

支付结果回调:在AndroidMainfest.xml中com.xxx.PayResultActivity为接收支付回调的Activity,添加如下配置:

android:host="open"

android:path="/payResult"

android:scheme="allinone" />

快速集成

第一步:在SDK调用之前初始化SDK,建议将此代码放在Application中进行初始化。

接入统一SDK的商户需要初始化参数:WalletParms

字段名

变量

必填

类型

示例值

描述

uhid

用户唯一标识

String

dhid

String

sessionId

会话ID

String

telNo

手机号码

String

用户手机号码

userToken

用户token

String

longi

经度

String

用户经度

lati

维度

String

用户维度

mapSP

地图

String

b 百度 t 腾讯 a 高德 g google l 老虎

wifiPubChannel

发布渠道

String

wifiVersion

版本号

String

appId

appid

String

lxDex

开发环境

String

unionid

unionId

String

商户透传过来

保留字段,不传的话默认为""

platformName

商户名称

String

WIFI或者LIANXIN或者OPENSDK

一般为商户接入的大写字母例如:(WIFI/LIANXIN)

environmentBranch

环境

String

0:生产环境 1:测试环境 2:验证环境

deviceId

设备ID号

String

通过手机API获取

openId

开放ID

String

商户透传过来

保留字段,不传的话默认为""

merchantId

商户号

String

商户初始化透传

初始化字段:

platformName、environmentBranch、appId

示例代码:

WalletParams params = new WalletParams();

params.platformName = "OPENSDK";//接入平台:枚举值:WIFI 或LIANXIN 或OPENSDK,第三方请填OPENSDK

params.environmentBranch = 2;//服务器环境,0生成环境 1验证环境 2测试环境

params.appId="merchant01";//必填

params.merchantId="mer01";//必填 商户号

//其余选填

params.openId = "wifiopenId";//openId 选填

params.unionid = "wifiunionId";//unionid 选填

//.....其他要求必填字段,详情请参照WalletParms参数

WalletApi.getInstance().init(this, params);

第二步:发起支付,参数获取请参考API列表

PreOrderRespone字段说明(商户预收单数据返回)

字段名

变量

必填

类型

示例值

描述

appId

appId

String

ext

扩展信息

String

扩展信息

isRedpacket

是否是发红包

String

"true" or "false"

"true"发红包"false"支付

mchId

商户id

String

mPackage

需要接收支付回调APP应用包名

String

nonceStr

随机字符串

String

payResult

快应用支付结果页URL

String

快引用回调url

prepayId

预收单id

String

scheme

支付回调结果页面scheme

String

sign

验签

String

封装方法参考"唤起收银台参数封装代码示例"

signType

签名方法

String

RSA

RSA

timestamp

时间戳

String

10位时间戳

10位时间戳

tradeType

交易类型

String

APP

唤起收银台参数封装代码示例

/**

* mRespone 商户预收单返回参数。定义为PreOrderRespone

* 注意:发起支付前请确保初始化了sdk,初始化请往上翻

*/

PayTool.getInstance().startPay(this, mRespone);

以下功能选接:

启动账单页面

WalletApi.getInstance().init(this, params);

Intent intent = new Intent(Constants.UNIFIED_BILL_ACTION);

intent.setPackage(this.getPackageName());//第三方应用包名,下同

startActivity(intent);

启动零钱页面

WalletApi.getInstance().init(this, params);

Intent intent = new Intent(Constants.UNIFIED_REMAIN_ACTION);

intent.setPackage(this.getPackageName());

startActivity(intent);

启动首页

WalletApi.getInstance().init(this, params);

Intent intent = new Intent(Constants.UNIFIED_HOME_ACTION);

intent.setPackage(this.getPackageName());

startActivity(intent);

清除登录信息

WalletApi.delThirdToken(this);

清除栈

WalletApi.finishAllActivity();

在支付结果Activity的oncreate()和onNewIntent()中获取支付结果

private void getPayResult(){

if (getIntent() != null && getIntent().getExtras() != null) {

String what = (String) getIntent().getExtras().get("what");

int retcode = getIntent().getExtras().get("retcode");

String remsg = (String) getIntent().getExtras().get("retmsg");

String data = (String) getIntent().getExtras().get("data");

if (StringUtils.isEmpty(what)) return;

Toast.makeText(this, "what:" + what +"retcode:" + retcode + "remsg:" + remsg +"data:" + data, Toast.LENGTH_LONG).show();

}

}

代码混淆

##### openSDK支付,混淆start,建议放置到APP的混淆文件中,以防出现位置的错误######

-keepclassmembers class com.wifipay.wallet.home.net.dto.SPJSBridge {

public *;

}

#不混淆org.apache.http.legacy.jar

-dontwarn android.net.compatibility.**

-dontwarn android.net.http.**

-dontwarn com.android.internal.http.multipart.**

-dontwarn org.apache.commons.**

-dontwarn org.apache.http.**

-keep class android.net.compatibility.**{*;}

-keep class android.net.http.**{*;}

-keep class com.android.internal.http.multipart.**{*;}

-keep class org.apache.commons.**{*;}

-keep class org.apache.http.**{*;}

#all 快捷方式

-keep public class com.wifipay.wallet.home.shortcut.ShortcutEntrance{*;}

-dontwarn com.wifipay.wallet.home.shortcut.ShortcutEntrance.**

#end alipay

#-keep class com.sdpopen.wallet.**{*;}

#-keep class com.sdpopen.wallet.analysis_tool.**{*;}

-keep class com.sdpopen.wallet.bank.manager.model.**{*;}

#-keep class com.sdpopen.wallet.bankmanager.**{*;}

#-keep class com.sdpopen.wallet.common.**{*;}

-keep class com.sdpopen.wallet.common.dns.WifiPayHttpDNSManager{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.eventbus.**{*;}

#-keep class com.sdpopen.wallet.common.walletsdk_common.eventbus.ThreadMode{*;}

#-keep class com.sdpopen.wallet.common.walletsdk_common.eventbus.Subscribe{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.common.**{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.utils.**{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.bean.**{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.callback.**{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.login.**{*;}

-keep class com.sdpopen.wallet.common.walletsdk_common.**

-keep class com.sdpopen.wallet.compliance.**{*;}

#-keep class com.sdpopen.wallet.component_charge_transfer_withdraw.**{*;}

-keep class com.sdpopen.wallet.pay.wallet.**{*;}

#-keep class com.sdpopen.wallet.wallet_home.**{*;}

#-keep class com.sdpopen.wallet.walletsdk_component.bill.**{*;}

-keep class com.shengpay.crypto.**{*;}

-keep class com.shengpay.json.**{*;}

-keep class com.shengpay.json.internal.**{*;}

-keep class com.shengpay.json.reflect.**{*;}

-keep class com.shengpay.json.stream.**{*;}

-keep class com.wifipay.common.security.**{*;}

-keep class com.shengpay.tool.**{*;}

-keep class com.sdpopen.wallet.BuildConfig{*;}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值