示例#1
0
    def get_report_count(self, params):
        http_method = 'POST'
        action = 'GetReportCount'

        report_types = params.get('ReportTypeList')
        al = params.get('Acknowledged')
        available_from_date = params.get('AvailableFromDate')
        available_to_date = params.get('AvailableToDate')
        parameters = ''
        if report_types:
            if report_types.find(',') == -1:
                parameters += '&ReportTypeList.Type.1=' + report_types
            else:
                parameters += common.set_param_list(report_types, 'ReportTypeList.Type')
        if al:
            parameters += '&Acknowledged=' + al
        if available_from_date:
            iso_time = common.amz_iso_time(available_from_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&AvailableFromDate=' + time_encode
        if available_to_date:
            iso_time = common.amz_iso_time(available_to_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&AvailableToDate=' + time_encode
        return self.req_handler(http_method, action, parameters)
示例#2
0
    def get_report_request_count(self, params):
        http_method = 'POST'
        action = 'GetReportRequestCount'

        report_types = params.get('ReportTypeList')
        report_status = params.get('ReportProcessingStatusList')
        request_from_date = params.get('RequestedFromDate')
        request_to_date = params.get('RequestedToDate')
        parameters = ''
        if report_types:
            if report_types.find(',') == -1:
                parameters += '&ReportTypeList.Type.1=' + report_types
            else:
                parameters += common.set_param_list(report_types, 'ReportTypeList.Type')
        if report_status:
            if report_status.find(',') == -1:
                parameters += '&ReportProcessingStatusList.Status.1=' + report_status
            else:
                parameters += common.set_param_list(report_status, 'ReportProcessingStatusList.Status')
        if request_from_date:
            iso_time = common.amz_iso_time(request_from_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&RequestedFromDate=' + time_encode
        if request_to_date:
            iso_time = common.amz_iso_time(request_to_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&RequestedToDate=' + time_encode
        return self.req_handler(http_method, action, parameters)
示例#3
0
    def list_financial_event_groups(self, params):
        http_method = 'POST'
        action = 'ListFinancialEventGroups'

        max_num = params.get('MaxResultsPerPage')
        start_date = params.get('FinancialEventGroupStartedAfter')
        end_date = params.get('FinancialEventGroupStartedBefore')
        parameters = '&FinancialEventGroupStartedAfter=' + self.params_encode(common.amz_iso_time(start_date))
        if max_num:
            parameters += '&MaxResultsPerPage=' + max_num
        if end_date:
            parameters += '&FinancialEventGroupStartedBefore=' + self.params_encode(common.amz_iso_time(end_date))
        return self.req_handler(http_method, action, parameters)
示例#4
0
    def request_report(self, params):
        http_method = 'POST'
        action = 'RequestReport'

        report_type = params.get('ReportType')
        start_date = params.get('StartDate')
        end_date = params.get('EndDate')
        report_options = params.get('ReportOptions')
        parameters = '&ReportType=' + self.params_encode(report_type)
        if start_date:
            iso_time = common.amz_iso_time(start_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&StartDate=' + time_encode
        if end_date:
            iso_time = common.amz_iso_time(end_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&EndDate=' + time_encode
        if report_options:
            parameters += '&ReportOptions=' + report_options
        return self.req_handler(http_method, action, parameters)
示例#5
0
    def list_financial_events(self, params):
        http_method = 'POST'
        action = 'ListFinancialEvents'

        max_num = params.get('MaxResultsPerPage')
        order_id = params.get('AmazonOrderId')
        event_group_id = params.get('FinancialEventGroupId')
        start_posted = params.get('PostedAfter')
        end_posted = params.get('PostedBefore')
        parameters = ''
        if order_id:
            parameters = '&AmazonOrderId=' + order_id
        elif event_group_id:
            parameters = '&FinancialEventGroupId=' + event_group_id
        elif start_posted:
            parameters = '&PostedAfter=' + self.params_encode(common.amz_iso_time(start_posted))
        if max_num:
            parameters += '&MaxResultsPerPage=' + max_num
        if end_posted:
            parameters += '&PostedBefore=' + self.params_encode(common.amz_iso_time(end_posted))
        return self.req_handler(http_method, action, parameters)
示例#6
0
    def manage_report_schedule(self, params):
        http_method = 'POST'
        action = 'ManageReportSchedule'

        report_type = params.get('ReportType')
        schedule = params.get('Schedule')
        schedule_date = params.get('ScheduleDate')
        parameters = '&ReportType=' + report_type + '&Schedule=' + schedule
        if schedule_date:
            iso_time = common.amz_iso_time(schedule_date)
            time_encode = self.params_encode(iso_time)
            parameters += '&ScheduleDate=' + time_encode
        return self.req_handler(http_method, action, parameters)
示例#7
0
    def list_orders(self, params):
        http_method = 'GET'
        action = 'ListOrders'

        created_after = params.get('CreatedAfter')
        created_before = params.get('CreatedBefore')
        last_updated_after = params.get('LastUpdatedAfter')
        last_updated_before = params.get('LastUpdatedBefore')
        order_status = params.get('OrderStatus')
        channel = params.get('FulfillmentChannel')
        pay_method = params.get('PaymentMethod')
        buyer_email = params.get('BuyerEmail')
        seller_order_id = params.get('SellerOrderId')
        max_page = params.get('MaxResultsPerPage')
        tfm_ship_status = params.get('TFMShipmentStatus')
        easy_ship_status = params.get('EasyShipShipmentStatus')

        parameters = ''
        if created_after:
            parameters = '&CreatedAfter=' + self.params_encode(
                common.amz_iso_time(created_after))
        if last_updated_after:
            parameters = '&LastUpdatedAfter=' + self.params_encode(
                common.amz_iso_time(last_updated_after))
        if created_before:
            parameters += '&CreatedBefore=' + self.params_encode(
                common.amz_iso_time(created_before))
        if last_updated_before:
            parameters += '&LastUpdatedBefore=' + self.params_encode(
                common.amz_iso_time(last_updated_before))
        if order_status:
            if order_status.find(',') == -1:
                parameters += '&OrderStatus.Status.1=' + self.params_encode(
                    order_status)
            else:
                parameters += common.set_param_list(order_status,
                                                    'OrderStatus.Status')
        if channel:
            if channel.find(',') == -1:
                parameters += '&FulfillmentChannel.Channel.1=' + self.params_encode(
                    channel)
            else:
                parameters += common.set_param_list(
                    channel, 'FulfillmentChannel.Channel')
        if pay_method:
            if pay_method.find(',') == -1:
                parameters += '&PaymentMethod.Method.1=' + self.params_encode(
                    pay_method)
            else:
                parameters += common.set_param_list(pay_method,
                                                    'PaymentMethod.Method')
        if buyer_email:
            parameters += '&BuyerEmail=' + self.params_encode(buyer_email)
        if seller_order_id:
            parameters += '&SellerOrderId=' + self.params_encode(
                seller_order_id)
        if max_page:
            parameters += '&MaxResultsPerPage=' + self.params_encode(max_page)
        if tfm_ship_status:
            parameters += '&TFMShipmentStatus=' + self.params_encode(
                tfm_ship_status)
        if easy_ship_status:
            parameters += '&EasyShipShipmentStatus=' + self.params_encode(
                easy_ship_status)

        return self.req_handler(http_method, action, parameters)