Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait BaseMerchantProtocol {
- protected def doCheck(transaction: BaseTransaction, requestParams: List[String]) = {
- // some common code...
- println(requestParams) // this one is specific-class-dependent
- // ...and here is common code as well
- }
- protected def requestParams(): List[String]
- }
- class SmsCommerceMerchantProtocol(private val smsCommerceTransaction: SmsCommerceTransaction) extends BaseMerchantProtocol
- {
- def check = {
- doCheck(smsCommerceTransaction, requestParams())
- }
- protected def requestParams() = {
- List("result specific for SmsCommerceTransaction class")
- }
- }
- class TelepayMerchantProtocol(private val telepayTransaction: TelepayTransaction) extends BaseMerchantProtocol
- {
- def check = {
- doCheck(telepayTransaction, requestParams())
- }
- protected def requestParams() = {
- List("result specific for TelepayTransaction class")
- }
- }
- trait BaseTransaction
- class SmsCommerceTransaction extends BaseTransaction
- class TelepayTransaction extends BaseTransaction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement