drinkMe/drinkMe/Server/Services/PaymentService.cs

26 lines
742 B
C#
Raw Normal View History

2021-04-26 15:35:44 +02:00
using drinkMe.Server.Services.Interfaces;
using drinkMe.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace drinkMe.Server.Services
{
public class PaymentService : IPaymentService
{
public async Task<bool> Pay(PurchaseCart purchaseCart)
{
2021-04-26 19:33:07 +02:00
if (!purchaseCart.IsPayedWithCash &&
(purchaseCart.CreditCardNumber is { Length: 0 } || purchaseCart.CreditCardExpirationYear is { Length: 0 } ||
purchaseCart.CreditCardExpirationMonth is { Length: 0 } || purchaseCart.CreditCardCVVCode is { Length: 0 }))
return false;
if (purchaseCart.PurchasingItems.Count == 0)
return false;
2021-04-26 15:35:44 +02:00
//completing the purchase
return true;
}
}
}