您好我正在使用下面提到的代码来提取订单构造。但我无法从此查询中获取订单ID和订单详细信息。即使订单已确认,也无法获得订单ID和订单详细信息。 目前我正在使用shopify mobilebuysdk:buy3:3.1.1
graphClient!!.queryGraph(query).enqueue(
object : GraphCall.Callback<Storefront.QueryRoot> {
override fun onResponse(@NonNull response: GraphResponse<Storefront.QueryRoot>) {
if (response.data()!!.getNode() as Storefront.Checkout != null) {
val checkout = response.data()!!.getNode() as Storefront.Checkout
println("CheckOut : " + checkout)
if (checkout != null) {
if (checkout.getOrder() != null) {
if (checkout.getOrder().getId().toString() != null) {
val orderId = checkout.getOrder().getId().toString()
println("Order ID : " + orderId)
}
}
}
}
}
override fun onFailure(@NonNull error: GraphError) {}
}, null,
RetryHandler.exponentialBackoff(1, TimeUnit.MILLISECONDS, 1.2f)
.whenResponse<Storefront.QueryRoot> { response ->
(response.data()?.getNode() as Storefront.Checkout).getOrder() == null
}
.maxCount(10)
.build())
答案 0 :(得分:0)
val checkoutId = ID(tinyDB!!.getString("New_checkoutID"))
val query = Storefront.query({ rootQuery ->
rootQuery
.node(checkoutId, { nodeQuery ->
nodeQuery
.onCheckout({ checkoutQuery ->
checkoutQuery
.order({ orderQuery ->
orderQuery
.orderNumber()
.totalPrice()
.processedAt()
}
)
}
)
}
)
}
)
graphClient!!.queryGraph(query).enqueue(
object : GraphCall.Callback<Storefront.QueryRoot> {
override fun onResponse(@NonNull response: GraphResponse<Storefront.QueryRoot>) {
val checkout = response.data()!!.getNode() as Storefront.Checkout
val orderId = checkout.getOrder().getId().toString()
}
override fun onFailure(@NonNull error: GraphError) {}
}, null,
RetryHandler.exponentialBackoff(1, TimeUnit.MILLISECONDS, 1.2f)
.whenResponse<Storefront.QueryRoot>(
{ response -> (response.data().getNode() as Storefront.Checkout).getOrder() == null }
)
.maxCount(10)
.build()
)
答案 1 :(得分:0)
看看这个答案, Shopify Web Checkout Issue
第一件事是从QraphQL设置中删除HttpCachePolicy。之后,尝试提供Network_Only以订购状态api。
您的问题将消失。