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