an 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/an.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "an"
3
- s.version = "0.0.2"
3
+ s.version = "0.0.3"
4
4
  s.summary = "A thin Authorize.NET client."
5
5
  s.description = "AN is a simplified client for integration with Authorize.NET."
6
6
  s.authors = ["Cyril David"]
data/lib/an.rb CHANGED
@@ -46,6 +46,10 @@ class AN
46
46
  call("createCustomerProfileTransactionRequest", params)
47
47
  end
48
48
 
49
+ def get_profile(params)
50
+ call("getCustomerProfileRequest", params)
51
+ end
52
+
49
53
  private
50
54
  def call(api_call, params)
51
55
  Response.new(post(payload(api_call, params)))
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <getCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
3
+ <merchantAuthentication>
4
+ <name>{{ login }}</name>
5
+ <transactionKey>{{ transaction_key }}</transactionKey>
6
+ </merchantAuthentication>
7
+
8
+ <customerProfileId>{{ profile_id }}</customerProfileId>
9
+ </getCustomerProfileRequest>
data/test/an.rb CHANGED
@@ -119,5 +119,15 @@ scope do
119
119
  assert resp.authorization.success?
120
120
  assert_equal "XXXX1111", resp.authorization["accountNumber"]
121
121
  assert_equal "Visa", resp.authorization["accountType"]
122
+
123
+ # Verify profile and payment profiles defined
124
+ resp = gateway.get_profile({profile_id: profile_id})
125
+ assert resp.success?
126
+ assert_equal profile_id, resp["profile"]["customerProfileId"]
127
+ assert_equal "XXXX1111", resp["profile"]["paymentProfiles"]["payment"]["creditCard"]["cardNumber"]
128
+ assert_equal "Quentin", resp["profile"]["paymentProfiles"]["billTo"]["firstName"]
129
+ assert_equal "Tarantino", resp["profile"]["paymentProfiles"]["billTo"]["lastName"]
130
+ assert_equal "#12345 Foobar street", resp["profile"]["paymentProfiles"]["billTo"]["address"]
131
+ assert_equal "90210", resp["profile"]["paymentProfiles"]["billTo"]["zip"]
122
132
  end
123
133
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: an
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000 Z
12
+ date: 2013-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mote
@@ -76,6 +76,7 @@ files:
76
76
  - templates/createCustomerProfileRequest.mote
77
77
  - templates/createCustomerProfileTransactionRequest.mote
78
78
  - templates/createTransactionRequest.mote
79
+ - templates/getCustomerProfileRequest.mote
79
80
  homepage: http://github.com/cyx/an
80
81
  licenses: []
81
82
  post_install_message: