Class: Twilio::REST::Api::V2010::AccountContext::CallContext::PaymentInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/payment.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil) ⇒ PaymentInstance

Initialize the PaymentInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Payments resource.

  • call_sid (String) (defaults to: nil)

    The SID of the [Call](www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF.

  • sid (String) (defaults to: nil)

    The SID of Payments session that needs to be updated.



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 254

def initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'call_sid' => payload['call_sid'],
      'sid' => payload['sid'],
      'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
      'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
      'uri' => payload['uri'],
  }

  # Context
  @instance_context = nil
  @params = {'account_sid' => , 'call_sid' => call_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the Payments resource.

Returns:

  • (String)

    The SID of the Account that created the Payments resource.



290
291
292
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 290

def 
  @properties['account_sid']
end

#call_sidString

Returns The SID of the Call the resource is associated with.

Returns:

  • (String)

    The SID of the Call the resource is associated with.



296
297
298
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 296

def call_sid
  @properties['call_sid']
end

#contextPaymentContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



276
277
278
279
280
281
282
283
284
285
286
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 276

def context
  unless @instance_context
    @instance_context = PaymentContext.new(
        @version,
        @params['account_sid'],
        @params['call_sid'],
        @params['sid'],
    )
  end
  @instance_context
end

#date_createdTime

Returns The RFC 2822 date and time in GMT that the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was created



308
309
310
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 308

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated



314
315
316
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 314

def date_updated
  @properties['date_updated']
end

#inspectObject

Provide a detailed, user friendly representation



359
360
361
362
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 359

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.PaymentInstance #{values}>"
end

#sidString

Returns The SID of the Payments resource.

Returns:

  • (String)

    The SID of the Payments resource.



302
303
304
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 302

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



352
353
354
355
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 352

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.PaymentInstance #{values}>"
end

#update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset) ⇒ PaymentInstance

Update the PaymentInstance

Parameters:

  • idempotency_key (String) (defaults to: nil)

    A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated.

  • status_callback (String) (defaults to: nil)

    Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [Update](www.twilio.com/docs/voice/api/payment-resource#statuscallback-update) and [Complete/Cancel](www.twilio.com/docs/voice/api/payment-resource#statuscallback-cancelcomplete) POST requests.

  • capture (payment.Capture) (defaults to: :unset)

    The piece of payment information that you wish the caller to enter. Must be one of ‘payment-card-number`, `expiration-date`, `security-code`, `postal-code`, `bank-routing-number`, or `bank-account-number`.

  • status (payment.Status) (defaults to: :unset)

    Indicates whether the current payment session should be cancelled or completed. When ‘cancel` the payment session is cancelled. When `complete`, Twilio sends the payment information to the selected <Pay> connector for processing.

Returns:



341
342
343
344
345
346
347
348
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 341

def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset)
  context.update(
      idempotency_key: idempotency_key,
      status_callback: status_callback,
      capture: capture,
      status: status,
  )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`



320
321
322
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 320

def uri
  @properties['uri']
end