nmi_direct_post 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8a7f96e99aff57d1745c1e1b1cd90619eca8d45b
4
- data.tar.gz: 7b5faf05b492e67293278a702f1f8832e1ba617a
2
+ SHA256:
3
+ metadata.gz: 6491429932b12663aabf94642d82a67b657da5013d95f2b2a9502f6f34b23873
4
+ data.tar.gz: af44d405c2f172136c027ae386e793908318486423ad40e5e52c488ff387dfde
5
5
  SHA512:
6
- metadata.gz: a5584f91061e4ebf5d372a96efc7f2ca061134fc79b9e5c6c130e9220573c7bd978416e88f769038fbab0f7f391cea24cea9e0bf752d49032b9f0a3a4c2f6701
7
- data.tar.gz: b5c1bb5556057f1df9acae2bf22b2b1ed462275e81c52ea811150cc365e1425b0f650746b7a35a044624e14071f0439add3b0a406184bba4455996ddec6d7084
6
+ metadata.gz: 4ac076f6feb39a32930e6f5f1183eb37bef64175d3d23b770a785b4ab8a9dfe71fa65c9e8c1907eaa1b7149366f4ae9db976296b95b17221f0372da49e04d7c9
7
+ data.tar.gz: f0d314dc4a03db8841df80029bc09407dcfc41fdc0fc5358c84979d154f8c6c67983285b9f2594a596ade507dedbe4149ebe0ddef0c60ba3806e92db6bf3bf87
@@ -29,7 +29,7 @@ module NmiDirectPost
29
29
  attr_reader :customer_vault_id, :customer_vault, :report_type
30
30
 
31
31
  MERCHANT_DEFINED_FIELDS ||= 20.times.collect { |i| :"merchant_defined_field_#{i+1}" }
32
- WHITELIST_ATTRIBUTES ||= [:id, :first_name, :last_name, :address_1, :address_2, :company, :city, :state, :postal_code, :country, :email, :phone, :fax, :cell_phone, :customertaxid, :website, :shipping_first_name, :shipping_last_name, :shipping_address_1, :shipping_address_2, :shipping_company, :shipping_city, :shipping_state, :shipping_postal_code, :shipping_country, :shipping_email, :shipping_carrier, :tracking_number, :shipping_date, :shipping, :cc_number, :cc_exp, :cc_issue_number, :check_account, :check_aba, :check_name, :account_holder_type, :account_type, :sec_code, :processor_id, :cc_bin, :cc_start_date] + MERCHANT_DEFINED_FIELDS
32
+ WHITELIST_ATTRIBUTES ||= [:username, :password, :id, :first_name, :last_name, :address_1, :address_2, :company, :city, :state, :postal_code, :country, :email, :phone, :fax, :cell_phone, :customertaxid, :website, :shipping_first_name, :shipping_last_name, :shipping_address_1, :shipping_address_2, :shipping_company, :shipping_city, :shipping_state, :shipping_postal_code, :shipping_country, :shipping_email, :shipping_carrier, :tracking_number, :shipping_date, :shipping, :cc_number, :cc_exp, :cc_issue_number, :check_account, :check_aba, :check_name, :account_holder_type, :account_type, :sec_code, :processor_id, :cc_bin, :cc_start_date] + MERCHANT_DEFINED_FIELDS
33
33
  attr_accessor_with_tracking_of_changes *WHITELIST_ATTRIBUTES
34
34
 
35
35
  validate :billing_information_present?, :if => Proc.new { |record| :add_customer == record.customer_vault }
@@ -26,6 +26,8 @@ module NmiDirectPost
26
26
 
27
27
  def initialize(attributes)
28
28
  super
29
+ @username = attributes[:username] if attributes[:username]
30
+ @password = attributes[:password] if attributes[:password]
29
31
  @type, @amount = attributes[:type].to_s, attributes[:amount].to_f
30
32
  @transaction_id = attributes[:transaction_id].to_i if attributes[:transaction_id]
31
33
  @customer_vault_id = attributes[:customer_vault_id].to_i if attributes[:customer_vault_id]
@@ -51,11 +53,11 @@ module NmiDirectPost
51
53
  save || raise(TransactionNotSavedError)
52
54
  end
53
55
 
54
- def self.find_by_transaction_id(transaction_id)
56
+ def self.find_by_transaction_id(transaction_id, username=nil, password=nil)
55
57
  raise StandardError, "TransactionID cannot be blank" if transaction_id.blank?
56
58
  NmiDirectPost.logger.debug { "Looking up NMI transaction by transaction_id(#{transaction_id})" }
57
59
  begin
58
- new(:transaction_id => transaction_id)
60
+ new(:transaction_id => transaction_id, username: username, password: password)
59
61
  rescue TransactionNotFoundError
60
62
  return nil
61
63
  end
@@ -83,7 +85,7 @@ module NmiDirectPost
83
85
  end
84
86
 
85
87
  def customer_vault
86
- @customer_vault ||= CustomerVault.find_by_customer_vault_id(@customer_vault_id) unless @customer_vault_id.blank?
88
+ @customer_vault ||= CustomerVault.find_by_customer_vault_id(@customer_vault_id, @username, @password) unless @customer_vault_id.blank?
87
89
  end
88
90
 
89
91
  def reload
@@ -1,3 +1,3 @@
1
1
  module NmiDirectPost
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nmi_direct_post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Betesh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2020-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.4.8
159
+ rubygems_version: 3.1.2
161
160
  signing_key:
162
161
  specification_version: 4
163
162
  summary: '# NmiDirectPost NmiDirectPost is a gem that encapsulates the NMI Direct