当前位置: 首页>>代码示例>>Python>>正文


Python payments.OrderPaymentFactory类代码示例

本文整理汇总了Python中bluebottle.test.factory_models.payments.OrderPaymentFactory的典型用法代码示例。如果您正苦于以下问题:Python OrderPaymentFactory类的具体用法?Python OrderPaymentFactory怎么用?Python OrderPaymentFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OrderPaymentFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):
        super(PaymentMockTests, self).setUp()
        self.init_projects()

        self.order_payment = OrderPaymentFactory.create(status=StatusDefinition.CREATED, amount=100, payment_method='mock')
        self.user1 = BlueBottleUserFactory.create()
        self.user1_token = "JWT {0}".format(self.user1.get_jwt_token())
开发者ID:pombredanne,项目名称:bluebottle,代码行数:7,代码来源:test_api.py

示例2: test_normal_userdata

    def test_normal_userdata(self, mock_client_create):
        mock_client_create.return_value = {'order_key': 123, 'order_id': 123}
        mock_create_payment = patch.object(DocdataPaymentAdapter, 'create_payment', fake_create_payment)

        user = BlueBottleUserFactory()
        holland = CountryFactory(name='Netherlands', alpha2_code='NL')

        address = BlueBottleAddressFactory(user=user, line1='Dam 1a', line2='Bovenste bel', city='Amsterdam',
                                           postal_code='1000AA', country=holland)

        self.order = OrderFactory.create(user=user)
        self.order_payment = OrderPaymentFactory.create(order=self.order, payment_method='docdataIdeal',
                                                        integration_data={'default_pm': 'ideal'})

        self.service = PaymentService(order_payment=self.order_payment)

        user_data = self.service.adapter.get_user_data()
        self.assertEqual(user_data['id'], user.id)
        self.assertEqual(user_data['first_name'], user.first_name)
        self.assertEqual(user_data['last_name'], user.last_name)
        self.assertEqual(user_data['email'], user.email)

        self.assertEqual(user_data['street'], 'Dam')
        self.assertEqual(user_data['house_number'], '1a')
        self.assertEqual(user_data['postal_code'], '1000AA')
        self.assertEqual(user_data['city'], 'Amsterdam')
        self.assertEqual(user_data['country'], 'NL')

        self.assertEqual(user_data['company'], '')
        self.assertEqual(user_data['kvk_number'], '')
        self.assertEqual(user_data['vat_number'], '')
        self.assertEqual(user_data['house_number_addition'], '')
        self.assertEqual(user_data['state'], '')
开发者ID:maykinmedia,项目名称:bluebottle,代码行数:33,代码来源:test_models.py

示例3: test_no_payment_method_change

    def test_no_payment_method_change(self, mock_fetch_status,
                                      mock_transaction):
        self.assertEquals(PaymentLogEntry.objects.count(), 1)

        # Mock the status check with docdata
        mock_fetch_status.return_value = self.create_status_response(
            'AUTHORIZED')

        order = OrderFactory.create()
        order_payment = OrderPaymentFactory.create(
            order=order, payment_method='docdataCreditcard')
        docdata_payment = DocdataPaymentFactory.create(
            order_payment=order_payment,
            default_pm='mastercard',
            payment_cluster_id='1234',
            total_gross_amount=100)
        DocdataTransactionFactory.create(payment=docdata_payment,
                                         payment_method='VISA')
        c = Client()
        merchant_order_id = "{0}-1".format(order_payment.id)
        resp = c.get(reverse('docdata-payment-status-update',
                             kwargs={'merchant_order_id': merchant_order_id}))

        self.assertEqual(resp.status_code, 200)
        self.assertEqual(resp.content, 'success')

        # Reload the order payment
        order_payment = OrderPayment.objects.get(id=order_payment.id)
        self.assertEqual(order_payment.payment_method, 'docdataCreditcard')
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:29,代码来源:test_models.py

示例4: test_incomplete_userdata

    def test_incomplete_userdata(self, mock_client):
        # Mock response to creating the payment at docdata
        instance = mock_client.return_value
        instance.create.return_value = {'order_key': 123, 'order_id': 123}

        patch.object(DocdataPaymentAdapter, 'create_payment',
                     fake_create_payment)

        user = BlueBottleUserFactory()
        self.order = OrderFactory.create(user=user)
        self.order_payment = OrderPaymentFactory.create(
            order=self.order, payment_method='docdataIdeal',
            integration_data={'default_pm': 'ideal'})

        self.service = PaymentService(order_payment=self.order_payment)

        user_data = self.service.adapter.get_user_data()
        self.assertEqual(user_data['id'], user.id)
        self.assertEqual(user_data['first_name'], user.first_name)
        self.assertEqual(user_data['last_name'], user.last_name)
        self.assertEqual(user_data['email'], user.email)

        self.assertEqual(user_data['street'], 'Unknown')
        self.assertEqual(user_data['house_number'], 'Unknown')
        self.assertEqual(user_data['postal_code'], 'Unknown')
        self.assertEqual(user_data['city'], 'Unknown')
        self.assertEqual(user_data['country'], 'NL')

        self.assertEqual(user_data['company'], '')
        self.assertEqual(user_data['kvk_number'], '')
        self.assertEqual(user_data['vat_number'], '')
        self.assertEqual(user_data['house_number_addition'], '')
        self.assertEqual(user_data['state'], '')
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:33,代码来源:test_models.py

示例5: test_authorization_action

    def test_authorization_action(self, mock_post, create_hash, get_current_host):
        """
        Play some posts that Vitepay might fire at us.
        """
        self.init_projects()
        order = OrderFactory.create()
        DonationFactory.create(amount=Money(2000, XOF), order=order)
        order_payment = OrderPaymentFactory.create(payment_method="vitepayOrangemoney", order=order)
        adapter = VitepayPaymentAdapter(order_payment)
        authorization_action = adapter.get_authorization_action()
        data = {
            u"api_key": u"123",
            u"hash": u"123123",
            u"redirect": 0,
            u"payment": {
                u"description": u"Thanks for your donation!",
                u"order_id": u"opc-{}".format(order_payment.id),
                u"decline_url": u"https://onepercentclub.com/orders/{}/failed".format(order_payment.order.id),
                u"p_type": u"orange_money",
                u"country_code": u"ML",
                u"language_code": u"fr",
                u"amount_100": 200000,
                u"cancel_url": u"https://onepercentclub.com/orders/{}/failed".format(order_payment.order.id),
                u"currency_code": u"XOF",
                u"callback_url": u"https://onepercentclub.com/payments_vitepay/status_update/",
                u"return_url": u"https://onepercentclub.com/orders/{}/success".format(order_payment.order.id),
            },
        }

        self.assertEqual(mock_post.call_args[0][0], "https://api.vitepay.com/v1/prod/payments")
        self.assertEqual(json.loads(mock_post.call_args[1]["data"]), data)
        self.assertEqual(mock_post.call_args[1]["headers"], {"Content-Type": "application/json"})

        self.assertEqual(authorization_action["url"], "https://vitepay.com/some-path-to-pay")
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:34,代码来源:test_adapters.py

示例6: setUp

    def setUp(self):
        super(PaymentFeeTestCase, self).setUp()
        self.init_projects()

        self.order = OrderFactory.create()
        self.donation = DonationFactory(amount=60, order=self.order)
        self.order_payment = OrderPaymentFactory.create(order=self.order)
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:7,代码来源:test_models.py

示例7: setUp

    def setUp(self):
        super(PaymentsMockTestCase, self).setUp()

    	self.init_projects()

        self.order = OrderFactory.create(total=35)
        self.order_payment = OrderPaymentFactory.create(order=self.order, payment_method='mock')
        self.service = PaymentService(order_payment=self.order_payment)
开发者ID:pombredanne,项目名称:bluebottle,代码行数:8,代码来源:test_models.py

示例8: setUp

    def setUp(self):
        self.order = OrderFactory.create(total=Money(200, 'EUR'))
        self.order_payment = OrderPaymentFactory.create(
            payment_method='docdata',
            order=self.order
        )

        PaymentFactory.create(order_payment=self.order_payment)
        self.adapter = BasePaymentAdapter(self.order_payment)
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:9,代码来源:test_adapters.py

示例9: setUp

    def setUp(self, mock_client_create):
        super(TestPaymentLogger, self).setUp()

        mock_client_create.return_value = {'order_key': 123, 'order_id': 123}

        self.order = OrderFactory.create(total=35)
        self.order_payment = OrderPaymentFactory.create(payment_method='docdataIdeal', order=self.order,
                                                        integration_data={'default_pm': 'ideal'})
        self.service = PaymentService(self.order_payment)
开发者ID:pombredanne,项目名称:bluebottle,代码行数:9,代码来源:test_unittests.py

示例10: test_no_success_payment_status_check

 def test_no_success_payment_status_check(self, mock_check_payment_status):
     self.order = OrderFactory.create(user=self.user1, total=15)
     self.order_payment = OrderPaymentFactory.create(order=self.order,
                                                     payment_method='mock')
     self.service = PaymentService(order_payment=self.order_payment)
     self.client.get(reverse('manage-order-detail',
                             kwargs={'pk': self.order.id}),
                     token=self.user1_token)
     self.assertEqual(mock_check_payment_status.called, True)
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:9,代码来源:test_api.py

示例11: test_success_payment_status_check

    def test_success_payment_status_check(self, mock_check_payment_status):
        self.order = OrderFactory.create(user=self.user1, total=15,
                                         status=StatusDefinition.SUCCESS)
        self.order_payment = OrderPaymentFactory.create(order=self.order,
                                                        payment_method='mock',
                                                        status=StatusDefinition.AUTHORIZED)

        self.client.get(reverse('manage-order-detail',
                                kwargs={'pk': self.order.id}),
                        token=self.user1_token)
        self.assertEqual(mock_check_payment_status.called, False)
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:11,代码来源:test_api.py

示例12: setUp

    def setUp(self, mock_client_create):
        # Mock response to creating the payment at docdata
        mock_client_create.return_value = {'order_key': 123, 'order_id': 123}

        # Mock create payment
        mock_create_payment = patch.object(DocdataPaymentAdapter, 'create_payment', fake_create_payment)

        self.order = OrderFactory.create()
        self.order_payment = OrderPaymentFactory.create(order=self.order, payment_method='docdataIdeal',
                                                        integration_data={'default_pm': 'ideal'})
        self.service = PaymentService(order_payment=self.order_payment)
开发者ID:maykinmedia,项目名称:bluebottle,代码行数:11,代码来源:test_models.py

示例13: test_direct_debit_wrong_pm

 def test_direct_debit_wrong_pm(self):
     """
     Test that a direct debit payments default_pm will be forced
     to 'sepa_direct_debit'.
     """
     order_payment = OrderPaymentFactory.create(amount=1000)
     docdata_payment = DocdataDirectdebitPaymentFactory.create(
         order_payment=order_payment,
         default_pm='ideal',
         total_gross_amount=1000
     )
     self.assertEqual(docdata_payment.default_pm, 'sepa_direct_debit')
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:12,代码来源:test_models.py

示例14: test_order_status_cannot_pledge

    def test_order_status_cannot_pledge(self):
        """
        Normal user can not pledge
        """
        user = BlueBottleUserFactory()

        order = OrderFactory.create(user=user)
        order_payment = OrderPaymentFactory.create(
            order=order, user=user, payment_method='pledgeStandard'
        )

        with self.assertRaises(PaymentException):
            self.service = PaymentService(order_payment=order_payment)
开发者ID:jfterpstra,项目名称:bluebottle,代码行数:13,代码来源:test_adapter.py

示例15: test_get_fee_absolute

    def test_get_fee_absolute(self):
        """
            Test that the correct fee is returned given the defined percentage. In this test case the
            amount is 100 and the fee percentage is 1.5%, so the result should be 100 * 0.015.
        """

        order_payment = OrderPaymentFactory.create(amount=1000)
        docdata_payment = DocdataPaymentFactory.create(order_payment=order_payment,
                                                       default_pm='ideal',
                                                       total_gross_amount=1000)
        order_payment.amount = 100
        fee_total = docdata_payment.get_fee()
        self.assertEqual(fee_total, 100 * 0.015)
开发者ID:pombredanne,项目名称:bluebottle,代码行数:13,代码来源:test_models.py


注:本文中的bluebottle.test.factory_models.payments.OrderPaymentFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。