示例#1
0
 def test_check_delivery_details_package_size_2(self):
     self.delivery_data['package_size'] = [
         self.delivery_data['package_size'][0]
     ]
     self.assertEqual(
         self.delivery_data['package_size'],
         check_delivery_details(self.delivery_data)['package_size'])
示例#2
0
 def request_multi_pickup_delivery(self,
                                   rider_phone: dict,
                                   from_details_one: dict,
                                   from_details_two: dict,
                                   to_details: dict,
                                   recepient: dict,
                                   sender: dict,
                                   delivery_details: dict,
                                   vendor_type=1):
     """
     This call is used to create new multi pickup delivery request,
     obtaining rates , estimated time of arrival and
     estimated time of delivery between a set of locations.
     The main difference with the normal delivery is the
     number of pickup locations passed , on the from key.
     In this request pass an array with multiple destination.
     Multi-Pickup orders cannot be placed alongside multi-delivery orders.
     """
     command = "request"
     endpoint = "##requestmultipickup"
     values = {
         "command": command,
         "data": {
             "api_key":
             self.api_key,
             "api_username":
             self.api_username,
             "vendor_type":
             vendor_type,
             "rider_phone":
             rider_phone,
             "from": [
                 check_location_details(from_details_one),
                 check_location_details(from_details_two)
             ],
             "to": [check_location_details(to_details)],
             "recepient":
             check_person_details(recepient),
             "sender":
             check_person_details(sender),
             "delivery_details":
             check_delivery_details(delivery_details)
         }
     }
     return self.make_request(url_parameter=endpoint, body=values)
示例#3
0
 def complete_delivery(self, delivery_details: dict, order_no: str,
                       request_token_id: str):
     """
     If you had earlier requested an order using request_type
     as 'quote' you can use this call to complete your delivery.
     """
     command = "complete"
     endpoint = command
     values = {
         "command": command,
         "data": {
             "api_key": self.api_key,
             "api_username": self.api_username,
             "order_no": order_no,
             "rider_phone": "0728561783",
             "delivery_details": check_delivery_details(delivery_details)
         },
         "request_token_id": request_token_id
     }
     return self.make_request(url_parameter=endpoint, body=values)
示例#4
0
 def prepare_delivery_details(pick_up_date: str, collect_payment: dict,
                              carrier_type: int, return_type: bool,
                              note: str, note_status: bool,
                              request_type: str, order_type: str,
                              ecommerce_order: bool, express: bool,
                              skew: int, package_size: dict) -> dict:
     return check_delivery_details({
         "pick_up_date": pick_up_date,
         "collect_payment": collect_payment,
         "carrier_type": carrier_type,
         "return": return_type,
         "note": note,
         "note_status": note_status,
         "request_type": request_type,
         "order_type": order_type,
         "ecommerce_order": ecommerce_order,
         "express": express,
         "skew": skew,
         "package_size": [package_size]
     })
示例#5
0
 def request_multi_destination_delivery(self, from_details: dict,
                                        to_details_first: dict,
                                        to_details_second: dict,
                                        recepient: dict, sender: dict,
                                        delivery_details: dict):
     """
     This call is used to create new multi destination delivery request,
     obtaining rates , estimated time of arrival and
     estimated time of delivery between a set of locations.
     The main difference with the normal delivery is the
     number of destinations passed, on the to key.
     In this request pass an array with multiple destination.
     """
     endpoint = "#requestmultidestination"
     values = {
         "command": "request",
         "data": {
             "api_key":
             self.api_key,
             "api_username":
             self.api_username,
             "vendor_type":
             1,
             "rider_phone":
             "0728561783",
             "from":
             check_location_details(from_details),
             "to": [
                 check_location_details(to_details_first),
                 check_location_details(to_details_second)
             ],
             "recepient":
             check_person_details(recepient),
             "sender":
             check_person_details(sender),
             "delivery_details":
             check_delivery_details(delivery_details)
         },
         "request_token_id": "request_token_id"
     }
     return self.make_request(url_parameter=endpoint, body=values)
示例#6
0
 def test_check_delivery_details_2(self):
     data = self.delivery_data
     self.assertIsNotNone(check_delivery_details(data))
示例#7
0
 def test_check_delivery_details_1(self):
     data = self.delivery_data
     self.assertDictEqual(data, check_delivery_details(data))
示例#8
0
 def test_check_delivery_details_collect_payment_1(self):
     self.assertEqual(
         self.delivery_data['collect_payment'],
         check_delivery_details(self.delivery_data)['collect_payment'])