Class: Stripe::Tax::TransactionService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/tax/transaction_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StripeService

#request, #request_stream

Constructor Details

#initialize(requestor) ⇒ TransactionService

Returns a new instance of TransactionService.



9
10
11
12
# File 'lib/stripe/services/tax/transaction_service.rb', line 9

def initialize(requestor)
  super(requestor)
  @line_items = Stripe::Tax::TransactionLineItemService.new(@requestor)
end

Instance Attribute Details

#line_itemsObject (readonly)

Returns the value of attribute line_items.



7
8
9
# File 'lib/stripe/services/tax/transaction_service.rb', line 7

def line_items
  @line_items
end

Instance Method Details

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

Creates a Tax Transaction from a calculation, if that calculation hasn’t expired. Calculations expire after 90 days.



15
16
17
18
19
20
21
22
23
# File 'lib/stripe/services/tax/transaction_service.rb', line 15

def create_from_calculation(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/tax/transactions/create_from_calculation",
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Partially or fully reverses a previously created Transaction.



26
27
28
29
30
31
32
33
34
# File 'lib/stripe/services/tax/transaction_service.rb', line 26

def create_reversal(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/tax/transactions/create_reversal",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(transaction, params = {}, opts = {}) ⇒ Object

Retrieves a Tax Transaction object.



37
38
39
40
41
42
43
44
45
# File 'lib/stripe/services/tax/transaction_service.rb', line 37

def retrieve(transaction, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/tax/transactions/%<transaction>s", { transaction: CGI.escape(transaction) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end