cardconnect 1.1.1 → 2.0.0

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/README.md +18 -5
  4. data/Rakefile +34 -10
  5. data/lib/cardconnect.rb +7 -3
  6. data/lib/cardconnect/services/authorization/authorization_response.rb +1 -1
  7. data/lib/cardconnect/services/profile/profile.rb +25 -0
  8. data/lib/cardconnect/services/profile/profile_delete_request.rb +49 -0
  9. data/lib/cardconnect/services/profile/profile_delete_response.rb +39 -0
  10. data/lib/cardconnect/services/profile/profile_get_request.rb +49 -0
  11. data/lib/cardconnect/services/profile/profile_get_response.rb +40 -0
  12. data/lib/cardconnect/services/{deposit/deposit_request.rb → profile/profile_put_request.rb} +11 -21
  13. data/lib/cardconnect/services/profile/profile_put_response.rb +42 -0
  14. data/lib/cardconnect/services/service_endpoint.rb +7 -0
  15. data/lib/cardconnect/utils.rb +1 -0
  16. data/lib/cardconnect/version.rb +1 -1
  17. data/test/api_request_stubs.rb +32 -4
  18. data/test/api_response_stubs.rb +62 -30
  19. data/test/cardconnect/services/inquire/inquire_test.rb +1 -1
  20. data/test/cardconnect/services/profile/profile_delete_request_test.rb +50 -0
  21. data/test/cardconnect/services/profile/profile_delete_response_test.rb +67 -0
  22. data/test/cardconnect/services/profile/profile_get_request_test.rb +50 -0
  23. data/test/cardconnect/services/profile/profile_get_response_test.rb +127 -0
  24. data/test/cardconnect/services/profile/profile_put_request_test.rb +114 -0
  25. data/test/cardconnect/services/profile/profile_test.rb +168 -0
  26. metadata +22 -12
  27. data/lib/cardconnect/services/deposit/deposit.rb +0 -15
  28. data/lib/cardconnect/services/deposit/deposit_response.rb +0 -39
  29. data/test/cardconnect/services/deposit/deposit_request_test.rb +0 -65
  30. data/test/cardconnect/services/deposit/deposit_response_test.rb +0 -77
  31. data/test/cardconnect/services/deposit/deposit_test.rb +0 -55
@@ -1,77 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe CardConnect::Service::DepositResponse do
4
- before do
5
- @response = CardConnect::Service::DepositResponse.new(valid_deposit_response)
6
- end
7
-
8
- after do
9
- @response = nil
10
- end
11
-
12
- it 'should have the deposit id' do
13
- @response.depositid.must_equal 7
14
- end
15
-
16
- it 'should have the merchant id' do
17
- @response.merchid.must_equal '000000927996'
18
- end
19
-
20
- it 'should have the respproc' do
21
- @response.respproc.must_equal 'FNOR'
22
- end
23
-
24
- it 'should have the accttype' do
25
- @response.accttype.must_equal 'VI'
26
- end
27
-
28
- it 'should have the action' do
29
- @response.action.must_equal 'DEB'
30
- end
31
-
32
- it 'should have the actdate' do
33
- @response.actdate.must_equal '20121008'
34
- end
35
-
36
- it 'should have the postdate' do
37
- @response.postdate.must_equal '20121009'
38
- end
39
-
40
- it 'should have the currency' do
41
- @response.currency.must_equal 'USD'
42
- end
43
-
44
- it 'should have the amount' do
45
- @response.amount.must_equal '11.00'
46
- end
47
-
48
- it 'should have the feeamnt' do
49
- @response.feeamnt.must_equal '0.55'
50
- end
51
-
52
- it 'should have the cbakamnt' do
53
- @response.cbakamnt.must_equal '0.00'
54
- end
55
-
56
- it 'should have the resptext' do
57
- @response.resptext.must_equal 'Successful or something'
58
- end
59
-
60
- it 'should have the transactions' do
61
- @response.txns.must_equal [{ merchbatch: 92821429, retref: '282005142924', hostbatch: '1429',
62
- feeamnt: '0.00', action: 'DEB', depamnt: '11.00' }]
63
- end
64
-
65
- describe '#body' do
66
- it 'should have all the right fields in the body' do
67
- @response.body.keys.must_equal [:depositid, :merchid, :respproc, :accttype, :action, :actdate,
68
- :postdate, :currency, :amount, :feeamnt, :cbakamnt, :resptext, :txns]
69
- end
70
-
71
- it 'should generate hash with all the right values' do
72
- valid_payload = symbolize_keys(valid_deposit_response.first)
73
- valid_payload[:txns] = valid_payload[:txns].map { |txn| symbolize_keys(txn) }
74
- @response.body.must_equal valid_payload
75
- end
76
- end
77
- end
@@ -1,55 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe CardConnect::Service::Deposit do
4
- before do
5
- @connection = CardConnect::Connection.new.connection do |stubs|
6
- stubs.get(@service.path) { [200, {}, valid_deposit_response] }
7
- end
8
- @service = CardConnect::Service::Deposit.new(@connection)
9
- end
10
-
11
- after do
12
- @service = nil
13
- end
14
-
15
- it 'must have the right path' do
16
- @service.path.must_equal '/cardconnect/rest/deposit'
17
- end
18
-
19
- describe '#build_request' do
20
- before do
21
- @valid_params = valid_deposit_request
22
- end
23
-
24
- after do
25
- @valid_params = nil
26
- end
27
-
28
- it 'creates a Capture request object with the passed in params' do
29
- @service.build_request(@valid_params)
30
-
31
- @service.request.must_be_kind_of CardConnect::Service::DepositRequest
32
- @service.request.merchid.must_equal '000000927996'
33
- @service.request.date.must_equal '0110'
34
- end
35
-
36
- it 'uses default merchant ID if merchid is not passed in' do
37
- @service.build_request(@valid_params.reject! { |k, _| k == 'merchid' })
38
- @service.request.must_be_kind_of CardConnect::Service::DepositRequest
39
- @service.request.merchid.must_equal 'merchant123'
40
- end
41
- end
42
-
43
- describe '#submit' do
44
- it 'raises an error when there is no request' do
45
- @service.request.nil?.must_equal true
46
- proc { @service.submit }.must_raise CardConnect::Error
47
- end
48
-
49
- it 'creates a response when a valid request is processed' do
50
- @service.build_request(valid_deposit_request)
51
- @service.submit
52
- @service.response.must_be_kind_of CardConnect::Service::DepositResponse
53
- end
54
- end
55
- end