Class: Airwallex::PaymentIntent

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List, APIOperations::Retrieve
Includes:
APIOperations::Update
Defined in:
lib/airwallex/resources/payment_intent.rb

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::Retrieve

retrieve

Methods included from APIOperations::List

list

Methods included from APIOperations::Update

included, #save, #update

Methods inherited from APIResource

#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, #to_hash, #to_json, #to_s

Constructor Details

This class inherits a constructor from Airwallex::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource

Class Method Details

.resource_pathObject



10
11
12
# File 'lib/airwallex/resources/payment_intent.rb', line 10

def self.resource_path
  "/api/v1/pa/payment_intents"
end

Instance Method Details

#cancel(params = {}) ⇒ Object

Cancel the payment intent



25
26
27
28
29
30
31
32
# File 'lib/airwallex/resources/payment_intent.rb', line 25

def cancel(params = {})
  response = Airwallex.client.post(
    "#{self.class.resource_path}/#{id}/cancel",
    params
  )
  refresh_from(response)
  self
end

#capture(params = {}) ⇒ Object

Capture an authorized payment



35
36
37
38
39
40
41
42
# File 'lib/airwallex/resources/payment_intent.rb', line 35

def capture(params = {})
  response = Airwallex.client.post(
    "#{self.class.resource_path}/#{id}/capture",
    params
  )
  refresh_from(response)
  self
end

#confirm(params = {}) ⇒ Object

Confirm the payment intent with payment method details



15
16
17
18
19
20
21
22
# File 'lib/airwallex/resources/payment_intent.rb', line 15

def confirm(params = {})
  response = Airwallex.client.post(
    "#{self.class.resource_path}/#{id}/confirm",
    params
  )
  refresh_from(response)
  self
end