Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Network tokenization
Browse files Browse the repository at this point in the history
  • Loading branch information
vpuzzella committed Oct 22, 2024
1 parent 108b7b6 commit d42be30
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/spreedly/transactions/gateway_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class GatewayTransaction < Transaction
field :merchant_name_descriptor, :merchant_location_descriptor
field :on_test_gateway, type: :boolean

attr_reader :response, :gateway_specific_fields, :gateway_specific_response_fields, :shipping_address
attr_reader :response, :gateway_specific_fields, :gateway_specific_response_fields, :shipping_address, :network_tokenization

def initialize(xml_doc)
super
Expand All @@ -14,6 +14,9 @@ def initialize(xml_doc)
@shipping_address = shipping_address_xml_doc ? ShippingAddress.new(shipping_address_xml_doc) : nil
@gateway_specific_fields = parse_gateway_fields(xml_doc, './/gateway_specific_fields')
@gateway_specific_response_fields = parse_gateway_fields(xml_doc, './/gateway_specific_response_fields')

network_tokenization_xml_doc = xml_doc.at_xpath('.//network_tokenization')
@network_tokenization = network_tokenization_xml_doc ? NetworkTokenization.new(network_tokenization_xml_doc) : nil
end

def parse_gateway_fields(xml_doc, path)
Expand Down
15 changes: 15 additions & 0 deletions lib/spreedly/transactions/network_tokenization.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Spreedly
class NetworkTokenization
include Fields
include ErrorsParser

field :provisioned, type: :boolean
field :token_status
attr_reader :errors

def initialize(xml_doc)
initialize_fields(xml_doc)
@errors = errors_from(xml_doc)
end
end
end

0 comments on commit d42be30

Please sign in to comment.