Skip to content

Instantly share code, notes, and snippets.

@godrm
Created May 2, 2019 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save godrm/5fb03d962d481e056735d78dfd321ba6 to your computer and use it in GitHub Desktop.
Save godrm/5fb03d962d481e056735d78dfd321ba6 to your computer and use it in GitHub Desktop.
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