當前位置: 首頁>>代碼示例>>Python>>正文


Python OrderPaymentFactory.create方法代碼示例

本文整理匯總了Python中bluebottle.test.factory_models.payments.OrderPaymentFactory.create方法的典型用法代碼示例。如果您正苦於以下問題:Python OrderPaymentFactory.create方法的具體用法?Python OrderPaymentFactory.create怎麽用?Python OrderPaymentFactory.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bluebottle.test.factory_models.payments.OrderPaymentFactory的用法示例。


在下文中一共展示了OrderPaymentFactory.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:9,代碼來源:test_api.py

示例2: test_normal_userdata

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:35,代碼來源:test_models.py

示例3: test_no_payment_method_change

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:31,代碼來源:test_models.py

示例4: test_incomplete_userdata

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:35,代碼來源:test_models.py

示例5: test_authorization_action

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:36,代碼來源:test_adapters.py

示例6: setUp

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:9,代碼來源:test_models.py

示例7: setUp

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:10,代碼來源:test_models.py

示例8: setUp

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:11,代碼來源:test_adapters.py

示例9: setUp

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:11,代碼來源:test_unittests.py

示例10: test_no_success_payment_status_check

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
 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,代碼行數:11,代碼來源:test_api.py

示例11: test_success_payment_status_check

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:13,代碼來源:test_api.py

示例12: setUp

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:13,代碼來源:test_models.py

示例13: test_direct_debit_wrong_pm

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
 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,代碼行數:14,代碼來源:test_models.py

示例14: test_order_status_cannot_pledge

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:15,代碼來源:test_adapter.py

示例15: test_get_fee_absolute

# 需要導入模塊: from bluebottle.test.factory_models.payments import OrderPaymentFactory [as 別名]
# 或者: from bluebottle.test.factory_models.payments.OrderPaymentFactory import create [as 別名]
    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,代碼行數:15,代碼來源:test_models.py


注:本文中的bluebottle.test.factory_models.payments.OrderPaymentFactory.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。