Class: Stripe::Terminal::Reader::TestHelpers

Inherits:
APIResourceTestHelpers show all
Defined in:
lib/stripe/resources/terminal/reader.rb

Constant Summary collapse

RESOURCE_CLASS =
Reader

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResourceTestHelpers

custom_method, #initialize, resource_url, #resource_url

Methods included from APIOperations::Request

included

Constructor Details

This class inherits a constructor from Stripe::APIResourceTestHelpers

Class Method Details

.present_payment_method(reader, params = {}, opts = {}) ⇒ Object

Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.



864
865
866
867
868
869
870
871
# File 'lib/stripe/resources/terminal/reader.rb', line 864

def self.present_payment_method(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.resource_classObject



859
860
861
# File 'lib/stripe/resources/terminal/reader.rb', line 859

def self.resource_class
  "Reader"
end

.succeed_input_collection(reader, params = {}, opts = {}) ⇒ Object

Use this endpoint to trigger a successful input collection on a simulated reader.



884
885
886
887
888
889
890
891
# File 'lib/stripe/resources/terminal/reader.rb', line 884

def self.succeed_input_collection(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/succeed_input_collection", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.timeout_input_collection(reader, params = {}, opts = {}) ⇒ Object

Use this endpoint to complete an input collection with a timeout error on a simulated reader.



904
905
906
907
908
909
910
911
# File 'lib/stripe/resources/terminal/reader.rb', line 904

def self.timeout_input_collection(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/timeout_input_collection", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#present_payment_method(params = {}, opts = {}) ⇒ Object

Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.



874
875
876
877
878
879
880
881
# File 'lib/stripe/resources/terminal/reader.rb', line 874

def present_payment_method(params = {}, opts = {})
  @resource.request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(@resource["id"]) }),
    params: params,
    opts: opts
  )
end

#succeed_input_collection(params = {}, opts = {}) ⇒ Object

Use this endpoint to trigger a successful input collection on a simulated reader.



894
895
896
897
898
899
900
901
# File 'lib/stripe/resources/terminal/reader.rb', line 894

def succeed_input_collection(params = {}, opts = {})
  @resource.request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/succeed_input_collection", { reader: CGI.escape(@resource["id"]) }),
    params: params,
    opts: opts
  )
end

#timeout_input_collection(params = {}, opts = {}) ⇒ Object

Use this endpoint to complete an input collection with a timeout error on a simulated reader.



914
915
916
917
918
919
920
921
# File 'lib/stripe/resources/terminal/reader.rb', line 914

def timeout_input_collection(params = {}, opts = {})
  @resource.request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/timeout_input_collection", { reader: CGI.escape(@resource["id"]) }),
    params: params,
    opts: opts
  )
end