def print_dry_run(orig_trans_to_tagged, ignore_category=False): for orig_trans, new_trans in orig_trans_to_tagged: oid = orig_trans.orders[0].order_id logger.info('\nFor Amazon {}: {}\nInvoice URL: {}'.format( 'Order' if orig_trans.is_debit else 'Refund', oid, amazon.get_invoice_url(oid))) if orig_trans.children: for i, trans in enumerate(orig_trans.children): logger.info('{}{}) Current: \t{}'.format( '\n' if i == 0 else '', i + 1, trans.dry_run_str())) else: logger.info('\nCurrent: \t{}'.format( orig_trans.dry_run_str())) if len(new_trans) == 1: trans = new_trans[0] logger.info('\nProposed: \t{}'.format( trans.dry_run_str(ignore_category))) else: for i, trans in enumerate(reversed(new_trans)): logger.info('{}{}) Proposed: \t{}'.format( '\n' if i == 0 else '', i + 1, trans.dry_run_str(ignore_category)))
def print_unmatched(amzn_obj): proposed_mint_desc = mint.summarize_title( [i.get_title() for i in amzn_obj.items] if amzn_obj.is_debit else [amzn_obj.get_title()], '{}{}: '.format(amzn_obj.website, '' if amzn_obj.is_debit else ' refund')) logger.warning('{}'.format(proposed_mint_desc)) logger.warning('\t{}\t{}\t{}'.format( amzn_obj.transact_date() if amzn_obj.transact_date() else 'Never shipped!', micro_usd_to_usd_string(amzn_obj.transact_amount()), amazon.get_invoice_url(amzn_obj.order_id))) logger.warning('')