hps 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/Gemfile +8 -0
  4. data/LICENSE.txt +32 -0
  5. data/PRIVACY.txt +66 -0
  6. data/README.md +41 -0
  7. data/Rakefile +15 -0
  8. data/hps.gemspec +26 -0
  9. data/lib/hps.rb +45 -0
  10. data/lib/hps/configuration.rb +17 -0
  11. data/lib/hps/entities/hps_account_verify.rb +9 -0
  12. data/lib/hps/entities/hps_address.rb +7 -0
  13. data/lib/hps/entities/hps_authorization.rb +13 -0
  14. data/lib/hps/entities/hps_batch.rb +7 -0
  15. data/lib/hps/entities/hps_cardholder.rb +7 -0
  16. data/lib/hps/entities/hps_charge.rb +9 -0
  17. data/lib/hps/entities/hps_charge_exceptions.rb +7 -0
  18. data/lib/hps/entities/hps_credit_card.rb +33 -0
  19. data/lib/hps/entities/hps_refund.rb +9 -0
  20. data/lib/hps/entities/hps_report_transaction_details.rb +11 -0
  21. data/lib/hps/entities/hps_report_transaction_summary.rb +7 -0
  22. data/lib/hps/entities/hps_reversal.rb +11 -0
  23. data/lib/hps/entities/hps_token_data.rb +11 -0
  24. data/lib/hps/entities/hps_transaction.rb +161 -0
  25. data/lib/hps/entities/hps_transaction_details.rb +7 -0
  26. data/lib/hps/entities/hps_transaction_header.rb +9 -0
  27. data/lib/hps/entities/hps_transaction_type.rb +17 -0
  28. data/lib/hps/entities/hps_void.rb +9 -0
  29. data/lib/hps/infrastructure/api_connection_exception.rb +11 -0
  30. data/lib/hps/infrastructure/authentication_exception.rb +11 -0
  31. data/lib/hps/infrastructure/card_exception.rb +15 -0
  32. data/lib/hps/infrastructure/exceptions.json +469 -0
  33. data/lib/hps/infrastructure/hps_exception.rb +25 -0
  34. data/lib/hps/infrastructure/hps_exception_mapper.rb +135 -0
  35. data/lib/hps/infrastructure/hps_sdk_codes.rb +49 -0
  36. data/lib/hps/infrastructure/invalid_request_exception.rb +15 -0
  37. data/lib/hps/services/hps_batch_service.rb +30 -0
  38. data/lib/hps/services/hps_charge_service.rb +635 -0
  39. data/lib/hps/services/hps_service.rb +128 -0
  40. data/lib/hps/version.rb +3 -0
  41. data/tests/amex_tests.rb +231 -0
  42. data/tests/cert_tests.rb +81 -0
  43. data/tests/discover_tests.rb +325 -0
  44. data/tests/exception_mapper_tests.rb +245 -0
  45. data/tests/general_tests.rb +58 -0
  46. data/tests/hps_token_service.rb +56 -0
  47. data/tests/mastercard_tests.rb +326 -0
  48. data/tests/secret_key.rb +12 -0
  49. data/tests/test_data.rb +128 -0
  50. data/tests/test_helper.rb +92 -0
  51. data/tests/token_tests.rb +513 -0
  52. data/tests/visa_tests.rb +378 -0
  53. metadata +165 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 707f4097e22357f3f25917e67cb5c2e9a1c802db
4
+ data.tar.gz: c5e641913f862d8851795861c96454ee4f083384
5
+ SHA512:
6
+ metadata.gz: b2e85e0a3e3f13fafccac2d3717bee04448dfd17280db509f95cd0cf8502c819667422e1a5f246613873f91de458e0f3e24bcced4449f4128464850a505b9d06
7
+ data.tar.gz: 04bb11d87b89b037e96d75424999ac4ccfca26bb0625a89d9c5fe374c5257aac551c3619c1c071c13a7378b189718ad374bd372e10b2cd7808859a2d03534d84
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ <<<<<<< HEAD
3
+ *.rbc
4
+ .DS_Store
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ =======
21
+ .bundle
22
+ Gemfile.lock
23
+ pkg/*
24
+ >>>>>>> dcfc98612d55e3f42edcc6922245fad6d3fcebca
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hps.gemspec
4
+ gemspec
5
+
6
+ if Gem::Specification.find_by_name('pry')
7
+ gem 'pry'
8
+ end
@@ -0,0 +1,32 @@
1
+ END-USER LICENSE AGREEMENT FOR SECURE SUBMIT
2
+ REVISED 11.13.13
3
+ IMPORTANT READ CAREFULLY:
4
+ This Heartland Payment Systems (�HPS�) End-User License Agreement (�EULA�) is a legal agreement between you (either an individual or a single entity) and HPS for the Secure Submit software product accompanying this EULA, which includes computer software and may include associated media, printed materials, and online or electronic documentation (�Software�). By downloading, copying or otherwise using the Software, you agree to the terms of this EULA and any additional terms and conditions that may be added to the EULA by HPS. BY DOWNLOADING, COPYING OR USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ, UNDERSTOOD, AND AGREED TO BE BOUND BY THE TERMS HEREIN. IF YOU HAVE ANY QUESTIONS ON THE TERMS OF USE, YOU SHOULD CONSULT WITH AN ATTORNEY BEFORE DOWNLOADING OR USING THE SOFTWARE. If you do not agree to the terms of this EULA, do not download or use the Software. As used herein, the words �you� and �your� mean the person or entity that has downloaded or used the Software. The words �we,� �us� and �our� means HPS. You must be at least 18 years of age in any of the fifty United States (or 21 in Puerto Rico) to use the Software. By downloading or using the Software, you agree that you will use the Software only in the United States or United States territories.
5
+ GRANT OF LICENSE
6
+ HPS hereby grants you a limited, non-exclusive, non-transferable, royalty-free license to make and use an unlimited number of copies of the Software accompanying this EULA: (1) solely for your internal purpose of integrating session-based data encryption into HPS�s payment processing platform; or (2) to make and distribute new programs incorporating the Software for the purpose of integrating to HPS�s payment processing platform for sublicensing to those who have an internal purpose of integrating session-based data encryption into HPS�s payment processing platform (the �Purpose�).
7
+ USE RESTRICTION
8
+ You acknowledge that the Software acquired hereunder can only be used for the Purpose. Use of the Software for any other purpose is a violation of this EULA and you agree to be subject to any and all penalties and remedies available at law or in equity for violation of intellectual property laws and treaties.
9
+ TERMINATION
10
+ Without prejudice to any other rights, HPS may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In any event, this EULA shall terminate if you no longer have a purpose of integrating session-based data encryption into HPS�s payment processing platform. In the event of termination of this EULA, you must destroy all copies of the Software and all of its component parts.
11
+ RESERVATION OF RIGHTS
12
+ You agree that the Software is owned HPS and all rights not expressly granted herein are reserved by HPS.
13
+ PRODUCT MAINTENANCE
14
+ You understand and agree that HPS may provide updates to the Software from time to time but HPS shall have no obligation to provide maintenance or updates to you for Software licensed under this Agreement.
15
+ MISAPPROPRIATION
16
+ You shall promptly advise HPS, in writing, of any misappropriation or misuse of the Software by any person which may come to your attention.
17
+ U.S. GOVERNMENT RESTRICTED RIGHTS AND EXPORT RESTRICTIONS
18
+ The Software is provided with restricted rights. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Heartland Payment Systems, 90 Nassau Street, Princeton, NJ 08542. You acknowledge that the Software acquired hereunder is subject to the export control laws and regulations of the U.S.A., and any amendments thereof. You acknowledge and agree that you will not, directly or indirectly, export the Software.
19
+ DISCLAIMER OF WARRANTY
20
+ THE SOFTWARE IS PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, WHATSOEVER, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. YOU ASSUME THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF THE SOFTWARE.
21
+ DISCLAIMER OF DAMAGES AND LIMITATION OF LIABILITY
22
+
23
+ IN NO EVENT SHALL HPS, ITS BUSINESS PARTNERS, ITS OWNERS, DIRECTORS, EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, PUNITIVE, EXEMPLARY, CONSEQUENTIAL OR OTHER DAMAGES WHATSOEVER, INCLUDING BUT NOT LIMITED TO PROPERTY DAMAGE, LOSS OF USE, LOSS OF BUSINESS, ECONOMIC LOSS, LOSS OF DATA OR LOSS OF PROFITS, WITHOUT REGARD TO THE FORM OF ACTION (INCLUDING BUT NOT LIMITED TO CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTIONS) ARISING OUT OF OR IN CONNECTION WITH YOUR USE OF THE SOFTWARE, EVEN IF HPS, ITS BUSINESS PARTNERS, ITS OWNERS, DIRECTORS, EMPLOYEES OR AGENTS HAD BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE OR LOSS. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF DAMAGES, THE ABOVE LIMITATION MAY NOT FULLY APPLY TO YOU.
24
+
25
+ MISCELLANEOUS
26
+
27
+ This EULA shall be construed, interpreted and performed exclusively according to the laws of the State of New Jersey, United States of America, without giving effect to any principles of conflicts of law. You expressly agree that any action at law or in equity arising out of or directly or indirectly relating to this EULA or the Software shall be filed only in the federal or state courts sitting in Mercer County, New Jersey. You hereby consent and submit to personal jurisdiction of such courts for the purposes of any action related to the Software, your access or use thereof, or this EULA, and to extra-territorial service of process.
28
+
29
+ This EULA may not be assigned by you. HPS may assign their rights and obligations set forth in this EULA at any time. Should any part or provision of this EULA be held unlawful, void, invalid or unenforceable, that portion shall be deemed severable from this EULA shall not affect the validity and enforceability of any remaining provisions. Except as provided herein, this EULA constitutes the entire agreement between you and HPS pertaining to the download or use of the Software. Nothing herein shall alter or modify your agreements with HPS related to payment processing or other services or products provided to you by HPS. HPS�s failure to enforce any provision of this EULA or any additional terms shall not be deemed a waiver of such provisions nor of its right to enforce such provision. This EULA may be accepted in electronic form (e.g., by an electronic or other means of demonstrating assent) and your acceptance will be deemed binding between you and HPS. You hereby agree, without limitation, that you not will contest the validity or enforceability of this EULA.
30
+
31
+ CONTACT
32
+ Should you have any questions concerning this EULA, or if you desire to contact HPS for any reason, please write: Heartland Payment Systems, 90 Nassau Street, Princeton, NJ 08452. Attention: Legal.
@@ -0,0 +1,66 @@
1
+ Online Privacy & Cookie Policy Statement ("Privacy Policy")
2
+
3
+ Last modified on June 21, 2012
4
+
5
+ Heartland Payment Systems, Inc. (�Heartland,� �we,� �us,� �our�) recognizes the importance of maintaining effective privacy practices. This Privacy & Cookie Policy explains the online data collection and use policies that apply to the websites, mobile applications and online services (collectively �Services�) that are owned or controlled by Heartland and are linked to this Policy page.
6
+ Click below to jump to a particular topic:
7
+
8
+ 1. Information Collection and Use
9
+ 2. Sharing of Information
10
+ 3. Children�s Privacy
11
+ 4. Your Choices
12
+ 5. Data Protection and Storage
13
+ 6. Third-Party Websites and Services
14
+ 7. Changes to Our Privacy Policy
15
+ 8. Contact Us
16
+
17
+ 1. Information Collection and Use
18
+
19
+ We collect information from various sources to provide our Services to you, to analyze and improve our Services, and to communicate with you (e.g., to send you updates or notices about our organization, or emails about products or services that we believe may be of interest to you).
20
+ Information that you provide to us: We collect information that you provide to us when you set up an account with us, use our Services, or communicate with us. For example, if you register for an online account with us, then we may request your personal information (e.g., name, postal address, email address, DOB, telephone number, credit/debit card number, security code) or as applicable your business information, to complete the registration process, to process transactions, to send you information about our products, to send you promotional offers from third parties that we think may be of interest to you, or to otherwise provide our Services to you. Similarly, if you request information from us through an online contact form (or if you email us), we collect the information you provide (e.g., name, telephone number, email address) so that we can respond to you.
21
+
22
+ Information collected from third parties: We may collect information about you or your business from third parties in the course of providing our Services to you. For example, we may obtain information from our merchant customersor we may collect information from a school or university about consumer/students to provide services to those consumer/student. For some services,we may also collect information from third parties, such as credit reporting agencies or financial institutions, or other entities with information pertaining to the Services that we are providing to you.
23
+
24
+ Information collected through technology: When you visit our websites or mobile applications (or when you use any of our online services) we may collect certain information about your computer or device through technology such as cookies, web beacons, or other tracking/recording tools. The information collected may include, but is not limited to, IP addresses, referring URLs, access times, browser types, device types, mobile device identifiers, or information about your interactions with our websites, applications or services. (Note that a �cookie� is a text file placed on a computer�s hard drive or stored on a mobile device; a �web beacon,� also known as an Internet tag, pixel tag or clear GIF, is used to transmit information back to a web server.) We may use the information described in this paragraph to, among other things, (i) operate our Services, including by remembering information so that you will not have to re-enter it during your visit or the next time you sign in to your account, (ii) identify and protect our customers, (iii) control unauthorized use or abuse of our Services, (iv) provide custom, personalized content and information, which could include advertising, (v) monitor aggregate traffic patterns on our websites and services, and (vi) analyze and improve our Services.
25
+
26
+ 2. Sharing of Information
27
+
28
+ We do not sell or share your information with third parties outside Heartland and our group of companies (which include any parents, subsidiaries and affiliates), without your consent, except as described below and in this Policy:
29
+ We may share your information with our service providers and business partners (e.g., financial institutions or card brands that issue payment cards or are involved in transaction processing; entities that assist with fraud prevention or collections; merchants that sell gift cards managed through our websites or services; schools), who assist us in providing our Services. We may also share information with our service providers and business partners to help us monitor usage and other analytics regarding our Services, and to help us improve these offerings. When we share your information with our service providers and business partners, we only provide the information that these third parties reasonably need to perform their functions.
30
+ We may aggregate, or strip information of personally identifying characteristics, and may share that aggregated or anonymized information with third parties.
31
+ We may share or disclose your information if we determine, in our sole discretion, that we are required to do so under applicable law or regulatory requirements, or if we reasonably believe disclosure is necessary to prevent harm or financial loss, or in connection with preventing fraud or illegal activity, and/or to enforce our Terms of Use.
32
+ We reserve the right to transfer any information we collect in the event we sell or transfer all or a portion of our business or assets (including any shares in the company) or any portion or combination of our products, services, businesses and/or assets. Should such a transaction occur (whether a divestiture, merger, acquisition, bankruptcy, dissolution, reorganization, liquidation, or similar transaction or proceeding), we will use reasonable efforts to ensure that any transferred information is treated in a manner consistent with this Privacy Policy.
33
+ 3. Children�s Privacy
34
+
35
+ Heartland�s websites, mobile applications and services are intended for use strictly by adults. Heartland does not knowingly solicit or collect personal information from children under the age of 13. If Heartland obtains knowledge that it has collected personal information from a child under 13 in retrievable form in its files, Heartland will delete that information.
36
+
37
+ 4. Your Choices
38
+
39
+ Email Communications. From time to time, we may send you emails regarding updates to our websites, mobile applications or products/services, notices about our organization, or information about products/services we offer (or promotional offers from third parties) that we think may be of interest to you. If you wish to unsubscribe from such emails, simply click the �unsubscribe link� provided at the bottom of the email communication. Note that you cannot unsubscribe from certain Services-related email communications (e.g., account verification, confirmations of transactions, technical or legal notices).
40
+
41
+ Modifying Account Information. If you have an online account with us, you may have the ability to modify certain information in your account (e.g., your contact information) through �profile,� �account,� �settings,� or �preferences� options provided on the website or service. If you have any questions about modifying or updating any information in your account, please contact us at the email address, postal address, or telephone number provided below.
42
+
43
+ Cookie Controls. You may be able to set your Internet browser or mobile device to block cookies or other tracking/recording tools, including cookies associated with our websites or Services, or to indicate when a cookie is being set by us. However, it is important to remember that many of our websites or Services may not function properly if your cookies are disabled. For information and instructions about how to manage your cookies, refer to your Internet browser�s or mobile device�s technical information. Further information on how to adjust your cookie preferences through your browser is available at the external, third-party informational website www.allaboutcookies.org.
44
+
45
+ 5. Data Protection and Storage
46
+
47
+ Heartland maintains reasonable administrative, technical and physical safeguards to protect the confidentiality of information transmitted online, including but not limited to encryption, firewalls and SSL (Secure Sockets Layer). Heartland has implemented policies and practices pursuant to various security rules and regulations relating to the security and safeguarding of payment cardholder data, including the Payment Card Industry Data Security Standards (PCI-DSS). Heartland is not liable for loss of passwords due to user negligence. If you believe your password has been lost or compromised, we recommend that you immediately change your password.
48
+
49
+ We may store and process information in the United States or any other country in which Heartland or its parents, subsidiaries, affiliates or service providers maintain facilities. Heartland may transfer information that we collect about you, including personal information, to parents, subsidiaries, affiliates, or service providers across borders and from your country or jurisdiction to other countries or jurisdictions around the world. If you are located in the European Union or other regions with laws governing data collection and use that may differ from U.S. law, please note that we may transfer information, including personal information, to a country and jurisdiction that does not have the same data protection laws as your jurisdiction, and you consent to the transfer of information to the U.S. or any other country in which Heartland or its parent, subsidiaries, affiliates or service providers maintain facilities and to the use and disclosure of information as described in this Privacy Policy.
50
+
51
+ 6. Third-Party Websites and Services
52
+
53
+ Our websites or Services may provide links to (or links from) third-party websites or services � none of which are governed by this Privacy Policy. To the extent that any linked third-party websites or services you visit are not owned or controlled by Heartland, we are not responsible for those websites� or services� content or information practices. We strongly encourage you to review the privacy policies of any site or service before providing any personal information.
54
+
55
+ 7. Changes to Privacy Policy
56
+
57
+ We reserve the right to change this Privacy Policy from time to time in our sole discretion. We will post changes on this page and indicate the �last modified� date at the top of this page. Please check back often for any updates. Your continued use of our website, mobile application or services after any change in this Privacy Policy will constitute your acceptance of such change.
58
+
59
+ 8. Contact Us
60
+
61
+ For additional inquiries about this Privacy Policy, please contact Heartland at 1-888-798-3131 to speak to a legal representative, or send us an email at PrivacyPolicy@e-hps.com, or letter.
62
+
63
+ General Counsel Office
64
+ Heartland Payment Systems, Inc.
65
+ 90 Nassau Street
66
+ Princeton, NJ 08542
@@ -0,0 +1,41 @@
1
+ =======
2
+ Portico-Ruby-SDK
3
+ ================
4
+
5
+ Ruby SDK for integrating with the Portico Gateway
6
+
7
+ ## Contributing
8
+
9
+ 1. Fork it
10
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
11
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
12
+ 4. Push to the branch (`git push origin my-new-feature`)
13
+ 5. Create new Pull Request
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ gem 'hps'
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install hps
28
+
29
+ ## Usage
30
+
31
+ Supported Gateway Calls
32
+
33
+ CreditAccountVerify (4.3)
34
+ CreditAddToBatch (4.4)
35
+ CreditAuth (4.5)
36
+ CreditReturn (4.9)
37
+ CreditReversal (4.10)
38
+ CreditSale (4.11)
39
+ ReportActivity (10.4)
40
+ ReportTxnDetail (10.8)
41
+ BatchClose (10.3)
@@ -0,0 +1,15 @@
1
+ task :console do
2
+ require 'bundler/gem_tasks'
3
+ require 'hps'
4
+ begin
5
+ require 'pry'
6
+ ARGV.clear
7
+ Pry.start
8
+ rescue LoadError
9
+ #pry was not found so loading irb
10
+ require 'irb'
11
+ require 'irb/completion'
12
+ ARGV.clear
13
+ IRB.start
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hps/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hps"
8
+ spec.version = Hps::VERSION
9
+ spec.authors = ["Heartland Payment Systems"]
10
+ spec.email = ["EntApp_DevPortal@e-hps.com"]
11
+ spec.description = %q{Ruby SDK for processing payments via Portico Gateway}
12
+ spec.summary = %q{Heartland Payment Systems - Portico Gateway SDK}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency('builder', '>= 2.1.2', '< 4.0.0')
24
+ spec.add_dependency('activesupport', '>= 2.3.14', '< 5.0.0')
25
+
26
+ end
@@ -0,0 +1,45 @@
1
+ require 'builder'
2
+ require 'net/http'
3
+ require 'net/https'
4
+ require "hps/version"
5
+ require "hps/configuration"
6
+
7
+ # Entities
8
+ require "hps/entities/hps_transaction"
9
+ require "hps/entities/hps_authorization"
10
+ require "hps/entities/hps_account_verify"
11
+ require "hps/entities/hps_address"
12
+ require "hps/entities/hps_batch"
13
+ require "hps/entities/hps_cardholder"
14
+ require "hps/entities/hps_charge"
15
+ require "hps/entities/hps_charge_exceptions"
16
+ require "hps/entities/hps_credit_card"
17
+ require "hps/entities/hps_refund"
18
+ require "hps/entities/hps_report_transaction_details"
19
+ require "hps/entities/hps_report_transaction_summary"
20
+ require "hps/entities/hps_reversal"
21
+ require "hps/entities/hps_token_data"
22
+ require "hps/entities/hps_transaction_header"
23
+ require "hps/entities/hps_transaction_type"
24
+ require "hps/entities/hps_transaction_details"
25
+ require "hps/entities/hps_void"
26
+
27
+ # Infrastructure
28
+ require "hps/infrastructure/hps_sdk_codes"
29
+ require "hps/infrastructure/hps_exception"
30
+ require "hps/infrastructure/api_connection_exception"
31
+ require "hps/infrastructure/authentication_exception"
32
+ require "hps/infrastructure/card_exception"
33
+ require "hps/infrastructure/invalid_request_exception"
34
+ require "hps/infrastructure/hps_exception_mapper"
35
+
36
+ # Services
37
+ require "hps/services/hps_service"
38
+ require "hps/services/hps_charge_service"
39
+ require "hps/services/hps_batch_service"
40
+
41
+ module Hps
42
+
43
+ extend Configuration
44
+
45
+ end
@@ -0,0 +1,17 @@
1
+ module Hps
2
+ module Configuration
3
+
4
+ VALID_CONFIG_KEYS = [ :service_uri, :user_name, :password, :developer_id, :version_number, :license_id, :device_id, :site_id, :site_trace, :secret_api_key ].freeze
5
+
6
+ attr_accessor *VALID_CONFIG_KEYS
7
+
8
+ def configure
9
+ yield self
10
+ end
11
+
12
+ def options
13
+ Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module Hps
2
+ class HpsAccountVerify < HpsAuthorization
3
+
4
+ def initialize(header)
5
+ super(header)
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Hps
2
+ class HpsAddress
3
+
4
+ attr_accessor :address, :city, :state, :zip, :country
5
+
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module Hps
2
+ class HpsAuthorization < HpsTransaction
3
+
4
+ attr_accessor :avs_result_code, :avs_result_text, :cvv_result_code,
5
+ :cvv_result_text, :cpc_indicator, :authorization_code,
6
+ :authorized_amount, :card_type, :token_data
7
+
8
+ def initialize(header)
9
+ super(header)
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module Hps
2
+ class HpsBatch
3
+
4
+ attr_accessor :id, :transaction_count, :total_amount, :sequence_number
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Hps
2
+ class HpsCardHolder
3
+
4
+ attr_accessor :first_name, :last_name, :phone, :email_address, :address
5
+
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Hps
2
+ class HpsCharge < HpsAuthorization
3
+
4
+ def initialize(header)
5
+ super(header)
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Hps
2
+ class HpsChargeExceptions
3
+
4
+ attr_accessor :card_exception, :hps_exception
5
+
6
+ end
7
+ end
@@ -0,0 +1,33 @@
1
+ module Hps
2
+ class HpsCreditCard
3
+
4
+ attr_accessor :number, :cvv, :exp_month, :exp_year
5
+
6
+ def initialize
7
+
8
+ @regex_map = {
9
+ :Amex => /^3[47][0-9]{13}$/,
10
+ :MasterCard => /^5[1-5][0-9]{14}$/,
11
+ :Visa => /^4[0-9]{12}(?:[0-9]{3})?$/,
12
+ :DinersClub => /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
13
+ :EnRoute => /^(2014|2149)/,
14
+ :Discover => /^6(?:011|5[0-9]{2})[0-9]{12}$/,
15
+ :Jcb => /^(?:2131|1800|35\\d{3})\\d{11}$/
16
+ }
17
+
18
+ end
19
+
20
+ def card_type
21
+
22
+ @regex_map.each { |key, value|
23
+ unless value.match(number.to_s).nil?
24
+ return key
25
+ end
26
+ }
27
+
28
+ "Unknown"
29
+
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,9 @@
1
+ module Hps
2
+ class HpsRefund < HpsTransaction
3
+
4
+ def initialize(header)
5
+ super(header)
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Hps
2
+ class HpsReportTransactionDetails < HpsAuthorization
3
+
4
+ attr_accessor :original_transaction_id, :masked_card_number, :transaction_type, :transaction_date, :exceptions
5
+
6
+ def initialize(header)
7
+ super(header)
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Hps
2
+ class HpsReportTransactionSummary < HpsTransaction
3
+
4
+ attr_accessor :amount, :original_transaction_id, :masked_card_number, :transaction_type, :transaction_date, :exceptions
5
+
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module Hps
2
+ class HpsReversal < HpsTransaction
3
+
4
+ attr_accessor :avs_result_code, :avs_result_text, :cvv_result_code, :cvv_result_text, :cpc_indicator
5
+
6
+ def initialize(header)
7
+ super(header)
8
+ end
9
+
10
+ end
11
+ end