Ejemplo n.º 1
0
 def test_user_arc_creation(self):
     # Payment creation
     user = mommy.save_one(MainUser, email='*****@*****.**')
     cmd = pagseguro_facade.procces_external_payment_cmd(generate_xml('non particular id', '1', '18.99'))
     cmd()
     payments = pagseguro_facade.search_all_payments(relations=['owner'])()
     self.assertEqual(1, len(payments))
     self.assertEqual(user, payments[0].owner)
Ejemplo n.º 2
0
 def test_user_arc_creation(self):
     # Payment creation
     user = mommy.save_one(MainUser, email='*****@*****.**')
     cmd = pagseguro_facade.procces_external_payment_cmd(
         generate_xml('non particular id', '1', '18.99'))
     cmd()
     payments = pagseguro_facade.search_all_payments(relations=['owner'])()
     self.assertEqual(1, len(payments))
     self.assertEqual(user, payments[0].owner)
Ejemplo n.º 3
0
 def test_user_creation(self):
     # Payment creation
     cmd = pagseguro_facade.procces_external_payment_cmd(generate_xml('non particular id', '1', '18.99'))
     cmd()
     payments = pagseguro_facade.search_all_payments(relations=['owner'])()
     self.assertEqual(1, len(payments))
     self.assertIsInstance(payments[0].owner, MainUser)
     self.assertEqual('*****@*****.**', payments[0].owner.email)
     self.assertEqual('José Comprador', payments[0].owner.name)
Ejemplo n.º 4
0
 def test_user_creation(self):
     # Payment creation
     cmd = pagseguro_facade.procces_external_payment_cmd(
         generate_xml('non particular id', '1', '18.99'))
     cmd()
     payments = pagseguro_facade.search_all_payments(relations=['owner'])()
     self.assertEqual(1, len(payments))
     self.assertIsInstance(payments[0].owner, MainUser)
     self.assertEqual('*****@*****.**', payments[0].owner.email)
     self.assertEqual('José Comprador', payments[0].owner.name)
Ejemplo n.º 5
0
    def test_credit_card_reader_payment(self):
        # Payment creation
        cmd = pagseguro_facade.procces_external_payment_cmd(
            create_credit_card_xml())
        cmd()
        payment = PagSegPayment.query().get()
        self.assertEqual('6F09ACBC-BEC1-463F-9174-5E0CF5BE33F1', payment.code)
        self.assertEqual(Decimal('1.00'), payment.total)
        self.assertEqual(Decimal('0.98'), payment.net_amount)
        self.assertEqual(STATUS_AVAILABLE, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertEqual(1, len(logs))
        self.assertEqual(STATUS_AVAILABLE, logs[0].status)
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(1, len(items))
        item = items[0]
        self.assertEqual(Decimal('1.00'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Venda pelo celular com leitor de chip e senha',
                         item.description)

        # Payment update
        cmd = pagseguro_facade.procces_external_payment_cmd(
            create_credit_card_xml(7))
        cmd()
        payments = PagSegPayment.query().fetch()
        self.assertEqual(1, len(payments))
        payment = payments[0]

        self.assertEqual('6F09ACBC-BEC1-463F-9174-5E0CF5BE33F1', payment.code)
        self.assertEqual(Decimal('1.00'), payment.total)
        self.assertEqual(Decimal('0.98'), payment.net_amount)
        self.assertEqual(STATUS_CANCELLED, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertListEqual([STATUS_AVAILABLE, STATUS_CANCELLED],
                             [log.status for log in logs])
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(1, len(items))
        item = items[0]
        self.assertEqual(Decimal('1.00'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Venda pelo celular com leitor de chip e senha',
                         item.description)
Ejemplo n.º 6
0
    def test_integration_button_payment(self):
        # Payment creation
        cmd = pagseguro_facade.procces_external_payment_cmd(
            generate_xml('non particular id', '1', '18.99'))
        cmd()
        payment = PagSegPayment.query().get()
        self.assertEqual(CODE, payment.code)
        self.assertEqual(Decimal('49900'), payment.total)
        self.assertEqual(Decimal('18.99'), payment.net_amount)
        self.assertEqual(STATUS_SENT_TO_PAGSEGURO, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertEqual(1, len(logs))
        self.assertEqual(STATUS_SENT_TO_PAGSEGURO, logs[0].status)
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(2, len(items))
        item = items[0]
        self.assertEqual(Decimal('24300'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Notebook Prata', item.description)

        # Payment update
        cmd = pagseguro_facade.procces_external_payment_cmd(
            generate_xml('non particular id', '7', '18.99'))
        cmd()
        payments = PagSegPayment.query().fetch()
        self.assertEqual(1, len(payments))
        payment = payments[0]

        self.assertEqual(CODE, payment.code)
        self.assertEqual(Decimal('49900'), payment.total)
        self.assertEqual(Decimal('18.99'), payment.net_amount)
        self.assertEqual(STATUS_CANCELLED, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertListEqual([STATUS_SENT_TO_PAGSEGURO, STATUS_CANCELLED],
                             [log.status for log in logs])
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(2, len(items))
        item = items[0]
        self.assertEqual(Decimal('24300'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Notebook Prata', item.description)
Ejemplo n.º 7
0
    def test_integration_button_payment(self):
        # Payment creation
        cmd = pagseguro_facade.procces_external_payment_cmd(generate_xml('non particular id', '1', '18.99'))
        cmd()
        payment = PagSegPayment.query().get()
        self.assertEqual(CODE, payment.code)
        self.assertEqual(Decimal('49900'), payment.total)
        self.assertEqual(Decimal('18.99'), payment.net_amount)
        self.assertEqual(STATUS_SENT_TO_PAGSEGURO, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertEqual(1, len(logs))
        self.assertEqual(STATUS_SENT_TO_PAGSEGURO, logs[0].status)
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(2, len(items))
        item = items[0]
        self.assertEqual(Decimal('24300'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Notebook Prata', item.description)

        # Payment update
        cmd = pagseguro_facade.procces_external_payment_cmd(generate_xml('non particular id', '7', '18.99'))
        cmd()
        payments = PagSegPayment.query().fetch()
        self.assertEqual(1, len(payments))
        payment = payments[0]

        self.assertEqual(CODE, payment.code)
        self.assertEqual(Decimal('49900'), payment.total)
        self.assertEqual(Decimal('18.99'), payment.net_amount)
        self.assertEqual(STATUS_CANCELLED, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertListEqual([STATUS_SENT_TO_PAGSEGURO, STATUS_CANCELLED], [log.status for log in logs])
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(2, len(items))
        item = items[0]
        self.assertEqual(Decimal('24300'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Notebook Prata', item.description)
Ejemplo n.º 8
0
    def test_credit_card_reader_payment(self):
        # Payment creation
        cmd = pagseguro_facade.procces_external_payment_cmd(create_credit_card_xml())
        cmd()
        payment = PagSegPayment.query().get()
        self.assertEqual('6F09ACBC-BEC1-463F-9174-5E0CF5BE33F1', payment.code)
        self.assertEqual(Decimal('1.00'), payment.total)
        self.assertEqual(Decimal('0.98'), payment.net_amount)
        self.assertEqual(STATUS_AVAILABLE, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertEqual(1, len(logs))
        self.assertEqual(STATUS_AVAILABLE, logs[0].status)
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(1, len(items))
        item = items[0]
        self.assertEqual(Decimal('1.00'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Venda pelo celular com leitor de chip e senha', item.description)

        # Payment update
        cmd = pagseguro_facade.procces_external_payment_cmd(create_credit_card_xml(7))
        cmd()
        payments = PagSegPayment.query().fetch()
        self.assertEqual(1, len(payments))
        payment = payments[0]

        self.assertEqual('6F09ACBC-BEC1-463F-9174-5E0CF5BE33F1', payment.code)
        self.assertEqual(Decimal('1.00'), payment.total)
        self.assertEqual(Decimal('0.98'), payment.net_amount)
        self.assertEqual(STATUS_CANCELLED, payment.status)
        logs = pagseguro_facade.search_logs(payment)()
        self.assertListEqual([STATUS_AVAILABLE, STATUS_CANCELLED], [log.status for log in logs])
        items = pagseguro_facade.search_items(payment)()
        self.assertEqual(1, len(items))
        item = items[0]
        self.assertEqual(Decimal('1.00'), item.price)
        self.assertEqual(1, item.quantity)
        self.assertEqual('Venda pelo celular com leitor de chip e senha', item.description)