Change product id for big boy packages on Kurjerzy

master
informatic 2020-04-30 13:25:49 +02:00
parent 8860604f63
commit cf3bb9bfac
1 changed files with 26 additions and 12 deletions

View File

@ -65,6 +65,7 @@ class Kurjerzy:
street_number = ''
if model.faceshield_full_delivered == 50:
product_id = 2
params = {
'packageType': 'TYPE_PARCEL',
'weight': 7,
@ -76,7 +77,18 @@ class Kurjerzy:
'packingType': 'TYPE_STANDARD',
'count': 1,
}
services = {
'cod': 0,
'codValue': 0,
'codAccountNumber': '',
'codOneDay': 0,
'smsSenderNotification': 0,
'smsRecipientNotification': 1,
'warrantyDeliveryNextDay': 0,
'rod': 0,
}
else:
product_id = 3
params = {
'packageType': 'TYPE_PARCEL',
'weight': 4,
@ -88,16 +100,26 @@ class Kurjerzy:
'packingType': 'TYPE_STANDARD',
'count': 1,
}
services = {
'cod': 0,
'codValue': 0,
'codAccountNumber': '',
'codOneDay': 0,
'smsSenderNotification': 0,
'smsRecipientNotification': 1,
'warrantyDeliveryNextDay': 1,
'rod': 0,
}
result = self.send_query('''
mutation ($recipient: AddressInput, $sender: AddressInput, $refer: String, $params: ParamsInput, $services: ServicesInput) {
mutation ($recipient: AddressInput, $sender: AddressInput, $refer: String, $params: ParamsInput, $services: ServicesInput, $productId: Int) {
createShipment(
recipient: $recipient,
sender: $sender,
refer: $refer,
params: $params,
services: $services,
productId: 3,
productId: $productId,
) {
status,
shipment { id, status },
@ -105,6 +127,7 @@ class Kurjerzy:
}
}
''', {
'productId': product_id,
'recipient': {
'name': model.shipping_name,
'name2': model.full_name,
@ -129,16 +152,7 @@ class Kurjerzy:
},
'refer': str(model.id),
'params': params,
'services': {
'cod': 0,
'codValue': 0,
'codAccountNumber': '',
'codOneDay': 0,
'smsSenderNotification': 0,
'smsRecipientNotification': 1,
'warrantyDeliveryNextDay': 1,
'rod': 0,
},
'services': services,
})
if not result['data']['createShipment']['status'] or result['data']['createShipment']['error']: