Class: Speedway::RefundAPI
- Inherits:
-
Object
- Object
- Speedway::RefundAPI
- Defined in:
- lib/speedway/refund_api.rb
Instance Attribute Summary collapse
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
-
#initialize(customer_id, password) ⇒ RefundAPI
constructor
A new instance of RefundAPI.
- #send_payment_refund(original_transaction, total_amount) ⇒ Object
Constructor Details
#initialize(customer_id, password) ⇒ RefundAPI
Returns a new instance of RefundAPI.
20 21 22 23 |
# File 'lib/speedway/refund_api.rb', line 20 def initialize(customer_id, password) @customer_id = customer_id @password = password end |
Instance Attribute Details
#customer_id ⇒ Object
Returns the value of attribute customer_id.
18 19 20 |
# File 'lib/speedway/refund_api.rb', line 18 def customer_id @customer_id end |
#password ⇒ Object
Returns the value of attribute password.
18 19 20 |
# File 'lib/speedway/refund_api.rb', line 18 def password @password end |
Instance Method Details
#send_payment_refund(original_transaction, total_amount) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/speedway/refund_api.rb', line 26 def send_payment_refund(original_transaction, total_amount) builder = Nokogiri::XML::Builder.new do |xml| xml.ewaygateway { xml.ewayCustomerID customer_id xml.ewayOriginalTrxnNumber original_transaction xml.ewayTotalAmount (total_amount * 100).to_i xml.ewayRefundPassword password xml.ewayCardExpiryMonth nil xml.ewayCardExpiryYear nil xml.ewayOption1 nil xml.ewayOption2 nil xml.ewayOption3 nil } end request = HTTPI::Request.new request.url = 'https://www.eway.com.au/gateway/xmlpaymentrefund.asp' request.body = builder.to_xml response = HTTPI.post(request) end |