You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.9 KiB
107 lines
2.9 KiB
/* |
|
* Copyright 2024. Huawei Technologies Co., Ltd. All rights reserved. |
|
* |
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
* you may not use this file except in compliance with the License. |
|
* You may obtain a copy of the License at |
|
* |
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
* |
|
* Unless required by applicable law or agreed to in writing, software |
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
* See the License for the specific language governing permissions and |
|
* limitations under the License. |
|
* |
|
*/ |
|
|
|
package harmonyos |
|
|
|
import ( |
|
"log" |
|
) |
|
|
|
const ( |
|
URL_ORDER_LOOKUP = "/harmony/v1/application/order/lookup" |
|
URL_ORDER_LIST_QUERY = "/order/harmony/v1/application/trade/orders/query" |
|
URL_USER_ORDER_LIST_QUERY = "/harmony/v1/application/user/orders/query" |
|
) |
|
|
|
type OrderLookup struct { |
|
IapServer |
|
} |
|
|
|
// OrderQuery This API is used to query the latest status of a consumable or non-consumable order. |
|
// Params: |
|
// |
|
// orderNo: Order ID of a purchase. |
|
// |
|
// Return: |
|
// |
|
// nil |
|
// |
|
// Exception: |
|
// |
|
// nil |
|
func (orderService *OrderLookup) OrderQuery(bodyMap map[string]interface{}) (resp string, err error) { |
|
|
|
resp, err = orderService.httpPost(URL_ROOT+URL_ORDER_LOOKUP, bodyMap) |
|
if err != nil { |
|
// TODO: Need to replace it with the actual business logic. |
|
log.Print("Error:", err) |
|
} else { |
|
// TODO: Need to replace it with the actual business logic. |
|
log.Print("order query response is: ", resp) |
|
} |
|
return resp, err |
|
} |
|
|
|
// UserOrdersQuery This API is used to query the latest status of a consumable or non-consumable order. |
|
// Params: |
|
// |
|
// purchaseOrderId: Order ID of a purchase. |
|
// productType: product Type. |
|
// continuationToken: continuationToken. |
|
// |
|
// Return: |
|
// |
|
// nil |
|
// |
|
// Exception: |
|
// |
|
// nil |
|
func (orderService *OrderLookup) UserOrdersQuery(bodyMap map[string]interface{}) (resp string, err error) { |
|
resp, err = orderService.httpPost(URL_ROOT+URL_USER_ORDER_LIST_QUERY, bodyMap) |
|
if err != nil { |
|
// TODO: Need to replace it with the actual business logic. |
|
log.Print("Error:", err) |
|
} else { |
|
// TODO: Need to replace it with the actual business logic. |
|
log.Print("order status query response is: ", resp) |
|
} |
|
return resp, err |
|
} |
|
|
|
// OrdersQuery This API is used to query the latest status of a consumable or non-consumable order. |
|
// Params: |
|
// |
|
// orderNo: Order ID of a purchase. |
|
// |
|
// Return: |
|
// |
|
// nil |
|
// |
|
// Exception: |
|
// |
|
// nil |
|
func (orderService *OrderLookup) OrdersQuery(bodyMap map[string]interface{}) (resp string, err error) { |
|
resp, err = orderService.httpPost(URL_ROOT+URL_ORDER_LIST_QUERY, bodyMap) |
|
if err != nil { |
|
// TODO: Need to replace it with the actual business logic. |
|
log.Print("Error:", err) |
|
} else { |
|
// TODO: Need to replace it with the actual business logic. |
|
log.Print("order status query response is: ", resp) |
|
} |
|
return resp, err |
|
}
|
|
|