Class: PaysonAPI::V1::Requests::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/payson_api/v1/requests/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cancel_urlObject

Returns the value of attribute cancel_url.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def cancel_url
  @cancel_url
end

#currencyObject

Returns the value of attribute currency.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def currency
  @currency
end

#customObject

Returns the value of attribute custom.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def custom
  @custom
end

#fees_payerObject

Returns the value of attribute fees_payer.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def fees_payer
  @fees_payer
end

#fundingsObject

Returns the value of attribute fundings.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def fundings
  @fundings
end

#guarantee_offeredObject

Returns the value of attribute guarantee_offered.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def guarantee_offered
  @guarantee_offered
end

#invoice_feeObject

Returns the value of attribute invoice_fee.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def invoice_fee
  @invoice_fee
end

#ipn_urlObject

Returns the value of attribute ipn_url.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def ipn_url
  @ipn_url
end

#localeObject

Returns the value of attribute locale.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def locale
  @locale
end

#memoObject

Returns the value of attribute memo.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def memo
  @memo
end

#order_itemsObject

Returns the value of attribute order_items.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def order_items
  @order_items
end

#receiversObject

Returns the value of attribute receivers.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def receivers
  @receivers
end

#return_urlObject

Returns the value of attribute return_url.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def return_url
  @return_url
end

#senderObject

Returns the value of attribute sender.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def sender
  @sender
end

#tracking_idObject

Returns the value of attribute tracking_id.



7
8
9
# File 'lib/payson_api/v1/requests/payment.rb', line 7

def tracking_id
  @tracking_id
end

Instance Method Details

#to_hashObject

rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/payson_api/v1/requests/payment.rb', line 11

def to_hash # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
  {}.tap do |hash|
    # Append mandatory params
    hash['returnUrl'] = @return_url
    hash['cancelUrl'] = @cancel_url
    hash['memo'] = @memo
    hash.merge!(@sender.to_hash)
    hash.merge!(Receiver.to_hash(@receivers))

    # Append optional params
    append_locale(hash, @locale) if @locale
    append_currency(hash, @currency) if @currency
    append_fees_payer(hash, @fees_payer) if @fees_payer
    append_guarantee(hash, @guarantee_offered) if @guarantee_offered
    hash.merge!(OrderItem.to_hash(@order_items)) if @order_items
    hash.merge!(Funding.to_hash(@fundings)) if @fundings
    hash['ipnNotificationUrl'] = @ipn_url if @ipn_url
    hash['invoiceFee'] = @invoice_fee if @invoice_fee
    hash['trackingId'] = @tracking_id if @tracking_id
    hash['custom'] = @custom if @custom
  end
end