Class: Payrex::Services::PaymentIntentsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/services/payment_intents_service.rb

Constant Summary collapse

PATH =
"payment_intents"

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #request

Constructor Details

This class inherits a constructor from Payrex::Services::BaseService

Instance Method Details

#cancel(id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/services/payment_intents_service.rb', line 6

def cancel(id)
  request(
    method: :post,
    object: Payrex::Entities::PaymentIntent,
    path: "#{PATH}/#{id}/cancel"
  )
end

#capture(id, payload) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/services/payment_intents_service.rb', line 14

def capture(id, payload)
  request(
    method: :post,
    object: Payrex::Entities::PaymentIntent,
    path: "#{PATH}/#{id}/capture",
    payload: payload
  )
end

#create(payload) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/services/payment_intents_service.rb', line 23

def create(payload)
  request(
    method: :post,
    object: Payrex::Entities::PaymentIntent,
    path: PATH,
    payload: payload
  )
end

#retrieve(id) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/services/payment_intents_service.rb', line 32

def retrieve(id)
  request(
    method: :get,
    object: Payrex::Entities::PaymentIntent,
    path: "#{PATH}/#{id}",
    payload: {}
  )
end