-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_is_comp.cpp
49 lines (42 loc) · 1.24 KB
/
main_is_comp.cpp
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
49
#include "item.h"
#include "new_order.h"
#include "payment_processor_credit_is_comp.h"
#include "payment_processor_debit_is_comp.h"
#include "payment_processor_paypal_is_comp.h"
#include "spdlog/spdlog.h"
int main() {
Item item1{"Keyboard", 1, 50.0};
Item item2{"SSD", 1, 150.0};
Item item3{"USB cable", 2, 5.0};
NewOrder an_order{};
an_order.AddItem(item1);
an_order.AddItem(item2);
an_order.AddItem(item3);
an_order.PrintOrder();
auto authorizer1 = std::make_shared<SMSAuthorizer>();
PaymentProcessorDebitISComp processor1{an_order, "65379", authorizer1};
try {
processor1.DisplayInfo();
authorizer1->VerifyCode("7987356");
processor1.Pay();
} catch (const std::exception &e) {
spdlog::error(e.what());
}
PaymentProcessorCreditISComp processor2{an_order, "65379"};
try {
processor2.DisplayInfo();
processor2.Pay();
} catch (const std::exception &e) {
spdlog::error(e.what());
}
auto authorizer3 = std::make_shared<SMSAuthorizer>();
PaymentProcessorPaypalISComp processor3{an_order, "angelos@in.gr", authorizer3};
try {
processor3.DisplayInfo();
authorizer3->VerifyCode("9778555");
processor3.Pay();
} catch (const std::exception &e) {
spdlog::error(e.what());
}
return 0;
}