Sha256: 3ce90b4edda68eab1d6f33a583116d8a422cd14c02db1078ea436a14686377a5
Contents?: true
Size: 925 Bytes
Versions: 12
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true module DefraRubyMocks class WorldpayRefundService < BaseService def run(merchant_code:, xml:) { merchant_code: merchant_code, order_code: extract_order_code(xml), refund_value: extract_refund_value(xml), currency_code: extract_currency_code(xml), exponent: extract_exponent(xml) } end private def extract_order_code(xml) order_modification = xml.at_xpath("//orderModification") order_modification.attribute("orderCode").text end def extract_refund_value(xml) amount = xml.at_xpath("//amount") amount.attribute("value").text end def extract_currency_code(xml) amount = xml.at_xpath("//amount") amount.attribute("currencyCode").text end def extract_exponent(xml) amount = xml.at_xpath("//amount") amount.attribute("exponent").text end end end
Version data entries
12 entries across 12 versions & 1 rubygems