Sha256: f6dbc5c47da3b82fad5475d2a897a79fa8d59b463c0eb855955a5e1b2d10d197

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module WellsFargo
  module Endpoints
    class Wires < Base
      SCOPE = 'Wires-Payments-Template Wires-Payments Wires-Payments-Status'

      def create_payment(payload)
        client.execute(
          :post, 'wires/v1/payments',
          headers: headers.merge('Content-Type' => 'application/json'),
          body: payload
        )
      end

      def check_status(payment_id)
        client.execute(
          :get, "wires/v1/payments/#{payment_id}",
          headers: headers,
          query: { detail: :no }
        )
      end

      private

      def headers
        {
          'Authorization' => "Bearer #{client.token.generate(SCOPE)}",
          'client-request-id' => SecureRandom.uuid,
          'gateway-entity-id' => client.credentials[:gateway_entity_id]
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wells_fargo-api-0.1.0 lib/wells_fargo/endpoints/wires.rb