def test_basic_payment(self): # Create the payment. order = Order.objects.create() order.save() payment = factory.create_payment_object(order, 'dd-webmenu', amount=2000, currency='EUR') payment.country = 'NL' payment.city = 'Amsterdam' payment.address = 'Dam' payment.postal_code = '1001AM' payment.first_name = 'Nijntje' payment.last_name = 'het Konijntje' payment.email = '*****@*****.**' payment.save() payments.create_remote_payment_order(payment) # Check that the order key has been saved. self.assertTrue(payment.payment_order_id) # Test that the payment url works. payment_url = payments.get_payment_url(payment) response = requests.get(payment_url) self.assertEqual(response.status_code, 200) # Test the status changed notification. response = self.client.get('/api/docdatastatuschanged/?order={0}'.format(payment.merchant_order_reference)) self.assertEqual(response.status_code, status.HTTP_200_OK)
def get_payment_url(self, payment): if payment.payment_method_id: return payments.get_payment_url(payment, getattr(settings, "COWRY_RETURN_URL_BASE")) return None