From 1ca24248812c3f3e26d29d0e01e369b4c681268a Mon Sep 17 00:00:00 2001 From: Maksim Slepukhov Date: Fri, 25 Mar 2016 15:54:42 +0300 Subject: [PATCH] Add create_payments method --- lib/xero_gateway/gateway.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/xero_gateway/gateway.rb b/lib/xero_gateway/gateway.rb index c648754e..e1f585ea 100644 --- a/lib/xero_gateway/gateway.rb +++ b/lib/xero_gateway/gateway.rb @@ -571,6 +571,22 @@ def create_payment(payment) parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/payments'}) end + # + # Create Payments records in Xero + # + def create_payments(payments) + b = Builder::XmlMarkup.new + + request_xml = b.Payments do + payments.each do | payment | + payment.to_xml(b) + end + end + + response_xml = http_put(@client, "#{xero_url}/Payments", request_xml) + parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/payments'}) + end + # # Gets all Payments for a specific organisation in Xero #