global_collect 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/COPYING +11 -0
  2. data/README.markdown +109 -0
  3. data/Rakefile +34 -0
  4. data/VERSION +1 -0
  5. data/examples/cancel_payment.rb +14 -0
  6. data/examples/convert_amount.rb +14 -0
  7. data/examples/get_order_status.rb +15 -0
  8. data/examples/insert_order_with_payment.rb +37 -0
  9. data/examples/process_challenged.rb +13 -0
  10. data/examples/set_payment.rb +23 -0
  11. data/examples/test_connection.rb +13 -0
  12. data/global_collect.gemspec +170 -0
  13. data/lib/global_collect/api_client.rb +71 -0
  14. data/lib/global_collect/builders/do_refund/credit_card_payment.rb +12 -0
  15. data/lib/global_collect/builders/do_refund/payment.rb +39 -0
  16. data/lib/global_collect/builders/insert_order_with_payment/credit_card_online_payment.rb +38 -0
  17. data/lib/global_collect/builders/insert_order_with_payment/hosted_credit_card_online_payment.rb +4 -0
  18. data/lib/global_collect/builders/insert_order_with_payment/order.rb +75 -0
  19. data/lib/global_collect/builders/insert_order_with_payment/payment.rb +25 -0
  20. data/lib/global_collect/builders/set_payment/payment.rb +23 -0
  21. data/lib/global_collect/const/payment_product.rb +38 -0
  22. data/lib/global_collect/const/payment_status.rb +90 -0
  23. data/lib/global_collect/field_validator.rb +47 -0
  24. data/lib/global_collect/request_models/base.rb +37 -0
  25. data/lib/global_collect/request_models/do_refund/credit_card_payment.rb +12 -0
  26. data/lib/global_collect/request_models/do_refund/payment.rb +39 -0
  27. data/lib/global_collect/request_models/insert_order_with_payment/credit_card_online_payment.rb +44 -0
  28. data/lib/global_collect/request_models/insert_order_with_payment/hosted_credit_card_online_payment.rb +19 -0
  29. data/lib/global_collect/request_models/insert_order_with_payment/order.rb +67 -0
  30. data/lib/global_collect/request_models/insert_order_with_payment/payment.rb +17 -0
  31. data/lib/global_collect/request_models/set_payment/payment.rb +17 -0
  32. data/lib/global_collect/requests/base.rb +43 -0
  33. data/lib/global_collect/requests/cancel_payment.rb +22 -0
  34. data/lib/global_collect/requests/composite.rb +23 -0
  35. data/lib/global_collect/requests/convert_amount.rb +29 -0
  36. data/lib/global_collect/requests/do_refund.rb +8 -0
  37. data/lib/global_collect/requests/get_order_status.rb +24 -0
  38. data/lib/global_collect/requests/insert_order_with_payment.rb +10 -0
  39. data/lib/global_collect/requests/process_challenged.rb +22 -0
  40. data/lib/global_collect/requests/set_payment.rb +9 -0
  41. data/lib/global_collect/requests/simple.rb +39 -0
  42. data/lib/global_collect/requests/test_connection.rb +8 -0
  43. data/lib/global_collect/responses/base.rb +73 -0
  44. data/lib/global_collect/responses/convert_amount/response_methods.rb +8 -0
  45. data/lib/global_collect/responses/do_refund/response_methods.rb +24 -0
  46. data/lib/global_collect/responses/get_order_status/v1_response_methods.rb +49 -0
  47. data/lib/global_collect/responses/get_order_status/v2_response_methods.rb +67 -0
  48. data/lib/global_collect/responses/insert_order_with_payment/credit_card_online_payment_response_methods.rb +31 -0
  49. data/lib/global_collect/responses/insert_order_with_payment/hosted_merchant_link_payment_response_methods.rb +16 -0
  50. data/lib/global_collect/responses/success_row.rb +15 -0
  51. data/lib/global_collect.rb +81 -0
  52. data/spec/api_client_spec.rb +93 -0
  53. data/spec/builders/do_refund/credit_card_payment_spec.rb +32 -0
  54. data/spec/builders/do_refund/payment_spec.rb +51 -0
  55. data/spec/builders/insert_order_with_payment/credit_card_online_payment_spec.rb +59 -0
  56. data/spec/builders/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb +59 -0
  57. data/spec/builders/insert_order_with_payment/order_spec.rb +88 -0
  58. data/spec/builders/insert_order_with_payment/payment_spec.rb +37 -0
  59. data/spec/builders/set_payment/payment_spec.rb +35 -0
  60. data/spec/field_validator_spec.rb +79 -0
  61. data/spec/global_collect_spec.rb +43 -0
  62. data/spec/request_models/base_spec.rb +31 -0
  63. data/spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb +11 -0
  64. data/spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb +38 -0
  65. data/spec/requests/base_spec.rb +40 -0
  66. data/spec/requests/composite_spec.rb +48 -0
  67. data/spec/requests/convert_amount.rb +34 -0
  68. data/spec/requests/insert_order_with_payment_spec.rb +60 -0
  69. data/spec/requests/simple_spec.rb +37 -0
  70. data/spec/responses/base_spec.rb +59 -0
  71. data/spec/responses/convert_amount/response_methods_spec.rb +13 -0
  72. data/spec/responses/do_refund/response_methods_spec.rb +15 -0
  73. data/spec/responses/get_order_status/v1_response_methods_spec.rb +28 -0
  74. data/spec/responses/get_order_status/v2_response_methods_spec.rb +28 -0
  75. data/spec/responses/insert_order_with_payment/credit_card_online_payment_response_methods_spec.rb +13 -0
  76. data/spec/responses/insert_order_with_payment/hosted_merchant_link_payment_response_methods_spec.rb +13 -0
  77. data/spec/responses/succcess_row_spec.rb +26 -0
  78. data/spec/spec_helper.rb +130 -0
  79. data/spec/support/challenged_iowp_response.xml +51 -0
  80. data/spec/support/successful_convert_amount_response.xml +29 -0
  81. data/spec/support/successful_do_refund_response.xml +36 -0
  82. data/spec/support/successful_get_order_status_v1_response.xml +72 -0
  83. data/spec/support/successful_get_order_status_v2_response.xml +50 -0
  84. data/spec/support/successful_hosted_iowp_response.xml +60 -0
  85. data/spec/support/successful_iowp_response.xml +49 -0
  86. data/spec/support/successful_process_challenged_response.xml +26 -0
  87. data/spec/support/unsuccessful_do_refund_response.xml +29 -0
  88. data/spec/support/unsuccessful_iowp_response.xml +42 -0
  89. data/spec/support/unsuccessful_process_challenged_response.xml +30 -0
  90. metadata +213 -0
data/COPYING ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2010, Topspin Media Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+ * Neither the name of the Topspin Media Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9
+
10
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+
data/README.markdown ADDED
@@ -0,0 +1,109 @@
1
+ GlobalCollect: A Gem
2
+ ======================
3
+
4
+ A relatively bare Ruby library that supplies access to the GlobalCollect XML payment API.
5
+
6
+ I've tried for utility over a particular pattern or paradigm (like MVC, which is I guess, what this most-closely resembles...maybe?) Also, this is hardly a complete client implementation; GC exposes 36 methods in their API, while only a fraction are covered here. However, these are the basics needed to integrate and begin using the Hosted MerchantLink service.
7
+
8
+ With what's here and a basic web app you should be able to use the Hosted MerchantLink service to go through the basic lifecycle of an order: create, authorize, settle, refund/cancel.
9
+
10
+ ## Getting Started
11
+ * Get your GlobalCollect API credentials out, then
12
+
13
+ gem install global_collect
14
+
15
+ * See examples.rb, fill in your merchant id, and authentication scheme and then run the first example, which is a `TEST_CONNECTION` call to make sure everything is nominally OK.
16
+
17
+ ## Breakdown
18
+ ### Requests
19
+ Requests are the basic unit of communication with the GlobalCollect API. They're mostly the programmatic and XML glue that ties the action and arguments of the call together, generating XML to send to GlobalCollect. They can be found under lib/global_collect/requests/*.rb
20
+
21
+ Each API call that has been implemented has been implemented as a subclass (directly or indirectly) of
22
+ GlobalCollect::Requests::Base
23
+ If an API call accepts multiple "models" in the XML request (PARAMS sub-nodes with nontrivial sub-nodes of their own), it is probably a subclass of
24
+ GlobalCollect::Requests::Composite
25
+ and is constructed with Model-Builder pairs like this:
26
+ GlobalCollect::Requests::DoRefund.new([payment_request_model, GlobalCollect::Builders::DoRefund::Payment])
27
+ _The models and builders are usually paired in their respective module hierarchies:_
28
+ GlobalCollect::RequestModels::DoRefund::Payment
29
+ vs.
30
+ GlobalCollect::Builders::DoRefund::Payment
31
+ In the case where the arguments to the request constructor are models, the validation for the values in the models is encapsulated in the model itself.
32
+
33
+ If the call accepts a fixed set of non-nested arguments, it will probably be implemented as a subclass of
34
+ GlobalCollect::Requests::Simple
35
+ and be constructed with the values of the arguments without and intermediary model. Validation for these members is defined in the request, in this case.
36
+
37
+ ### Builders
38
+ `Builders` simply take hash-like objects (usually a RequestModel or just a hash for simpler calls) and construct the sub-nodes of the `PARAMS` XML node in the request. As mentioned above, `Builders` are paired with their `RequestModels` by name, simply replacing '`RequestModels`' with '`Builders`' in the module path.
39
+
40
+ ### RequestModels
41
+ As mentioned above, `RequestModels` are a way of breaking up the multiple conceptual arguments to the API. They are paired to their Builders as mentioned above. They're really just a nice way to get a little sanity into this piece when the XML structures that are used as arguments to the API get a bit hairy. (In the sense that they form a kind of inheritance tree, depending on the payment type, or that they have multiple, large arguments, etc...) However, there has been a conscious effort to eschew this complexity when dealing with API calls that really don't have much relative conceptual complexity. (`GetOrderStatus` really only has one string as an argument, `ORDERID`, even though it is nested in an `ORDER` node.)
42
+
43
+ ### Responses
44
+ #### The raw responses from the API are divided into five groups:
45
+ * Basic
46
+ * No content besides `META`, `RESULT`, or `ERROR`
47
+ * Success Row (Single)
48
+ * Basic + `ROW` node which contains a roughly fixed set of keys independent of input as well as an extra set of keys that vary based on input.
49
+ * For instance, `CONVERT_AMOUNT` returns a fixed set of keys.
50
+ * But, `INSERT_ORDERWITHPAYMENT` returns extra keys depending on payment type.
51
+ * Success Row (Multiple)
52
+ * Basic + multiple `ROW` nodes, each containing a basic set of fixed keys
53
+ * Currently, only `GET_ORDER_STATUS` (v1.0) has been verified to return one OR multiple rows if multiple efforts (for recurring payments) or multiple attempts on efforts have been made. (This was learned not from the API docs, but from a GC rep.)
54
+ * Complex
55
+ * Basic + multiple subnodes of `RESULT` that do not follow the `ROW`/keys format.
56
+ * For instance, `GET_ORDERSTATUS` (v2.0) could return multiple `STATUS` nodes.
57
+
58
+ #### The strategy for handling them is as follows:
59
+ The base response, `GlobalCollect::Responses::Base`, is augmented by mix-in modules suggested by the `suggested_response_mixins` method of the request. These mix-ins allow pretty, method-style access to the members.
60
+
61
+ `GlobalCollect::Requests::Simple` requests define the `suggested_response_mixins` directly in the implementation, whereas `GlobalCollect::Requests::Composite` delegate to their contained `RequestModels`. This follows the GC API's pattern of defining the response's nodes based on the type of payment product selected, version used, service used, etc for certain requests.
62
+
63
+ For responses that follow the singular "Success Row"-style, `GlobalCollect::Responses::SuccessRow` is included first and then augmented with extra modules if necessary.
64
+
65
+ For the other responses, there's no particular structure to the implementations.
66
+
67
+ However, if basic hash-style access to the Crack-parsed response is desired, you can easily do so like this:
68
+ response = client.make_request(some_request)
69
+ response.response_hash["XML"]["REQUEST"]["RESPONSE"]["META"]["REQUESTID"] == response.request_id
70
+ # => true
71
+
72
+ ### Validation
73
+ The GlobalCollect programmer's guide (see below for specific documentation notes) has specified the data formatting expected in requests, and as such, they appear in this gem in roughly the same data format as they appear there:
74
+ FIELDNAME => [REQUIRED?, FORMAT_STRING]
75
+ However, in the cases where a field is required only when using a specific service or product, I have relaxed the requirements for the base model. For instance, see the difference between:
76
+ GlobalCollect::RequestModels::InsertOrderWithPayment::CreditCardOnlinePayment
77
+ vs
78
+ GlobalCollect::RequestModels::InsertOrderWithPayment::HostedCreditCardOnlinePayment
79
+
80
+ In the Hosted version, the field definitions for `CARDNUMBER` and `EXPIRYDATE` have been changed from "R" (required) to "O" (optional), even though the programmer's guide has them marked as "R" with a superscript indicating they are not required in the particular case of HostedMerchantLink payments.
81
+
82
+ ## Notes
83
+ ### On testing:
84
+
85
+ Complete test coverage has not been a priority, given the simplistic nature of some of the components. For instance, the modules under `GlobalCollect::Responses` are for the most part the same mechanics (convert a string to an accessor) wrapped around slightly different metadata (lists of method names). I've omitted complete coverage of these methods, in favor of testing the mechanics here and there. Anything that does more than define trivial accessors, in those modules has been tested. A similar approach has been adopted everywhere else; test the moving parts everywhere, test the metadata-transformation stuff once.
86
+
87
+ I have also provided some sanitized, canned XML responses (in `spec/support/*_response.xml`) that have either been garnered from the Programmer's Guide PDF or from the wire logs produced during the integration testing period.
88
+
89
+ ### On documentation:
90
+
91
+ All documentation references (like '§ WDL 5.26.1') in the source code refer to the "GlobalCollect WDL Programmers Guide -- 17 November 2009" document (section 5.26.1, in our previous parenthetical), which you'll have to get from GlobalCollect.
92
+
93
+ ### On GC API naming conventions:
94
+
95
+ They have a curious and inconsistent underscoring convention that I'm not fond of. (API actions `INSERT_ORDERWITHPAYMENT` vs. `DO_POSTAL_REMINDER`, fields like `ORDERID` and `CURRENCYCODE`) As a result, I've added underscores between words that lacked it when defining reader methods and when naming classes and modules (`InsertOrderWithPayment`, `GetOrderStatus`, `#order_id`, `#currency_code`). However, to avoid confusion in what you're sending to GC, I have left the hash keys for models and requests the same as the names of the XML nodes whose content they represent. I may change this in the future to add the prettier hash keys as an option (strings => raw names, underscored symbols => pretty names).
96
+
97
+ ### On GC API versions:
98
+
99
+ There are currently two API versions: 1.0 and 2.0. However, not all requests are implemented on GC's end in version 2.0. Notably, `GET_ORDERSTATUS` has a 2.0 call.
100
+
101
+ ### On wire logging:
102
+ If you specify
103
+ GlobalCollect.wire_log_file = "mylog.log"
104
+ the raw XML of all requests and responses will be logged to that file *unsanitized*. Be sure to keep these secure if you choose that option as they could contain addresses, emails, credit card numbers, etc. If no file is specified, logging will be done to STDOUT.
105
+
106
+ To assign your own logger to the gem, simply do:
107
+ your_logger = Rails.logger
108
+ GlobalCollect.wire_logger = your_logger
109
+ client = GlobalCollect::ApiClient.new ...
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ task :default => :spec
2
+ task :test => :spec
3
+
4
+ desc "Build a gem"
5
+ task :gem => [ :gemspec, :build ]
6
+
7
+ desc "Run specs"
8
+ task :spec do
9
+ exec "spec spec/global_collect_spec.rb"
10
+ end
11
+
12
+
13
+
14
+ begin
15
+ require 'jeweler'
16
+ Jeweler::Tasks.new do |gemspec|
17
+ gemspec.name = "global_collect"
18
+ gemspec.summary = "A Ruby client to the Global Collect API"
19
+ gemspec.description = <<END
20
+ Gives minimally intrusive access to Global Collect's payment processing API.
21
+ Currently implements a very small segment of the full API but is built with
22
+ extensibility in mind.
23
+ END
24
+ gemspec.email = "timon.karnezos@gmail.com"
25
+ gemspec.homepage = "http://github.com/timonk/global_collect"
26
+ gemspec.authors = ["Timon Karnezos"]
27
+ gemspec.version = "0.1.0"
28
+ gemspec.add_dependency('httparty', '>= 0.5.2')
29
+ gemspec.add_dependency('builder', '>= 2.0')
30
+ end
31
+ rescue LoadError
32
+ warn "Jeweler not available. Install it with:"
33
+ warn "gem install jeweler"
34
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = ""
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ req = GlobalCollect::Requests::CancelPayment.new("32","111","11")
13
+ response = client.make_request(req)
14
+ p response.success?
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = ""
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ req = GlobalCollect::Requests::ConvertAmount.new("32","USD","GBP")
13
+ response = client.make_request(req)
14
+ p response.success?
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = ""
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ req = GlobalCollect::Requests::GetOrderStatus.new("53")
13
+ req.version = "2.0"
14
+ response = client.make_request(req)
15
+ p response.success?
@@ -0,0 +1,37 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = ""
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ response = client.make_request(
13
+ GlobalCollect::Requests::InsertOrderWithPayment.new(
14
+ [
15
+ GlobalCollect::RequestModels::InsertOrderWithPayment::Order.new(
16
+ "ORDERID" => "341",
17
+ "AMOUNT" => "100",
18
+ "LANGUAGECODE" => "en",
19
+ "CURRENCYCODE" => "USD",
20
+ "COUNTRYCODE" => "US",
21
+ "MERCHANTREFERENCE" => "123114"
22
+ ),
23
+ GlobalCollect::Builders::InsertOrderWithPayment::Order
24
+ ],
25
+ [
26
+ GlobalCollect::RequestModels::InsertOrderWithPayment::HostedCreditCardOnlinePayment.new(
27
+ "PAYMENTPRODUCTID" => "3",
28
+ "AMOUNT" => "100",
29
+ "CURRENCYCODE" => "GBP",
30
+ "LANGUAGECODE" => "en",
31
+ "COUNTRYCODE" => "US"
32
+ ),
33
+ GlobalCollect::Builders::InsertOrderWithPayment::HostedCreditCardOnlinePayment
34
+ ]
35
+ )
36
+ )
37
+ p response.success?
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = ""
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ response = client.make_request(GlobalCollect::Requests::ProcessChallenged.new("51"))
13
+ p response.success?
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = "5393"
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ response = client.make_request(
13
+ GlobalCollect::Requests::SetPayment.new(
14
+ [
15
+ GlobalCollect::RequestModels::SetPayment::Payment.new(
16
+ "ORDERID" => "33",
17
+ "PAYMENTPRODUCTID" => "3"
18
+ ),
19
+ GlobalCollect::Builders::SetPayment::Payment
20
+ ]
21
+ )
22
+ )
23
+ p response.success?
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
+
4
+ GlobalCollect.merchant_id = ""
5
+ GlobalCollect.authentication_scheme = :ip_check
6
+ GlobalCollect.environment = :test
7
+ GlobalCollect.ip_address = ""
8
+ #GlobalCollect.wire_log_file = File.join(File.dirname(__FILE__), "gc.log")
9
+
10
+ client = GlobalCollect.merchant_link_client
11
+
12
+ response = client.make_request(GlobalCollect::Requests::TestConnection.new)
13
+ p response.success?
@@ -0,0 +1,170 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{global_collect}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Timon Karnezos"]
12
+ s.date = %q{2010-04-27}
13
+ s.description = %q{Gives minimally intrusive access to Global Collect's payment processing API.
14
+ Currently implements a very small segment of the full API but is built with
15
+ extensibility in mind.
16
+ }
17
+ s.email = %q{timon.karnezos@gmail.com}
18
+ s.extra_rdoc_files = [
19
+ "README.markdown"
20
+ ]
21
+ s.files = [
22
+ "COPYING",
23
+ "README.markdown",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "examples/cancel_payment.rb",
27
+ "examples/convert_amount.rb",
28
+ "examples/get_order_status.rb",
29
+ "examples/insert_order_with_payment.rb",
30
+ "examples/process_challenged.rb",
31
+ "examples/set_payment.rb",
32
+ "examples/test_connection.rb",
33
+ "global_collect.gemspec",
34
+ "lib/global_collect.rb",
35
+ "lib/global_collect/api_client.rb",
36
+ "lib/global_collect/builders/do_refund/credit_card_payment.rb",
37
+ "lib/global_collect/builders/do_refund/payment.rb",
38
+ "lib/global_collect/builders/insert_order_with_payment/credit_card_online_payment.rb",
39
+ "lib/global_collect/builders/insert_order_with_payment/hosted_credit_card_online_payment.rb",
40
+ "lib/global_collect/builders/insert_order_with_payment/order.rb",
41
+ "lib/global_collect/builders/insert_order_with_payment/payment.rb",
42
+ "lib/global_collect/builders/set_payment/payment.rb",
43
+ "lib/global_collect/const/payment_product.rb",
44
+ "lib/global_collect/const/payment_status.rb",
45
+ "lib/global_collect/field_validator.rb",
46
+ "lib/global_collect/request_models/base.rb",
47
+ "lib/global_collect/request_models/do_refund/credit_card_payment.rb",
48
+ "lib/global_collect/request_models/do_refund/payment.rb",
49
+ "lib/global_collect/request_models/insert_order_with_payment/credit_card_online_payment.rb",
50
+ "lib/global_collect/request_models/insert_order_with_payment/hosted_credit_card_online_payment.rb",
51
+ "lib/global_collect/request_models/insert_order_with_payment/order.rb",
52
+ "lib/global_collect/request_models/insert_order_with_payment/payment.rb",
53
+ "lib/global_collect/request_models/set_payment/payment.rb",
54
+ "lib/global_collect/requests/base.rb",
55
+ "lib/global_collect/requests/cancel_payment.rb",
56
+ "lib/global_collect/requests/composite.rb",
57
+ "lib/global_collect/requests/convert_amount.rb",
58
+ "lib/global_collect/requests/do_refund.rb",
59
+ "lib/global_collect/requests/get_order_status.rb",
60
+ "lib/global_collect/requests/insert_order_with_payment.rb",
61
+ "lib/global_collect/requests/process_challenged.rb",
62
+ "lib/global_collect/requests/set_payment.rb",
63
+ "lib/global_collect/requests/simple.rb",
64
+ "lib/global_collect/requests/test_connection.rb",
65
+ "lib/global_collect/responses/base.rb",
66
+ "lib/global_collect/responses/convert_amount/response_methods.rb",
67
+ "lib/global_collect/responses/do_refund/response_methods.rb",
68
+ "lib/global_collect/responses/get_order_status/v1_response_methods.rb",
69
+ "lib/global_collect/responses/get_order_status/v2_response_methods.rb",
70
+ "lib/global_collect/responses/insert_order_with_payment/credit_card_online_payment_response_methods.rb",
71
+ "lib/global_collect/responses/insert_order_with_payment/hosted_merchant_link_payment_response_methods.rb",
72
+ "lib/global_collect/responses/success_row.rb",
73
+ "spec/api_client_spec.rb",
74
+ "spec/builders/do_refund/credit_card_payment_spec.rb",
75
+ "spec/builders/do_refund/payment_spec.rb",
76
+ "spec/builders/insert_order_with_payment/credit_card_online_payment_spec.rb",
77
+ "spec/builders/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb",
78
+ "spec/builders/insert_order_with_payment/order_spec.rb",
79
+ "spec/builders/insert_order_with_payment/payment_spec.rb",
80
+ "spec/builders/set_payment/payment_spec.rb",
81
+ "spec/field_validator_spec.rb",
82
+ "spec/global_collect_spec.rb",
83
+ "spec/request_models/base_spec.rb",
84
+ "spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb",
85
+ "spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb",
86
+ "spec/requests/base_spec.rb",
87
+ "spec/requests/composite_spec.rb",
88
+ "spec/requests/convert_amount.rb",
89
+ "spec/requests/insert_order_with_payment_spec.rb",
90
+ "spec/requests/simple_spec.rb",
91
+ "spec/responses/base_spec.rb",
92
+ "spec/responses/convert_amount/response_methods_spec.rb",
93
+ "spec/responses/do_refund/response_methods_spec.rb",
94
+ "spec/responses/get_order_status/v1_response_methods_spec.rb",
95
+ "spec/responses/get_order_status/v2_response_methods_spec.rb",
96
+ "spec/responses/insert_order_with_payment/credit_card_online_payment_response_methods_spec.rb",
97
+ "spec/responses/insert_order_with_payment/hosted_merchant_link_payment_response_methods_spec.rb",
98
+ "spec/responses/succcess_row_spec.rb",
99
+ "spec/spec_helper.rb",
100
+ "spec/support/challenged_iowp_response.xml",
101
+ "spec/support/successful_convert_amount_response.xml",
102
+ "spec/support/successful_do_refund_response.xml",
103
+ "spec/support/successful_get_order_status_v1_response.xml",
104
+ "spec/support/successful_get_order_status_v2_response.xml",
105
+ "spec/support/successful_hosted_iowp_response.xml",
106
+ "spec/support/successful_iowp_response.xml",
107
+ "spec/support/successful_process_challenged_response.xml",
108
+ "spec/support/unsuccessful_do_refund_response.xml",
109
+ "spec/support/unsuccessful_iowp_response.xml",
110
+ "spec/support/unsuccessful_process_challenged_response.xml"
111
+ ]
112
+ s.homepage = %q{http://github.com/timonk/global_collect}
113
+ s.rdoc_options = ["--charset=UTF-8"]
114
+ s.require_paths = ["lib"]
115
+ s.rubygems_version = %q{1.3.6}
116
+ s.summary = %q{A Ruby client to the Global Collect API}
117
+ s.test_files = [
118
+ "spec/api_client_spec.rb",
119
+ "spec/builders/do_refund/credit_card_payment_spec.rb",
120
+ "spec/builders/do_refund/payment_spec.rb",
121
+ "spec/builders/insert_order_with_payment/credit_card_online_payment_spec.rb",
122
+ "spec/builders/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb",
123
+ "spec/builders/insert_order_with_payment/order_spec.rb",
124
+ "spec/builders/insert_order_with_payment/payment_spec.rb",
125
+ "spec/builders/set_payment/payment_spec.rb",
126
+ "spec/field_validator_spec.rb",
127
+ "spec/global_collect_spec.rb",
128
+ "spec/request_models/base_spec.rb",
129
+ "spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb",
130
+ "spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb",
131
+ "spec/requests/base_spec.rb",
132
+ "spec/requests/composite_spec.rb",
133
+ "spec/requests/convert_amount.rb",
134
+ "spec/requests/insert_order_with_payment_spec.rb",
135
+ "spec/requests/simple_spec.rb",
136
+ "spec/responses/base_spec.rb",
137
+ "spec/responses/convert_amount/response_methods_spec.rb",
138
+ "spec/responses/do_refund/response_methods_spec.rb",
139
+ "spec/responses/get_order_status/v1_response_methods_spec.rb",
140
+ "spec/responses/get_order_status/v2_response_methods_spec.rb",
141
+ "spec/responses/insert_order_with_payment/credit_card_online_payment_response_methods_spec.rb",
142
+ "spec/responses/insert_order_with_payment/hosted_merchant_link_payment_response_methods_spec.rb",
143
+ "spec/responses/succcess_row_spec.rb",
144
+ "spec/spec_helper.rb",
145
+ "examples/cancel_payment.rb",
146
+ "examples/convert_amount.rb",
147
+ "examples/get_order_status.rb",
148
+ "examples/insert_order_with_payment.rb",
149
+ "examples/process_challenged.rb",
150
+ "examples/set_payment.rb",
151
+ "examples/test_connection.rb"
152
+ ]
153
+
154
+ if s.respond_to? :specification_version then
155
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
156
+ s.specification_version = 3
157
+
158
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
159
+ s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
160
+ s.add_runtime_dependency(%q<builder>, [">= 2.0"])
161
+ else
162
+ s.add_dependency(%q<httparty>, [">= 0.5.2"])
163
+ s.add_dependency(%q<builder>, [">= 2.0"])
164
+ end
165
+ else
166
+ s.add_dependency(%q<httparty>, [">= 0.5.2"])
167
+ s.add_dependency(%q<builder>, [">= 2.0"])
168
+ end
169
+ end
170
+