Sha256: f6046fdc32015322cfb5ab2a1652cee623ca498bbb573b106c57109e388f166b

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

module NedbankApi
  class PaymentsApi < ApiWrapper
    class << self
      def create_intent(request_body: {})
        http = Http.new(url: endpoint('/open-banking/payments'))

        response = http.post(
          headers: auth_headers,
          body: request_body.to_json
        )

        return Models::Payment.new(json_to_object(response.body))
      end

      def submit_payment(request_body: {})
        http = Http.new(url: endpoint('/open-banking/payment-submissions'))

        response = http.post(
          headers: auth_headers,
          body: request_body.to_json
        )

        return Models::PaymentSubmission.new(json_to_object(response.body))
      end

      def get_payment_submission(payment_submission_id:)
        http = Http.new(url: endpoint('/open-banking/payment-submissions/' + payment_submission_id))

        response = http.get(
          headers: auth_headers
        )

        return Models::PaymentSubmission.new(json_to_object(response.body))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nedbank_api-0.2.2 lib/nedbank_api/payments_api.rb