Context
I'm building a single-page web app using AngularJS and a using REST api as backend.
The rest backend has the following services (simplification):
Problem
The problem emerges when I want to condition sms sending to the current account balance.
How to implement account balance validation while keeping the REST philosophy?
Alternative solutions
The way I see it, I have 2 alternatives:
Server-side pros and cons:
Client-side pros and cons:
Any thoughts?
How valuable/sensitive is your data? As a rule of thumb, never trust a client to protect your data. Anything worth protecting should be validated on the server side in addition to any validation you perform on the client side. There's nothing wrong with both, and its common practice to validate both on the client and on the server, it gives your user a richer experience while protecting your domain.
Good luck,
Matt