File size: 1,827 Bytes
8edbc20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.ComponentModel.DataAnnotations;
using Backend_Teamwork.src.Entities;

namespace Backend_Teamwork.src.DTO
{
    public class PaymentDTO
    {
        public class PaymentCreateDTO
        {
            [
                Required(ErrorMessage = "Payment method shouldn't be null"),
                MinLength(10, ErrorMessage = "Payment method should be at at least 10 characters"),
                MaxLength(30, ErrorMessage = "Payment method shouldn't be more than 30 characters")
            ]
            public string PaymentMethod { get; set; }

            [Range(1.0, double.MaxValue, ErrorMessage = "Price should be greater than zero.")]
            public decimal Amount { get; set; }
            public DateTime? CreatedAt { get; set; } = DateTime.Now;
            public Guid? OrderId { get; set; } = Guid.Empty;
            public Guid? BookingId { get; set; } = Guid.Empty;
        }

        public class PaymentReadDTO
        {
            public Guid Id { get; set; }
            public string PaymentMethod { get; set; }
            public decimal Amount { get; set; }
            public DateTime CreatedAt { get; set; }
            public Order? Order { get; set; }
            public Booking? Booking { get; set; }
        }

        public class PaymentUpdateDTO
        {
            [
                Required(ErrorMessage = "Payment method shouldn't be null"),
                MinLength(10, ErrorMessage = "Payment method should be at at least 10 characters"),
                MaxLength(30, ErrorMessage = "Payment method shouldn't be more than 30 characters")
            ]
            public string PaymentMethod { get; set; }

            [Range(1.0, double.MaxValue, ErrorMessage = "Amount should be greater than zero.")]
            public decimal Amount { get; set; }
        }
    }
}