Sha256: f72e464d13301a60a36e52718445e395ca0ea3179ce471f9b561a55bdac3289b

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true

module DefraRubyMocks
  class GovpayRequestRefundService < BaseService

    def run(payment_id:, amount:, refund_amount_available:) # rubocop:disable Lint/UnusedMethodArgument
      write_timestamp

      # This currently supports only "submitted" status:
      {
        amount: amount,
        created_date: "2019-09-19T16:53:03.213Z",
        refund_id: SecureRandom.hex(22),
        status: "submitted"
      }
    end

    private

    # let the refund details service know how long since the refund was requested
    def write_timestamp
      filepath = "#{Dir.tmpdir}/govpay_request_refund_service_last_run_time"
      # FileUtils.touch seems unreliable in VM so need to write/read the actual time
      File.write(filepath, Time.zone.now)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
defra_ruby_mocks-4.1.0 app/services/defra_ruby_mocks/govpay_request_refund_service.rb
defra_ruby_mocks-4.0.0 app/services/defra_ruby_mocks/govpay_request_refund_service.rb