Esempio n. 1
0
 def test_parse_match_ammount_difference(self, fiobank):
     """ Test math if the ammount is within 1 CZK margin """
     order = mommy.make("Order", variable_symbol="112233")
     order.total_amount = 123
     order.save()
     m = MagicMock()
     fiobank.return_value = m
     m.period.return_value = [
         {
             'amount': 123.9,
             'variable_symbol': '000112233',
             'specific_symbol': '124',
             'account_number_full': '125',
             'constant_symbol': '126',
             'instruction_id': '127',
             'transaction_id': '128',
             'comment': '129',
             'bank_name': '130',
             'account_number': '130',
             'currency': 'CZK',
             'bank_code': '234234',
             'type': 'type',
             'account_name': 'type',
             'date': '2017-01-01',
             'recipient_message': 'message',
             'user_identification': 'Foo User',
         },
     ]
     parse()
     order.refresh_from_db()
     self.assertEqual(order.paid_date, datetime.date(2017, 1, 1))
Esempio n. 2
0
 def test_parse_no_czk(self, fiobank):
     order = mommy.make("Order", variable_symbol="112233")
     order.total_amount = 123
     order.save()
     m = MagicMock()
     fiobank.return_value = m
     m.period.return_value = [
         {
             'amount': 123,
             'variable_symbol': '112233',
             'specific_symbol': '124',
             'account_number_full': '125',
             'constant_symbol': '126',
             'instruction_id': '127',
             'transaction_id': '128',
             'comment': '129',
             'bank_name': '130',
             'account_number': '130',
             'currency': 'USD',
             'bank_code': '234234',
             'type': 'type',
             'account_name': 'type',
             'date': '2017-01-01',
             'recipient_message': 'message',
             'user_identification': 'Foo User',
         },
     ]
     parse()
     payment = FioPayment.objects.get()
     self.assertEquals(payment.amount, '123')
     self.assertEquals(payment.message, 'message')
     self.assertEquals(payment.user_identification, 'Foo User')
     self.assertEquals(payment.received_at,
                       datetime.datetime(2017, 1, 1, 6, 0, tzinfo=utc))
Esempio n. 3
0
 def test_parse_match_no_recipient_message(self, fiobank):
     order = mommy.make("Order", variable_symbol="112233")
     order.total_amount = 123
     order.save()
     m = MagicMock()
     fiobank.return_value = m
     m.period.return_value = [
         {
             'amount': 123,
             'variable_symbol': '112233',
             'specific_symbol': '124',
             'account_number_full': '125',
             'constant_symbol': '126',
             'instruction_id': '127',
             'transaction_id': '128',
             'comment': '129',
             'bank_name': '130',
             'account_number': '130',
             'currency': 'CZK',
             'bank_code': '234234',
             'type': 'type',
             'account_name': 'type',
             'date': '2017-01-01',
             'recipient_message': None,
             'user_identification': 'Foo User',
         },
     ]
     parse()
     order.refresh_from_db()
     payment = FioPayment.objects.get()
     self.assertEqual(order.paid_date, datetime.date(2017, 1, 1))
     self.assertEqual(payment.order, order)
     self.assertEquals(payment.amount, '123')
Esempio n. 4
0
 def test_parse_no_match_ammount_difference(self, fiobank):
     """ Test no math if the ammount is out of 1 CZK margin """
     order = mommy.make("Order", variable_symbol="112233")
     order.total_amount = 123
     order.save()
     m = MagicMock()
     fiobank.return_value = m
     for amount in (121.9, 124.1):
         m.period.return_value = [
             {
                 'amount': amount,
                 'variable_symbol': '000112233',
                 'specific_symbol': '124',
                 'account_number_full': '125',
                 'constant_symbol': '126',
                 'instruction_id': '127',
                 'transaction_id': '128',
                 'comment': '129',
                 'bank_name': '130',
                 'account_number': '130',
                 'currency': 'CZK',
                 'bank_code': '234234',
                 'type': 'type',
                 'account_name': 'type',
                 'date': '2017-01-01',
                 'recipient_message': 'message',
                 'user_identification': 'Foo User',
             },
         ]
         parse()
         payment = FioPayment.objects.get()
         self.assertEquals(payment.amount, str(amount))
         self.assertEquals(payment.message, 'message')
         self.assertEquals(payment.user_identification, 'Foo User')
         self.assertEquals(payment.received_at,
                           datetime.datetime(2017, 1, 1, 6, 0, tzinfo=utc))
         payment = FioPayment.objects.all().delete()
Esempio n. 5
0
def parse_statement(self, days_back=7):
    parse(days_back=days_back)