Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
e45c60df
Commit
e45c60df
authored
Aug 23, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增确认订单相关接口数据
parent
e50bd167
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
500 additions
and
0 deletions
+500
-0
CreateOrderDto.kt
...java/com/yidian/shenghuoquan/border/dto/CreateOrderDto.kt
+55
-0
OrderConfirmDto.kt
...ava/com/yidian/shenghuoquan/border/dto/OrderConfirmDto.kt
+97
-0
OrderPayDto.kt
...in/java/com/yidian/shenghuoquan/border/dto/OrderPayDto.kt
+248
-0
OrderApiService.kt
...va/com/yidian/shenghuoquan/border/http/OrderApiService.kt
+34
-0
OrderRemoteDataSource.kt
.../yidian/shenghuoquan/border/http/OrderRemoteDataSource.kt
+66
-0
No files found.
Components/BOrder/src/main/java/com/yidian/shenghuoquan/border/dto/CreateOrderDto.kt
0 → 100644
View file @
e45c60df
package
com.yidian.shenghuoquan.border.dto
import
android.os.Parcelable
import
com.google.gson.annotations.SerializedName
import
kotlinx.parcelize.Parcelize
/**
* 创建订单请求参数
*/
data class
CreateOrderReqDto
(
@SerializedName
(
"business_from"
)
val
businessFrom
:
Int
?
=
null
,
// 订单业务线--- 1 普通订单,2接龙订单
@SerializedName
(
"coupon_list"
)
val
couponList
:
List
<
SelectedCoupon
>?
=
null
,
// 优惠券数组
@SerializedName
(
"goods_list"
)
val
goodsList
:
List
<
OrderGoods
>?
=
null
,
// 商品数组
@SerializedName
(
"user_id"
)
val
userId
:
Long
?
=
null
// 用户ID
)
/**
* 选中的优惠券
*/
data class
SelectedCoupon
(
@SerializedName
(
"coupon_amount"
)
val
couponAmount
:
Double
?
=
null
,
// 优惠券金额
@SerializedName
(
"coupon_id"
)
val
couponId
:
Int
?
=
null
// 优惠卷id
)
/**
* 订单商品
*/
data class
OrderGoods
(
@SerializedName
(
"goods_sku_id"
)
val
goodsSkuId
:
String
?
=
null
,
// 商品id
@SerializedName
(
"goods_sku_num"
)
val
goodsSkuNum
:
Int
?
=
null
,
// 商品数量
@SerializedName
(
"marketing_id"
)
val
marketingId
:
Int
?
=
null
,
// 活动id
@SerializedName
(
"marketing_type"
)
val
marketingType
:
Int
?
=
null
// 活动类型 类型:1分销 2团购 3秒杀,4 团餐
)
/**
* 创建订单响应参数
*/
@Parcelize
data class
CreateOrderResDto
(
@SerializedName
(
"order_id"
)
val
orderId
:
String
?
=
null
,
// 订单号
@SerializedName
(
"payment"
)
val
payment
:
Int
?
=
null
,
// 是否零元单,1:是0元单,0:不是0元单
)
:
Parcelable
Components/BOrder/src/main/java/com/yidian/shenghuoquan/border/dto/OrderConfirmDto.kt
0 → 100644
View file @
e45c60df
package
com.yidian.shenghuoquan.border.dto
import
android.os.Parcelable
import
com.google.gson.annotations.SerializedName
import
kotlinx.parcelize.Parcelize
@Parcelize
data class
OrderConfirmResDto
(
@SerializedName
(
"coupon_list"
)
val
couponList
:
List
<
CouponList
>?
=
null
,
@SerializedName
(
"goods_list"
)
val
goodsList
:
List
<
GoodsList
>?
=
null
,
// @SerializedName("price")
// val price: Int? = null,
@SerializedName
(
"shipping"
)
val
shipping
:
Shipping
?
=
null
,
@SerializedName
(
"take_place_list"
)
val
takePlaceList
:
List
<
TakePlaceList
>?
=
null
)
:
Parcelable
@Parcelize
data class
CouponList
(
@SerializedName
(
"amount"
)
val
amount
:
String
?
=
null
,
// 优惠券金额
@SerializedName
(
"desc"
)
val
desc
:
String
?
=
null
,
@SerializedName
(
"end_time"
)
val
endTime
:
String
?
=
null
,
// 有效期结束时间
@SerializedName
(
"id"
)
val
id
:
String
?
=
null
,
// 优惠券id
@SerializedName
(
"jump_url"
)
val
jumpUrl
:
String
?
=
null
,
@SerializedName
(
"name"
)
val
name
:
String
?
=
null
,
// 优惠券名称
@SerializedName
(
"start_time"
)
val
startTime
:
String
?
=
null
,
// 有效期开始时间
@SerializedName
(
"status"
)
val
status
:
Int
?
=
null
,
@SerializedName
(
"thumbnail"
)
val
thumbnail
:
String
?
=
null
,
@SerializedName
(
"type"
)
val
type
:
Int
?
=
null
,
@SerializedName
(
"use_activity_type"
)
val
useActivityType
:
Int
?
=
null
,
@SerializedName
(
"use_amount_min"
)
val
useAmountMin
:
Int
?
=
null
,
@SerializedName
(
"use_amount_type"
)
val
useAmountType
:
Int
?
=
null
,
@SerializedName
(
"use_shop_type"
)
val
useShopType
:
Int
?
=
null
)
:
Parcelable
/**
* 商品列表
*/
@Parcelize
data class
GoodsList
(
@SerializedName
(
"name"
)
val
name
:
String
?
=
null
,
)
:
Parcelable
/**
* 发货相关
*/
@Parcelize
data class
Shipping
(
@SerializedName
(
"create_time"
)
val
createTime
:
String
?
=
null
,
@SerializedName
(
"order_id"
)
val
orderId
:
String
?
=
null
,
// 订单id
@SerializedName
(
"receiver_address"
)
val
receiverAddress
:
String
?
=
null
,
// 收获地址
@SerializedName
(
"receiver_mobile"
)
val
receiverMobile
:
String
?
=
null
,
// 收货人手机号
@SerializedName
(
"receiver_name"
)
val
receiverName
:
String
?
=
null
,
// 收货人姓名
@SerializedName
(
"shipping_id"
)
val
shippingId
:
String
?
=
null
,
@SerializedName
(
"take_place_id"
)
val
takePlaceId
:
Int
?
=
null
,
@SerializedName
(
"update_time"
)
val
updateTime
:
String
?
=
null
,
@SerializedName
(
"user_id"
)
val
userId
:
String
?
=
null
)
:
Parcelable
/**
* 自提点列表
*/
@Parcelize
data class
TakePlaceList
(
@SerializedName
(
"take_place_id"
)
val
takePlaceId
:
Int
?
=
null
,
// 自提点id
@SerializedName
(
"take_place_name"
)
val
takePlaceName
:
String
?
=
null
,
// 自提点名称
)
:
Parcelable
Components/BOrder/src/main/java/com/yidian/shenghuoquan/border/dto/OrderPayDto.kt
0 → 100644
View file @
e45c60df
package
com.yidian.shenghuoquan.border.dto
import
com.google.gson.annotations.SerializedName
/**
* 订单支付请求参数
*/
data class
OrderPayReqDto
(
@SerializedName
(
"user_id"
)
val
userId
:
String
?
=
null
,
// 用户id
@SerializedName
(
"appid"
)
val
appId
:
String
?
=
null
,
// 应用id:"merchant-c"
@SerializedName
(
"order_id"
)
val
orderId
:
String
?
=
null
,
// 订单号
@SerializedName
(
"pay_method_id"
)
val
payMethodId
:
Int
?
=
null
,
// 支付方式id: 101:支付宝,102:微信支付
)
/**
* 订单支付响应
*/
data class
OrderPayResDto
(
@SerializedName
(
"result"
)
val
result
:
List
<
Result
>?
=
null
)
data class
Result
(
@SerializedName
(
"k"
)
val
k
:
String
?
=
null
,
@SerializedName
(
"v"
)
val
v
:
V
?
=
null
)
data class
V
(
@SerializedName
(
"actual_amount"
)
val
actualAmount
:
Int
?
=
null
,
@SerializedName
(
"amount"
)
val
amount
:
Int
?
=
null
,
@SerializedName
(
"amount_paid"
)
val
amountPaid
:
Int
?
=
null
,
@SerializedName
(
"amount_refunded"
)
val
amountRefunded
:
Int
?
=
null
,
@SerializedName
(
"app"
)
val
app
:
String
?
=
null
,
@SerializedName
(
"available_balance"
)
val
availableBalance
:
Int
?
=
null
,
@SerializedName
(
"available_methods"
)
val
availableMethods
:
List
<
String
>?
=
null
,
@SerializedName
(
"body"
)
val
body
:
String
?
=
null
,
@SerializedName
(
"charge"
)
val
charge
:
String
?
=
null
,
@SerializedName
(
"charge_essentials"
)
val
chargeEssentials
:
ChargeEssentials
?
=
null
,
@SerializedName
(
"charges"
)
val
charges
:
Charges
?
=
null
,
@SerializedName
(
"client_ip"
)
val
clientIp
:
String
?
=
null
,
@SerializedName
(
"coupon"
)
val
coupon
:
Any
?
=
null
,
@SerializedName
(
"coupon_amount"
)
val
couponAmount
:
Int
?
=
null
,
@SerializedName
(
"created"
)
val
created
:
Int
?
=
null
,
@SerializedName
(
"currency"
)
val
currency
:
String
?
=
null
,
@SerializedName
(
"description"
)
val
description
:
Any
?
=
null
,
@SerializedName
(
"id"
)
val
id
:
String
?
=
null
,
@SerializedName
(
"livemode"
)
val
livemode
:
Boolean
?
=
null
,
@SerializedName
(
"merchant_order_no"
)
val
merchantOrderNo
:
String
?
=
null
,
@SerializedName
(
"metadata"
)
val
metadata
:
MetadataX
?
=
null
,
@SerializedName
(
"object"
)
val
objectX
:
String
?
=
null
,
@SerializedName
(
"paid"
)
val
paid
:
Boolean
?
=
null
,
@SerializedName
(
"receipt_app"
)
val
receiptApp
:
String
?
=
null
,
@SerializedName
(
"refunded"
)
val
refunded
:
Boolean
?
=
null
,
@SerializedName
(
"service_app"
)
val
serviceApp
:
String
?
=
null
,
@SerializedName
(
"status"
)
val
status
:
String
?
=
null
,
@SerializedName
(
"subject"
)
val
subject
:
String
?
=
null
,
@SerializedName
(
"time_expire"
)
val
timeExpire
:
Int
?
=
null
,
@SerializedName
(
"time_paid"
)
val
timePaid
:
Any
?
=
null
,
@SerializedName
(
"uid"
)
val
uid
:
String
?
=
null
)
data class
ChargeEssentials
(
@SerializedName
(
"channel"
)
val
channel
:
String
?
=
null
,
@SerializedName
(
"credential"
)
val
credential
:
Credential
?
=
null
,
@SerializedName
(
"extra"
)
val
extra
:
List
<
Any
>?
=
null
,
@SerializedName
(
"failure_code"
)
val
failureCode
:
Any
?
=
null
,
@SerializedName
(
"failure_msg"
)
val
failureMsg
:
Any
?
=
null
,
@SerializedName
(
"transaction_no"
)
val
transactionNo
:
Any
?
=
null
)
data class
Charges
(
@SerializedName
(
"data"
)
val
data
:
List
<
Data
>?
=
null
,
@SerializedName
(
"has_more"
)
val
hasMore
:
Boolean
?
=
null
,
@SerializedName
(
"object"
)
val
objectX
:
String
?
=
null
,
@SerializedName
(
"url"
)
val
url
:
String
?
=
null
)
data class
MetadataX
(
@SerializedName
(
"goods_sku_id"
)
val
goodsSkuId
:
List
<
String
>?
=
null
,
@SerializedName
(
"order_id"
)
val
orderId
:
String
?
=
null
,
@SerializedName
(
"order_item_id"
)
val
orderItemId
:
List
<
String
>?
=
null
)
data class
Credential
(
@SerializedName
(
"object"
)
val
objectX
:
String
?
=
null
,
@SerializedName
(
"wx"
)
val
wx
:
Wx
?
=
null
)
data class
Wx
(
@SerializedName
(
"appId"
)
val
appId
:
String
?
=
null
,
@SerializedName
(
"nonceStr"
)
val
nonceStr
:
String
?
=
null
,
@SerializedName
(
"packageValue"
)
val
packageValue
:
String
?
=
null
,
@SerializedName
(
"partnerId"
)
val
partnerId
:
String
?
=
null
,
@SerializedName
(
"prepayId"
)
val
prepayId
:
String
?
=
null
,
@SerializedName
(
"sign"
)
val
sign
:
String
?
=
null
,
@SerializedName
(
"timeStamp"
)
val
timeStamp
:
Int
?
=
null
)
data class
Data
(
@SerializedName
(
"amount"
)
val
amount
:
Int
?
=
null
,
@SerializedName
(
"amount_refunded"
)
val
amountRefunded
:
Int
?
=
null
,
@SerializedName
(
"amount_settle"
)
val
amountSettle
:
Int
?
=
null
,
@SerializedName
(
"app"
)
val
app
:
String
?
=
null
,
@SerializedName
(
"body"
)
val
body
:
String
?
=
null
,
@SerializedName
(
"channel"
)
val
channel
:
String
?
=
null
,
@SerializedName
(
"client_ip"
)
val
clientIp
:
String
?
=
null
,
@SerializedName
(
"created"
)
val
created
:
Int
?
=
null
,
@SerializedName
(
"credential"
)
val
credential
:
CredentialX
?
=
null
,
@SerializedName
(
"currency"
)
val
currency
:
String
?
=
null
,
@SerializedName
(
"description"
)
val
description
:
Any
?
=
null
,
@SerializedName
(
"extra"
)
val
extra
:
List
<
Any
>?
=
null
,
@SerializedName
(
"failure_code"
)
val
failureCode
:
Any
?
=
null
,
@SerializedName
(
"failure_msg"
)
val
failureMsg
:
Any
?
=
null
,
@SerializedName
(
"id"
)
val
id
:
String
?
=
null
,
@SerializedName
(
"livemode"
)
val
livemode
:
Boolean
?
=
null
,
@SerializedName
(
"metadata"
)
val
metadata
:
Metadata
?
=
null
,
@SerializedName
(
"object"
)
val
objectX
:
String
?
=
null
,
@SerializedName
(
"order_no"
)
val
orderNo
:
String
?
=
null
,
@SerializedName
(
"paid"
)
val
paid
:
Boolean
?
=
null
,
@SerializedName
(
"refunded"
)
val
refunded
:
Boolean
?
=
null
,
@SerializedName
(
"refunds"
)
val
refunds
:
Any
?
=
null
,
@SerializedName
(
"reversed"
)
val
reversed
:
Boolean
?
=
null
,
@SerializedName
(
"subject"
)
val
subject
:
String
?
=
null
,
@SerializedName
(
"time_expire"
)
val
timeExpire
:
Int
?
=
null
,
@SerializedName
(
"time_paid"
)
val
timePaid
:
Any
?
=
null
,
@SerializedName
(
"time_settle"
)
val
timeSettle
:
Any
?
=
null
,
@SerializedName
(
"transaction_no"
)
val
transactionNo
:
Any
?
=
null
)
data class
CredentialX
(
@SerializedName
(
"object"
)
val
objectX
:
String
?
=
null
,
@SerializedName
(
"wx"
)
val
wx
:
WxX
?
=
null
)
data class
Metadata
(
@SerializedName
(
"goods_sku_id"
)
val
goodsSkuId
:
List
<
String
>?
=
null
,
@SerializedName
(
"order_id"
)
val
orderId
:
String
?
=
null
,
@SerializedName
(
"order_item_id"
)
val
orderItemId
:
List
<
String
>?
=
null
)
data class
WxX
(
@SerializedName
(
"appId"
)
val
appId
:
String
?
=
null
,
@SerializedName
(
"nonceStr"
)
val
nonceStr
:
String
?
=
null
,
@SerializedName
(
"packageValue"
)
val
packageValue
:
String
?
=
null
,
@SerializedName
(
"partnerId"
)
val
partnerId
:
String
?
=
null
,
@SerializedName
(
"prepayId"
)
val
prepayId
:
String
?
=
null
,
@SerializedName
(
"sign"
)
val
sign
:
String
?
=
null
,
@SerializedName
(
"timeStamp"
)
val
timeStamp
:
Int
?
=
null
)
Components/BOrder/src/main/java/com/yidian/shenghuoquan/border/http/OrderApiService.kt
View file @
e45c60df
...
...
@@ -16,6 +16,9 @@ interface OrderApiService {
private
companion
object
{
const
val
getOrderDetail
=
"/order/order/order_info"
const
val
applyRefund
=
"/order/order/refund_apply"
const
val
orderConfirm
=
"/order/order/order_confirm_page"
const
val
createOrder
=
"/order/order/create"
const
val
orderPay
=
"/pay/order/pay"
}
/**
...
...
@@ -37,4 +40,35 @@ interface OrderApiService {
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@QueryMap
requestParams
:
Map
<
String
,
String
?
>
):
Observable
<
HttpResult
<
Any
?
>>
/**
* 2013 获取订单确认页
*/
@POST
(
orderConfirm
)
@Headers
(
"Content-Type: application/json"
)
fun
requestOrderConfirm
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@QueryMap
requestParams
:
Map
<
String
,
String
?
>
):
Observable
<
HttpResult
<
Any
?
>>
/**
* 2004 创建订单
*/
@POST
(
createOrder
)
@Headers
(
"Content-Type: application/json"
)
fun
requestCreateOrder
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@QueryMap
requestParams
:
Map
<
String
,
String
?
>
):
Observable
<
HttpResult
<
Any
?
>>
/**
* 7014 订单支付
*/
@POST
(
orderPay
)
@Headers
(
"Content-Type: application/json"
)
fun
requestOrderPay
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@QueryMap
requestParams
:
Map
<
String
,
String
?
>
):
Observable
<
HttpResult
<
Any
?
>>
}
Components/BOrder/src/main/java/com/yidian/shenghuoquan/border/http/OrderRemoteDataSource.kt
View file @
e45c60df
...
...
@@ -5,7 +5,10 @@ import com.yidian.bcommon.http.HttpResult
import
com.yidian.bcommon.http.HttpResultSubscriber
import
com.yidian.bcommon.http.TransformUtil
import
com.yidian.http.ServiceFactory
import
com.yidian.shenghuoquan.border.dto.CreateOrderResDto
import
com.yidian.shenghuoquan.border.dto.OrderConfirmResDto
import
com.yidian.shenghuoquan.border.dto.OrderDetailDto
import
com.yidian.shenghuoquan.border.dto.OrderPayResDto
import
com.yidian.shenghuoquan.border.http.callback.IApplyRefundCallback
import
com.yidian.shenghuoquan.border.http.callback.IGetOrderDetailCallback
...
...
@@ -57,4 +60,67 @@ object OrderRemoteDataSource {
}
})
}
/**
* 获取确认订单
*/
fun
requestOrderConfirm
(
requestParams
:
HashMap
<
String
,
String
?
>,
callback
:
((
OrderConfirmResDto
?)
->
Unit
)?
=
null
)
{
val
timeStamp
=
System
.
currentTimeMillis
()
val
publicParamsMap
=
HttpParamsUtils
.
getPublicParamsMap
(
timeStamp
)
val
privateParamsMap
=
HttpParamsUtils
.
getPrivateParamsMap
(
requestParams
,
timeStamp
)
ServiceFactory
.
getInstance
().
createService
(
OrderApiService
::
class
.
java
)
.
requestOrderConfirm
(
publicParamsMap
,
privateParamsMap
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultSubscriber
<
OrderConfirmResDto
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
OrderConfirmResDto
?
>?)
{
callback
?.
invoke
(
result
?.
result
)
}
override
fun
onFailure
(
result
:
HttpResult
<
OrderConfirmResDto
?
>?)
{
}
})
}
/**
* 创建订单
*/
fun
requestCreateOrder
(
requestParams
:
HashMap
<
String
,
String
?
>,
callback
:
((
CreateOrderResDto
?)
->
Unit
)?
=
null
)
{
val
timeStamp
=
System
.
currentTimeMillis
()
val
publicParamsMap
=
HttpParamsUtils
.
getPublicParamsMap
(
timeStamp
)
val
privateParamsMap
=
HttpParamsUtils
.
getPrivateParamsMap
(
requestParams
,
timeStamp
)
ServiceFactory
.
getInstance
().
createService
(
OrderApiService
::
class
.
java
)
.
requestOrderPay
(
publicParamsMap
,
privateParamsMap
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultSubscriber
<
CreateOrderResDto
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
CreateOrderResDto
?
>?)
{
callback
?.
invoke
(
result
?.
result
)
}
override
fun
onFailure
(
result
:
HttpResult
<
CreateOrderResDto
?
>?)
{
}
})
}
/**
* 支付订单
*/
fun
requestPayOrder
(
requestParams
:
HashMap
<
String
,
String
?
>,
callback
:
((
OrderPayResDto
?)
->
Unit
)?
=
null
)
{
val
timeStamp
=
System
.
currentTimeMillis
()
val
publicParamsMap
=
HttpParamsUtils
.
getPublicParamsMap
(
timeStamp
)
val
privateParamsMap
=
HttpParamsUtils
.
getPrivateParamsMap
(
requestParams
,
timeStamp
)
ServiceFactory
.
getInstance
().
createService
(
OrderApiService
::
class
.
java
)
.
requestOrderPay
(
publicParamsMap
,
privateParamsMap
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultSubscriber
<
OrderPayResDto
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
OrderPayResDto
?
>?)
{
callback
?.
invoke
(
result
?.
result
)
}
override
fun
onFailure
(
result
:
HttpResult
<
OrderPayResDto
?
>?)
{
}
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment