Class: Braintree::CreateLocalPaymentContextInput

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/graphql/inputs/create_local_payment_context_input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(attributes) ⇒ CreateLocalPaymentContextInput

Returns a new instance of CreateLocalPaymentContextInput.



16
17
18
19
20
21
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 16

def initialize(attributes)
  @attrs = attributes.keys
  set_instance_variables_from_hash(attributes)
  @amount = attributes[:amount] ? MonetaryAmountInput.new(attributes[:amount]) : nil
  @payer_info = attributes[:payer_info] ? PayerInfoInput.new(attributes[:payer_info]) : nil
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



5
6
7
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 5

def amount
  @amount
end

#attrsObject (readonly)

Returns the value of attribute attrs.



6
7
8
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 6

def attrs
  @attrs
end

#cancel_urlObject (readonly)

Returns the value of attribute cancel_url.



7
8
9
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 7

def cancel_url
  @cancel_url
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



8
9
10
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 8

def country_code
  @country_code
end

#expiry_dateObject (readonly)

Returns the value of attribute expiry_date.



9
10
11
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 9

def expiry_date
  @expiry_date
end

#merchant_account_idObject (readonly)

Returns the value of attribute merchant_account_id.



10
11
12
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 10

def 
  @merchant_account_id
end

#order_idObject (readonly)

Returns the value of attribute order_id.



11
12
13
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 11

def order_id
  @order_id
end

#payer_infoObject (readonly)

Returns the value of attribute payer_info.



12
13
14
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 12

def payer_info
  @payer_info
end

#return_urlObject (readonly)

Returns the value of attribute return_url.



13
14
15
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 13

def return_url
  @return_url
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 14

def type
  @type
end

Instance Method Details

#inspectObject



23
24
25
26
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 23

def inspect
  inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
  "#<#{self.class} #{inspected_attributes.join(" ")}>"
end

#to_graphql_variablesObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/braintree/graphql/inputs/create_local_payment_context_input.rb', line 28

def to_graphql_variables
  {
    "paymentContext" => {
      "amount" => amount&.to_graphql_variables,
      "cancelUrl" => cancel_url,
      "countryCode" => country_code,
      "expiryDate" => expiry_date,
      "merchantAccountId" => ,
      "orderId" => order_id,
      "payerInfo" => payer_info&.to_graphql_variables,
      "returnUrl" => return_url,
      "type" => type
    }.compact
  }
end