Skip to content

Instantly share code, notes, and snippets.

@radzserg
Created December 16, 2020 15:40
Show Gist options
  • Select an option

  • Save radzserg/31726b41e721dd0064c837878dbd25ff to your computer and use it in GitHub Desktop.

Select an option

Save radzserg/31726b41e721dd0064c837878dbd25ff to your computer and use it in GitHub Desktop.
class OrderManager {
public createOrder(orderData) {
(new OrderValidator).validateOrderInput(orderData);
const total = (new OrderCalculator).calculateTotal(orderData);
(new MyPaymentGateway).processPayment(total, { meta: "info" });
return (new OrderRepository()).save(orderData);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment