Method: ZipMoney::Capture#validate
- Defined in:
- lib/zipMoney/api/capture.rb
#validate ⇒ Object
Performs the parameters validation
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zipMoney/api/capture.rb', line 28 def validate raise ArgumentError, "Params emtpy" if @params.nil? @errors = [] @errors << 'txn_id must be provided' if @params.txn_id.nil? @errors << 'order.id must be provided' if @params.order.id.nil? @errors << 'order.total must be provided' if @params.order.total.nil? @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? @errors << 'order.tax must be provided' if @params.order.tax.nil? raise ZipMoney::RequestError.new("Following error(s) occurred while making request, please resolve them to make the request: #{@errors}") if @errors.any? end |