Class: Braintree::ApplePayGateway
- Inherits:
-
Object
- Object
- Braintree::ApplePayGateway
- Defined in:
- lib/braintree/apple_pay_gateway.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(gateway) ⇒ ApplePayGateway
constructor
A new instance of ApplePayGateway.
- #register_domain(domain) ⇒ Object
- #registered_domains ⇒ Object
- #unregister_domain(domain) ⇒ Object
Constructor Details
#initialize(gateway) ⇒ ApplePayGateway
Returns a new instance of ApplePayGateway.
3 4 5 6 |
# File 'lib/braintree/apple_pay_gateway.rb', line 3 def initialize(gateway) @gateway = gateway @config = gateway.config end |
Class Method Details
._card_signature(type) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/braintree/apple_pay_gateway.rb', line 37 def self._card_signature(type) billing_address_params = AddressGateway._shared_signature = [ :verification_account_type, :verification_amount, :verification_merchant_account_id, :verify_card ] signature = [ :cardholder_name, :cryptogram, :eci_indicator, :expiration_month, :expiration_year, :network_transaction_id, :number, :token, {:billing_address => billing_address_params}, {:options => } ] case type when :create nil when :update << :make_default else raise ArgumentError, "Invalid signature type: #{type}" end signature end |
._create_card_signature ⇒ Object
72 73 74 |
# File 'lib/braintree/apple_pay_gateway.rb', line 72 def self._create_card_signature _card_signature(:create) end |
._update_card_signature ⇒ Object
76 77 78 |
# File 'lib/braintree/apple_pay_gateway.rb', line 76 def self._update_card_signature _card_signature(:update) end |
Instance Method Details
#register_domain(domain) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/braintree/apple_pay_gateway.rb', line 8 def register_domain(domain) response = @config.http.post("#{@config.base_merchant_path}/processing/apple_pay/validate_domains", :url => domain) if response.has_key?(:response) && response[:response][:success] Braintree::SuccessfulResult.new elsif response[:api_error_response] ErrorResult.new(@gateway, response[:api_error_response]) else raise "expected :response or :api_error_response" end end |
#registered_domains ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/braintree/apple_pay_gateway.rb', line 25 def registered_domains response = @config.http.get("#{@config.base_merchant_path}/processing/apple_pay/registered_domains") if response.has_key?(:response) Braintree::SuccessfulResult.new(:apple_pay_options => ApplePayOptions._new(response[:response])) elsif response[:api_error_response] ErrorResult.new(@gateway, response[:api_error_response]) else raise "expected :response or :api_error_response" end end |
#unregister_domain(domain) ⇒ Object
20 21 22 23 |
# File 'lib/braintree/apple_pay_gateway.rb', line 20 def unregister_domain(domain) @config.http.delete("#{@config.base_merchant_path}/processing/apple_pay/unregister_domain", :url => CGI.escape(domain)) SuccessfulResult.new end |