Fakultas Ilmu Komputer UI

Commit 72180ce0 authored by rayhan muzakki's avatar rayhan muzakki
Browse files

fixed and tested batch bug in transactions

parent aab3c788
{
"python.pythonPath": "C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"
"python.pythonPath": "C:\\Users\\Rayhan Muzakki\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"
}
\ No newline at end of file
......@@ -99,7 +99,7 @@ SHIPMENT_CONFIG_DATA = {
BATCH_DATA = {
'batch_name': 'Batch 1',
'start_date': '2020-10-08',
'end_date': '2020-10-15',
'start_date': '2020-12-12',
'end_date': '2020-12-18',
'shipping_cost': '60000',
}
......@@ -51,8 +51,8 @@ def fill_dependent_transaction_fields(sender, instance, **_kwargs):
instance.transfer_destination_bank_account_number = (
instance.bank_account_transfer_destination.bank_account_number
)
if (obj is not None) and (instance.transaction_status == '002'):
if (instance.transaction_status == '002'):
if instance.batch is None:
instance.batch = utils.get_batch_transaction(instance)
instance.batch_name = instance.batch.batch_name
......
......@@ -292,6 +292,7 @@ class CartTest(rest_framework_test.APITestCase): # pylint: disable=too-many-inst
))
self.shopping_cart = models.ShoppingCart.objects.get(user=self.user)
self.proof_of_payment_file = create_tmp_image()
self.batch = models.Batch.objects.create(**seeds.BATCH_DATA)
def test_cart_checkout_success(self):
data = {
......
......@@ -178,6 +178,8 @@ class CartCheckout(rest_framework_views.APIView):
start_date__lte=timezone.now().date(),
end_date__gte=timezone.now().date()).first()
)
transaction = models.Transaction.objects.create(
user=user,
payment_method=serializer.validated_data['payment_method'],
......@@ -656,6 +658,8 @@ class ProductDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = models.Product.objects.all()
serializer_class = api_serializers.ProductSerializer
class ProgramProgressList(generics.ListCreateAPIView):
permission_classes = [
api_permissions.IsAdminUserOrReadOnly,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment