def update_shipping(self, order_record):
     solid_api = SolidCommerce.API()
     shipper_code = order_record['Tracking Number '][0:2]
     shipping_type_cases = {'1Z': 'UPSGround', 'SP': 'ShippingTypeCode'}
     shipping_package_type_cases = {'1Z': '0', 'SP': '0'}
     shipment_api_update = SolidCommerce.Shipment()
     shipment_api_update.sc_sale_id = order_record['P.O. ']
     shipment_api_update.tracking_number = order_record['Tracking Number ']
     shipment_api_update.marketplace = '3'
     try:
         shipment_api_update.shipping_type_code = shipping_type_cases[
             shipper_code]
         shipment_api_update.package_type = shipping_package_type_cases[
             shipper_code]
         solid_api_shipping_update_call = SolidCommerce.API()
         solid_api_shipping_update_call.update_ebay_shipment(
             shipment_api_update.as_shipment_element())
         try:
             order_object = self.get_order_from_solid_by_ebay_number(
                 order_record['P.O. '])[0]
             order_object.status = 'Drop Shipped OW'
             solid_api.update_order_status(order_object)
         except IndexError:
             print('Order ' + order_record['P.O. '] + ' Does Not Exist')
     except KeyError:
         print('Unknown Tracking Number format for order# ' +
               order_record['P.O. '])
示例#2
0
 def update_shipping(self, order_record):
     solid_api = SolidCommerce.API()
     shipper_code = order_record['Carrier']
     shipping_type_cases = {
         'UPSSurePost>1lb': 'UPSGround',
         'UPSSurePost<1lb': 'UPSSurePostLessThanLB',
         'UPS Ground Residential': 'UPSGround',
         'Consumer Drop Ship': 'UPSGround'
     }
     shipping_package_type_cases = {
         'UPSSurePost>1lb': '0',
         'UPSSurePost<1lb': '0',
         'UPS Ground Residential': '0',
         'Consumer Drop Ship': '0'
     }
     shipment_api_update = SolidCommerce.Shipment()
     shipment_api_update.sc_sale_id = order_record['PO Number']
     shipment_api_update.tracking_number = order_record['Tracking Number']
     shipment_api_update.marketplace = '3'
     shipment_api_update.shipping_type_code = shipping_type_cases[
         shipper_code]
     shipment_api_update.package_type = '0'  # shipping_package_type_cases[shipper_code]
     solid_api_shipping_update_call = SolidCommerce.API()
     solid_api_shipping_update_call.update_ebay_shipment(
         shipment_api_update.as_shipment_element())
     try:
         order_object = self.get_order_from_solid_by_ebay_number(
             order_record['PO Number'])[0]
         order_object.status = 'Drop Shipped PED'
         solid_api.update_order_status(order_object)
     except:
         print(shipment_api_update.as_dict())
 def shipping_from_api(self):
     solid_api = SolidCommerce.API()
     order_search_filter = SolidCommerce.OrderSearchFilter()
     order_search_filter.page = '1'
     order_search_filter.records_per_page_count = '1000'
     order_search_filter.filter_by_order_status = 'true'
     order_search_filter.order_status = 'PAID'
     order_search_filter.filter_by_warehouse = 'true'
     order_search_filter.order_search_format = 'ByOrderItems'
     aip_company_lists = [
         company_list for company_list in solid_api.get_all_company_lists() if
         company_list.list_name.split('-')[0] == 'A&I'
     ]
     aip_orders = {order.po_number: order for order in list(self.get_orders())}
     for warehouse in aip_company_lists:
         order_search_filter.warehouse_list = warehouse.list_id
         open_orders = [
             open_order for open_order in solid_api.search_orders_v6(order_search_filter.as_element())
         ]
         for open_order in open_orders:
             try:
                 order_page = aip_orders[open_order.sale_id]
                 self.update_shipping(order_page)
                 open_order.status = 'Drop Shipped AIP'
                 solid_api.update_order_status(open_order)
             except KeyError:
                 print('Order number ' + open_order.sale_id + ' not found')
             except TypeError:
                 pass
             except AttributeError:
                 print('Attribute Error: ' + str(open_order))
示例#4
0
 def update_shipping(order_record):
     shipper_code = order_record['ShippingCarrier']
     shipping_type_cases = {
         'USPS-Priority Mail': 'USPSFirstClass',
         'USPS-First Class M': 'USPSPriorityMail',
         'USPS-First Class P': 'USPSPriorityMail',
         'UPS-UPS® Ground-COL': 'UPSGround',
         'UPS-UPS® Groun': 'UPSGround',
         'R & L CAR-LTL': 'RLCarriersFreight',
         'SPDY-Ground': 'SpeeDeeDelivery',
         'SPDY-Groun': 'SpeeDeeDelivery',
         'Metro Ground': 'SpeeDeeDelivery'
     }
     shipment_api_update = SolidCommerce.Shipment()
     try:
         shipment_api_update.sc_sale_id = order_record['Your Order #']
     except KeyError:
         shipment_api_update.sc_sale_id = order_record['Your Order No']
     shipment_api_update.tracking_number = order_record['TrackingNumber']
     shipment_api_update.shipping_type_code = shipping_type_cases[order_record['ShippingService']]
     shipment_api_update.package_type = '0'
     shipment_api_update.marketplace = '3'
     shipment_api_update.ship_cost = order_record['SHIPPING']
     solid_api_shipping_update_call = SolidCommerce.API()
     solid_api_shipping_update_call.update_ebay_shipment(shipment_api_update.as_shipment_element())
示例#5
0
 def get_all_paid_orders():
     solid_api = SolidCommerce.API()
     order_search_filter = SolidCommerce.OrderSearchFilter()
     order_search_filter.page = '1'
     order_search_filter.records_per_page_count = '1000'
     order_search_filter.custom_order_status = '2'
     order_search_filter.order_search_format = 'ByOrderItems'
     return solid_api.search_orders_v6(order_search_filter.as_element())
 def get_pending_dropship_orders():
     solid_api = SolidCommerce.API()
     order_search_filter = SolidCommerce.OrderSearchFilter()
     order_search_filter.page = '1'
     order_search_filter.records_per_page_count = '1000'
     order_search_filter.filter_by_custom_order_status = 'true'
     order_search_filter.custom_order_status = 'Waiting For OW'
     order_search_filter.order_search_format = 'ByOrderItems'
     return solid_api.search_orders_v6(order_search_filter.as_element())
示例#7
0
 def get_dropshipped_errors_previous_month(self):
     solid_api = SolidCommerce.API()
     search_filter = SolidCommerce.OrderSearchFilter()
     search_filter.page = '1'
     search_filter.records_per_page_count = '10000'
     search_filter.order_search_format = 'ByOrderItems'
     search_filter.custom_order_status = 'Drop Shipped CPD'
     search_filter.filter_by_custom_order_status = 'true'
     search_filter.filter_by_dates = '1'
     today = datetime.date.today()
     first = today.replace(day=1)
     last_month = first - datetime.timedelta(days=1)
     search_filter.start_date = last_month.strftime("%m/01/%Y")
     search_filter.end_date = last_month.strftime("%m/%d/%Y")
     dropshipped_orders = [
         order.as_dict() for order in solid_api.search_orders_v6(search_filter.as_element()) if
         int(order.order_date.split('/')[0]) == int(last_month.strftime("%m/01/%Y").split('/')[0])
     ]
     print(len(dropshipped_orders))
     session = self.get_session()
     combined_order_errors = []
     for order in dropshipped_orders:
         order['ReasonOfError'] = ''
         try:
             shipping_info = self.shipping_from_invoice_api_by_ebay_order_number(session, order['saleID'])
             shipping_info['PackageWeight'] = str(float(shipping_info['PackageWeight'].split(' ')[0]) * 16)
             combined_dict = {**order, **shipping_info}
             combined_dict['CustomerTotal'] = float(combined_dict['TotalSale']) + float(combined_dict['ShipFee'])
             if float(combined_dict['SHIPPING']) > float(combined_dict['ShipFee']):
                 combined_dict['ReasonOfError'] = 'Cost greater than charged'
                 combined_order_errors.append(combined_dict)
             elif combined_dict['ShippingCarrier'] == 'UPS' and float(combined_dict['SHIPPING']) > 1.75:
                 combined_dict['ReasonOfError'] = 'UPS not Charged Correctly'
                 combined_order_errors.append(combined_dict)
             elif float(combined_dict['PackageWeight']) > (
                     float(combined_dict['Weight'] * float(combined_dict['QTY']))):
                 combined_dict['ReasonOfError'] = 'Shipped Weight Higher'
                 combined_order_errors.append(combined_dict)
             elif .88 * combined_dict['CustomerTotal'] - float(combined_dict['Invoice Total'].replace(',', '')) < 0:
                 combined_dict['ReasonOfError'] = 'Net Sale Loss'
                 combined_order_errors.append(combined_dict)
             else:
                 continue
         except IndexError:
             pass
         except KeyError:
             pass
     self.write_list_of_dicts_to_csv(
         combined_order_errors,
         'T:/ebay/CPD/Tracking/Tracking Errors/CPD_Errors' + last_month.strftime("%B.%Y") + '.csv'
     )
 def update_shipping(order_page):
     shipping_type_cases = {'UPS': 'UPSGround',
                            'SpeeDee': 'SpeeDeeDelivery'}
     shipping_package_type_cases = {'UPS': '0', 'SpeeDee': '0'}
     shipment_api_update = SolidCommerce.Shipment()
     shipment_api_update.sc_sale_id = order_page.po_number
     shipment_api_update.ship_date = order_page.ship_date
     shipment_api_update.ship_cost = order_page.freight
     shipment_api_update.tracking_number = order_page.order_shipments[0]['Track / PRO Number']
     shipment_api_update.marketplace = '3'
     shipment_api_update.shipping_type_code = shipping_type_cases[order_page.order_shipments[0]['Shipper']]
     shipment_api_update.package_type = shipping_package_type_cases[order_page.order_shipments[0]['Shipper']]
     solid_api_shipping_update_call = SolidCommerce.API()
     solid_api_shipping_update_call.update_ebay_shipment(shipment_api_update.as_shipment_element())
示例#9
0
 def shipping_from_api(self):
     solid_api = SolidCommerce.API()
     pending_dropships = self.get_pending_dropship_orders()
     session = self.get_session()
     orders_url = 'https://ezone.cpdonline.com/cgi-bin/edmas_order_review.mac/CurrentOrders?p1=&p2=C&p3=999&p4=*&p5='
     cpd_orders_html = session.get(orders_url).text
     orders_dicts = self.get_orders_dicts(cpd_orders_html)
     for pending_dropship in pending_dropships:
         try:
             order_page_dict = self.get_order_page_dict(
                 session.get(orders_dicts[pending_dropship.sale_id]['href']).text
             )
             self.update_shipping(order_page_dict)
             pending_dropship.status = 'Drop Shipped CPD'
             solid_api.update_order_status(pending_dropship)
         except IndexError:
             print('No Shipping Info Available for Order ' + pending_dropship.as_dict()['saleID'])
         except KeyError:
             try:
                 invoice_page_dict = self.shipping_from_invoice_api(session, pending_dropship)
                 self.update_shipping(invoice_page_dict)
                 pending_dropship.status = 'Drop Shipped CPD'
                 solid_api.update_order_status(pending_dropship)
             except KeyError:
                 print('cannot find order ' + pending_dropship.as_dict()['saleID'])
             except IndexError:
                 print('No Shipping Info Available for Order ' + pending_dropship.as_dict()['saleID'])
 def update_images_and_description_from_file(self):
     solid_api = SolidCommerce.API()
     products, primary_key, filepath = self.open_selected_csv_with_primary_key()
     for product in products:
         try:
             product_update = self.get_product_info(product[primary_key])
             product_update.custom_sku = product['SKU']
             solid_api.update_insert_product(product_update.as_product_xml_string())
         except:
             print(product[primary_key])
 def shipping_from_orders_page(self):
     order_dicts = {
         order.po_number: order for order in list(self.get_orders()) if order.ship_date == time.strftime("%m/%d/%Y")
     }
     for order_number, order_object in order_dicts.items():
         solid_api = SolidCommerce.API()
         order_search_filter = SolidCommerce.OrderSearchFilter()
         order_search_filter.page = '1'
         order_search_filter.records_per_page_count = '1000'
         order_search_filter.order_search_format = 'ByOrderItems'
         order_search_filter.search_type = 'BySCOrderID'
         try:
             self.update_shipping(order_object)
             order_search_filter.search_value = order_number
             open_order = solid_api.search_orders_v6(order_search_filter.as_element())[0]
             open_order.status = 'Drop Shipped AIP'
             solid_api.update_order_status(open_order)
         except TypeError:
             pass
示例#12
0
 def raw_shipping_from_api(self):
     solid_api = SolidCommerce.API()
     session = self.get_session()
     orders_url = 'https://ezone.cpdonline.com/cgi-bin/edmas_order_review.mac/CurrentOrders?p1=&p2=C&p3=999&p4=*&p5='
     cpd_orders_html = session.get(orders_url).text
     orders_dicts = self.get_orders_dicts(cpd_orders_html)
     for order_number, order_dict in orders_dicts.items():
         try:
             order_page_html = session.get(order_dict['href']).text
             order_page_dict = self.get_order_page_dict(order_page_html)
             self.update_shipping(order_page_dict)
             search_filter = SolidCommerce.OrderSearchFilter()
             search_filter.page = '1'
             search_filter.records_per_page_count = '1000'
             search_filter.order_search_format = 'ByOrderItems'
             search_filter.search_type = 'BySCOrderID'
             search_filter.search_value = order_dict['P/O #']
             solid_order = solid_api.search_orders_v6(search_filter.as_element())[0]
             solid_order.status = 'Drop Shipped CPD'
             solid_api.update_order_status(solid_order)
         except IndexError:
             pass
示例#13
0
 def api_submit_dropship_order(self):
     solid_api = SolidCommerce.API()
     order_number = '206066'  # input('Enter Order Number: ')
     search_filter_element = SolidCommerce.OrderSearchFilter()
     search_filter_element.search_type = 'BySCOrderID'
     search_filter_element.search_value = order_number
     search_filter_element.order_search_format = 'ByOrderItems'
     search_filter_element.page = '1'
     search_filter_element.records_per_page_count = '1000'
     order_items = solid_api.search_orders_v6(search_filter_element.as_element())
     order_items_dicts = [order_item.as_dict() for order_item in order_items]
     shipment_orders = []
     print('\nConfirm Quantity To Ship\n-----------------')
     for order_item_dict in order_items_dicts:
         qty = self.get_order_quantity_selection(order_item_dict)
         order_item_dict['ShipQuantity'] = str(qty)
         cpd_availability = self.make_inventory_inquiry([{
             'SKU': order_item_dict['SKU'],
             'Qty': order_item_dict['ShipQuantity']
         }])
         if qty > 0:
             shipment_orders.append(order_item_dict)
     print(shipment_orders)
 def get_product_info(self, item_number):
     aip_api = API()
     aip_api.item_number = item_number
     product_info_html_dict = aip_api.get_all_html()
     product_info_html = self.get_product_html_for_ebay(product_info_html_dict)
     picture_links = product_info_html_dict['PictureLinks']
     product_object = SolidCommerce.Product()
     product_object.ebay_description = product_info_html
     product_object.mystore_description = product_info_html
     product_object.description = product_info_html
     if len(picture_links) > 0:
         product_object.main_image = picture_links.pop(0)
     if len(picture_links) > 0:
         product_object.alternate_images = picture_links
     return product_object
示例#15
0
 def shipping_from_7_day_invoice_api(self):
     solid_api = SolidCommerce.API()
     pending_dropships = self.get_all_paid_orders()
     session = self.get_session()
     orders_url = ('https://ezone.cpdonline.com/cgi-bin/edmas_order_review.mac'
                  '/CurrentOrders?p1=&p2=&p3=007&p4=*%20&p5=&p6=')
     cpd_orders_html = session.get(orders_url).text
     orders_dicts = self.get_orders_dicts(cpd_orders_html)
     for pending_dropship in pending_dropships:
         try:
             order_page_dict = self.get_order_page_dict(
                 session.get(orders_dicts[pending_dropship.store_order_id]['href']).text
             )
             self.update_shipping(order_page_dict)
             pending_dropship.status = 'Drop Shipped CPD'
             solid_api.update_order_status(pending_dropship)
         except KeyError:
             pass
         except IndexError:
             print(pending_dropship.store_order_id)