class Docdata::Order::RefundRequest

Create a refund request in the DocData system.

Public Instance Methods

build_request(builder) click to toggle source
# File lib/docdata/order/request.rb, line 361
def build_request(builder)
  # The payment ID on which the refund request needs to be performed.
  builder.paymentId(payment_id)

  # Merchant's internal ID for identifying this refund.
  builder.merchantRefundReference(refund_reference) if refund_reference

  # Optional amount to refund.
  builder.amount(amount, currency: currency) if amount

  # Optional description for this refund.
  builder.description(description) if description
end

Private Instance Methods

amount() click to toggle source
# File lib/docdata/order/request.rb, line 385
def amount
  Amount.new(options[:amount]).to_cents if options[:amount]
end
currency() click to toggle source
# File lib/docdata/order/request.rb, line 389
def currency
  options[:currency] || "EUR"
end
description() click to toggle source
# File lib/docdata/order/request.rb, line 393
def description
  options[:description]
end
payment_id() click to toggle source
# File lib/docdata/order/request.rb, line 377
def payment_id
  options.fetch(:payment_id)
end
refund_reference() click to toggle source
# File lib/docdata/order/request.rb, line 381
def refund_reference
  options[:refund_reference]
end