Created
May 2, 2019 09:12
-
-
Save godrm/5fb03d962d481e056735d78dfd321ba6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CustomerRepositoryProtocol { | |
} | |
protocol ProductRepositoryProtocol { | |
} | |
struct ConversionRate { | |
var fromCurrency : String | |
var toCurrency : String | |
var ratio = 0.0 | |
} | |
protocol ForienExchangeProtocol { | |
func conversionRates() -> [ConversionRate] | |
} | |
protocol RequestHandlerProtocol { | |
associatedtype command | |
func handle(request : command, canCancel : Bool) | |
} | |
class AddCustomerOrderCommandHandler : RequestHandlerProtocol { | |
typealias command = AddCustomerOrderCommand | |
private (set) var customerRepository : CustomerRepositoryProtocol | |
private (set) var productRepositoty : ProductRepositoryProtocol | |
private (set) var foreignExchange : ForienExchangeProtocol | |
init(customerRepository : CustomerRepositoryProtocol, | |
productRepositoty : ProductRepositoryProtocol, | |
foreignExchange : ForienExchangeProtocol) { | |
self.customerRepository = customerRepository | |
self.productRepositoty = productRepositoty | |
self.foreignExchange = foreignExchange | |
} | |
func handle(request: AddCustomerOrderCommand, canCancel: Bool) { | |
// | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment