Skip to content

Instantly share code, notes, and snippets.

@vgarro
Created June 2, 2022 00:17
Show Gist options
  • Save vgarro/42ce27287099114a70d87dfc77627e1c to your computer and use it in GitHub Desktop.
Save vgarro/42ce27287099114a70d87dfc77627e1c to your computer and use it in GitHub Desktop.
Lizcov Substitution Coding challenge
# Lizcov
class Payable
def pay(amount:, credit_card_details:)
payment_processor.charge!(amount: amount, credit_card_details: credit_card_details)
end
end
class Bill < Payable
def charge_credit_card(amount:, credit_card_details:)
pay(amount:, credit_card_details:)
end
def payment_processor
CreditCardPaymentProcessor
end
end
class Loan < Payable
def authorize_loan
# some Loan Authorization Logic
end
def payment_processor
LoanPaymentProcessor
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment