-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpayment_processor_credit_liskov.h
More file actions
35 lines (28 loc) · 1.1 KB
/
payment_processor_credit_liskov.h
File metadata and controls
35 lines (28 loc) · 1.1 KB
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
//
// Created by bender on 16/11/2021.
//
#ifndef SOLID_PRINCIPLES_INCLUDE_PAYMENT_PROCESSOR_CREDIT_LISKOV_H_
#define SOLID_PRINCIPLES_INCLUDE_PAYMENT_PROCESSOR_CREDIT_LISKOV_H_
#include "payment_processor_abstract_liskov.h"
#include "spdlog/spdlog.h"
#include "trouble.h"
struct PaymentProcessorCreditLiskov final : public PaymentProcessorAbstractLiskov {
explicit PaymentProcessorCreditLiskov(NewOrder &new_order, std::string_view security_code)
: new_order_{new_order}
, security_code_{security_code} {}
void AuthSMS(std::string_view sms_code) override {
throw Trouble("Credit card payments don't support SMS code authorization.");
}
void Pay() const override {
spdlog::info("Processing credit payment type");
spdlog::info("Verifying security code: {0}", security_code_);
new_order_.SetStatus(Status::Paid);
}
void DisplayInfo() const override {
spdlog::info("Credit payment processor for order {0}", to_string(new_order_.GetId()));
}
private:
NewOrder &new_order_;
std::string_view security_code_;
};
#endif//SOLID_PRINCIPLES_INCLUDE_PAYMENT_PROCESSOR_CREDIT_LISKOV_H_