57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#pragma once
|
|
#include "Product.h"
|
|
#include "AccountRequisites.h"
|
|
#include <string>
|
|
#include "Account.h"
|
|
|
|
class Transaction : public Product
|
|
{
|
|
public:
|
|
AccountRequisites payerRequisites;
|
|
AccountRequisites recipientRequisites;
|
|
unsigned long long amount = 0;
|
|
unsigned int date = 0;
|
|
|
|
Transaction() : Product("Äåíåæíûå ïåðåâîäû") {};
|
|
Transaction(std::string name): Product (name) {};
|
|
Transaction(
|
|
std::string name,
|
|
bool isAvailable,
|
|
AccountRequisites payerRequisites,
|
|
AccountRequisites recipientRequisites,
|
|
unsigned long long amount,
|
|
unsigned int date
|
|
) : Product(
|
|
name,
|
|
isAvailable
|
|
) {
|
|
this->payerRequisites = payerRequisites;
|
|
this->recipientRequisites = recipientRequisites;
|
|
this->amount = amount;
|
|
this->date = date;
|
|
};
|
|
Transaction(
|
|
bool isAvailable,
|
|
AccountRequisites payerRequisites,
|
|
AccountRequisites recipientRequisites,
|
|
unsigned long long amount,
|
|
unsigned int date
|
|
) : Product(
|
|
"Äåíåæíûå ïåðåâîäû",
|
|
isAvailable
|
|
) {
|
|
this->payerRequisites = payerRequisites;
|
|
this->recipientRequisites = recipientRequisites;
|
|
this->amount = amount;
|
|
this->date = date;
|
|
};
|
|
void execute() {};
|
|
void cancel() {};
|
|
std::string executeTest(Account account) {
|
|
return ((account.balance < this->amount) ? \
|
|
"Îïåðàöèÿ îòêëîíåíà, íåäîñòàòî÷íî ñðåäñòâ\n" : \
|
|
"Èñïîëíåíî\n");
|
|
};
|
|
};
|
|
|