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.



856
857
858
859
860
861
862
863
# File 'lib/stripe/resources/terminal/reader.rb', line 856

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



851
852
853
# File 'lib/stripe/resources/terminal/reader.rb', line 851

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.



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

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.



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

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.



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

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.



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

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.



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

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