Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions .idea/csv-plugin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Apis/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added Apis/__pycache__/base_api.cpython-39.pyc
Binary file not shown.
Binary file added Apis/__pycache__/group.cpython-39.pyc
Binary file not shown.
Binary file added Apis/__pycache__/sign_in.cpython-39.pyc
Binary file not shown.
16 changes: 10 additions & 6 deletions Apis/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ def make_payment(self,order_id,payment_id,channel,locale,mode,token):
}
r_pay = self.send_api(req_pay)
r_success = self.send_api(req_success)
r_detail = self.order_dateil(order_id,channel,locale,token)
return r_pay,r_success,r_detail

if r_pay.status_code == 200 & r_success.status_code == 200:
r_detail = self.order_dateil(order_id,channel,locale,token)
return r_detail
else:
return r_pay.json(),r_success.json()
# #支付成功
# def payment_success(self,order_id,channel,locale,token):
# payment_success = f'/order/v1/payments/{order_id}/notify_paid'
Expand All @@ -109,7 +111,7 @@ def make_payment(self,order_id,payment_id,channel,locale,mode,token):
# return r

#创建订单之后并且支付
def create_make_payment_order(self, token ,channel, locale, cart_checkout, fulfillment, receive_info, voucher_ids, user_remarks,sellables):
def create_make_payment_order(self, token ,channel, locale,cart_checkout,promotion_code,membership_name, fulfillment, receive_info, voucher_ids, user_remarks,sellables):
# create_url = "/core/v1/orders/place_order"
#
# fulfill = {
Expand Down Expand Up @@ -147,15 +149,15 @@ def create_make_payment_order(self, token ,channel, locale, cart_checkout, fulfi
# 'json': param
# }
# res = self.send_api(req)
res = self.create_an_order(token ,channel, locale, cart_checkout, fulfillment, receive_info, voucher_ids, user_remarks,sellables)
res = self.create_an_order(token ,channel, locale, cart_checkout,promotion_code,membership_name, fulfillment, receive_info, voucher_ids, user_remarks,sellables)
order_id = res.json()['data']['order']['id']
mode = res.json()['data']['order']['payment_modes'][0]
payment_id = res.json()['data']['order']['payments'][0]['id']
r = self.make_payment(order_id,payment_id,channel,locale,mode,token)
return r

#创建订单
def create_an_order(self, token ,channel, locale, cart_checkout, fulfillment, receive_info, voucher_ids, user_remarks,sellables):
def create_an_order(self, token ,channel, locale, cart_checkout,promotion_code,membership_name, fulfillment, receive_info, voucher_ids, user_remarks,sellables):
create_url = "/core/v1/orders/place_order"

#查询每个商品自己的sellable_id
Expand All @@ -182,6 +184,8 @@ def create_an_order(self, token ,channel, locale, cart_checkout, fulfillment, re
}
param = {
"cart_checkout": cart_checkout,
"promotion_code":promotion_code ,
"membership_name": membership_name,
"sellables": sellables,
"fulfillment": fulfill,
"receiver_information": receiver_information,
Expand Down
44 changes: 44 additions & 0 deletions Apis/promotion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from msi_api.Apis.base_api import BaseApi

class Promotion(BaseApi):
# 请求询价
def request_quotation(self, token ,channel, locale, cart_checkout,promotion_code,membership_name, fulfillment, receive_info, voucher_ids,sellables):
add_url = "/core/v1/orders/request_quotation"
fulfill = {
"fulfillment_method": fulfillment[0],
"fulfillment_date": fulfillment[1],
"fulfillment_time_slot_id": fulfillment[2]
}
receiver_information = {
"receiver_name": receive_info[0],
"receiver_email": receive_info[1],
"receiver_phone_number": receive_info[2],
"address_line_1": receive_info[3],
"address_line_2": receive_info[4],
"address_line_3": receive_info[5],
"address_postal_code": receive_info[6]
}
param = {
"cart_checkout": cart_checkout,
'promotion_code':promotion_code,
'membership_name': membership_name,
"sellables": sellables,
"fulfillment": fulfill,
"receive_information": receiver_information,
"voucher_ids": voucher_ids
}

headers = {
'X-CHANNEL-KEY': channel,
'LOCALE': locale,
'Authorization': 'Bearer ' + token
}
req = {
'method': 'POST',
'headers': headers,
'url': add_url,
'json': param
}
res = self.send_api(req)
return res

47 changes: 18 additions & 29 deletions Apis/quotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,30 @@

class Quotation(BaseApi):
# 请求询价
def request_quotation(self, channel, locale, cart_checkout, sellable_id, sellable_type,
bundle_id, quantity, preference_item_ids,
fulfillment_method, fulfillment_date, fulfillment_time_slot_id,
receiver_name, receiver_email, receiver_phone_number,
address_line_1, address_line_2, address_line_3, address_postal_code, voucher_ids, token):
def request_quotation(self, token, channel, locale, cart_checkout, promotion_code, membership_name, fulfillment,
receive_info, voucher_ids, sellables):
add_url = "/core/v1/orders/request_quotation"

sellables = [{
"sellable_id": sellable_id,
"sellable_type": sellable_type,
"bundle_id": bundle_id,
"quantity": quantity,
"preference_item_ids": preference_item_ids
}]
fulfillment = {
"fulfillment_method": fulfillment_method,
"fulfillment_date": fulfillment_date,
"fulfillment_time_slot_id": fulfillment_time_slot_id
fulfill = {
"fulfillment_method": fulfillment[0],
"fulfillment_date": fulfillment[1],
"fulfillment_time_slot_id": fulfillment[2]
}
receive_information = {
"receiver_name": receiver_name,
"receiver_email": receiver_email,
"receiver_phone_number": receiver_phone_number,
"address_line_1": address_line_1,
"address_line_2": address_line_2,
"address_line_3": address_line_3,
"address_postal_code": address_postal_code
receiver_information = {
"receiver_name": receive_info[0],
"receiver_email": receive_info[1],
"receiver_phone_number": receive_info[2],
"address_line_1": receive_info[3],
"address_line_2": receive_info[4],
"address_line_3": receive_info[5],
"address_postal_code": receive_info[6]
}
voucher_ids = voucher_ids

param = {
"cart_checkout": cart_checkout,
'promotion_code': promotion_code,
'membership_name': membership_name,
"sellables": sellables,
"fulfillment": fulfillment,
"receive_information": receive_information,
"fulfillment": fulfill,
"receive_information": receiver_information,
"voucher_ids": voucher_ids
}

Expand Down
Binary file removed Case/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Data/.DS_Store
Binary file not shown.
61 changes: 54 additions & 7 deletions Data/create_order_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,68 @@ create_order_data:

create_order_data_make_payment:
info:
- [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'delivery','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# - [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'delivery','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# "sellable_id": 58,
# "sellable_type": 'product_sku',
# "bundle_id": ,
# "quantity": 1,
# "preference_item_ids": [ ]
# } ] ,['Payment Processing','processing']]
# - [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'delivery','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# "sellable_id": 58,
# "sellable_type": 'product_sku',
# "bundle_id": ,
# "quantity": 1,
# "preference_item_ids": [ 30,31 ]
# } ],['Payment Processing','processing']]
# - [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'self_pickup','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# "sellable_id": 58,
# "sellable_type": 'product_sku',
# "bundle_id": ,
# "quantity": 1,
# "preference_item_ids": [ ]
# } ] ,[ 'Payment Processing','processing' ] ]
# - [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'self_pickup','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# "sellable_id": 58,
# "sellable_type": 'product_sku',
# "bundle_id": ,
# "quantity": 1,
# "preference_item_ids": [ 30,31 ]
# } ],[ 'Payment Processing','processing' ] ]
# - [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'voucher','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# "sellable_id": 11,
# "sellable_type": 'voucher_product',
# "bundle_id": ,
# "quantity": 1,
# "preference_item_ids": [ ]
# } ],[ 'Payment Processing','processing' ] ]
# - [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'virtual','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
# "sellable_id": 11,
# "sellable_type": 'voucher_product',
# "bundle_id": ,
# "quantity": 1,
# "preference_item_ids": [ ]
# } ],[ 'Payment Processing','processing' ] ]
- [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'dine_in','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
"sellable_id": 58,
"sellable_type": 'product_sku',
"bundle_id": ,
"quantity": 1,
"preference_item_ids": [ ]
} ] ,['Payment Processing','processing']]
- [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'delivery','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
} ] ,[ 'Payment Processing','processing' ] ]
- [ 'emTUvDH7IjEwY0QBqPLSotYCPceebKkT','en',False,[ 'takeaway','2022-10-30',1 ],[ 'zhangsan','xx@11.com','152-2762-9383','address1','address2','adress3','610000' ],[ ],'double sugar',[ {
"sellable_id": 58,
"sellable_type": 'product_sku',
"bundle_id": ,
"quantity": 1,
"preference_item_ids": [ 30,31 ]
} ],['Payment Processing','processing']]

} ],[ 'Payment Processing','processing' ] ]
ids:
- Nomal
- preference
# - Nomal-delivery
# - delivery-preference
# - Nomal-pickup
# - pickup-preference
# - voucher_product-voucher
# - voucher_product-virtual
- product-dine_in
- product-takeaway
Loading