nfg-client 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ require 'unit/response_stubs/spec_response_helpers'
2
+
3
+ def successful_get_donor_cofs_response(donor_token)
4
+ <<-XML
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
7
+ <soap:Body>
8
+ <GetDonorCOFsResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
9
+ <GetDonorCOFsResult>
10
+ <DonorToken>#{donor_token}</DonorToken>
11
+ <Cards>
12
+ <COFRecord>
13
+ <COFId>33333333</COFId>
14
+ <CardType>Visa</CardType>
15
+ <CCSuffix>4236</CCSuffix>
16
+ <CCExpMonth>05</CCExpMonth>
17
+ <CCExpYear>16</CCExpYear>
18
+ <bInUseByLiveRD>true</bInUseByLiveRD>
19
+ <COFEmailAddress></COFEmailAddress>
20
+ </COFRecord>
21
+ <COFRecord>
22
+ <COFId>44444444</COFId>
23
+ <CardType>Mastercard</CardType>
24
+ <CCSuffix>5647</CCSuffix>
25
+ <CCExpMonth>06</CCExpMonth>
26
+ <CCExpYear>18</CCExpYear>
27
+ <bInUseByLiveRD></bInUseByLiveRD>
28
+ <COFEmailAddress></COFEmailAddress>
29
+ </COFRecord>
30
+ </Cards>
31
+ <StatusCode>Success</StatusCode>
32
+ <Message></Message>
33
+ <ErrorDetails></ErrorDetails>
34
+ <CallDuration>0.051235</CallDuration>
35
+ </GetDonorCOFsResult>
36
+ </GetDonorCOFsResponse>
37
+ </soap:Body>
38
+ </soap:Envelope>
39
+ XML
40
+ end
41
+
42
+ def unsuccessful_get_donor_cofs_response(donor_token)
43
+ <<-XML
44
+ <?xml version="1.0" encoding="utf-8"?>
45
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
46
+ <soap:Body>
47
+ <GetDonorCOFsResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
48
+ <GetDonorCOFsResult>
49
+ <DonorToken>#{donor_token}</DonorToken>
50
+ <StatusCode>ValidationFailed</StatusCode>
51
+ <Cards>
52
+ </Cards>
53
+ <Message>UserNotFound - No existing NFG user record associated with the specified DonorToken</Message>
54
+ <ErrorDetails>
55
+ <ErrorInfo>
56
+ <ErrCode>UserNotFound</ErrCode>
57
+ <ErrData></ErrData>
58
+ </ErrorInfo>
59
+ </ErrorDetails>
60
+ <CallDuration>0.051235</CallDuration>
61
+ </GetDonorCOFsResult>
62
+ </GetDonorCOFsResponse>
63
+ </soap:Body>
64
+ </soap:Envelope>
65
+ XML
66
+ end
@@ -0,0 +1,62 @@
1
+ require 'unit/response_stubs/spec_response_helpers'
2
+
3
+ def successful_get_donor_donation_history_response
4
+ <<-XML
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
7
+ <soap:Body>
8
+ <GetDonorDonationHistoryResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
9
+ <GetDonorDonationHistoryResult>
10
+ <Donations>
11
+ <DonationItemData>
12
+ <DonationDate>2014-05-22 04:35:00:00</DonationDate>
13
+ <RecurType>Monthly</RecurType>
14
+ <IsTpcAddOnFee>0</IsTpcAddOnFee>
15
+ <NpoName>Red Cross</NpoName>
16
+ <Designation>Famine Relief</Designation>
17
+ <Dedication></Dedication>
18
+ <Amount>50.00</Amount>
19
+ <ChargeId>292929</ChargeId>
20
+ </DonationItemData>
21
+ <DonationItemData>
22
+ <DonationDate>2014-02-22 04:35:00:00</DonationDate>
23
+ <RecurType>NotRecurring</RecurType>
24
+ <IsTpcAddOnFee>1</IsTpcAddOnFee>
25
+ <NpoName>Save The Children</NpoName>
26
+ <Designation>Ethopia Fund</Designation>
27
+ <Dedication>For my mother</Dedication>
28
+ <Amount>250.00</Amount>
29
+ <ChargeId>8939399</ChargeId>
30
+ </DonationItemData>
31
+ </Donations>
32
+ <DonorToken>1828282</DonorToken>
33
+ <StatusCode>Success</StatusCode>
34
+ <Message></Message>
35
+ <ErrorDetails></ErrorDetails>
36
+ <CallDuration>0.051235</CallDuration>
37
+ </GetDonorDonationHistoryResult>
38
+ </GetDonorDonationHistoryResponse>
39
+ </soap:Body>
40
+ </soap:Envelope>
41
+ XML
42
+ end
43
+
44
+ def unsuccessful_get_donor_donation_history_response
45
+ <<-XML
46
+ <?xml version="1.0" encoding="utf-8"?>
47
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
48
+ <soap:Body>
49
+ <GetDonorDonationHistoryResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
50
+ <GetDonorDonationHistoryResult>
51
+ <Message></Message>
52
+ <CallDuration>0</CallDuration>
53
+ <StatusCode>Success</StatusCode>
54
+ <Donations/>
55
+ <ErrorDetails/>
56
+ <DonorToken>1828282</DonorToken>
57
+ </GetDonorDonationHistoryResult>
58
+ </GetDonorDonationHistoryResponse>
59
+ </soap:Body>
60
+ </soap:Envelope>
61
+ XML
62
+ end
@@ -0,0 +1,49 @@
1
+ require 'unit/response_stubs/spec_response_helpers'
2
+
3
+ def successful_get_fee_response
4
+ <<-XML
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
7
+ <soap:Body>
8
+ <GetFeeResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
9
+ <GetFeeResult>
10
+ <TotalChargeAmount>110.00</TotalChargeAmount>
11
+ <TotalAddFee>9.00</TotalAddFee>
12
+ <TotalDeductFee>0</TotalDeductFee>
13
+ <TipAmount>1.00</TipAmount>
14
+ <StatusCode>Success</StatusCode>
15
+ <Message></Message>
16
+ <ErrorDetails></ErrorDetails>
17
+ <CallDuration>0.051235</CallDuration>
18
+ </GetFeeResult>
19
+ </GetFeeResponse>
20
+ </soap:Body>
21
+ </soap:Envelope>
22
+ XML
23
+ end
24
+
25
+ def unsuccessful_get_fee_response
26
+ <<-XML
27
+ <?xml version="1.0" encoding="utf-8"?>
28
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
29
+ <soap:Body>
30
+ <GetFeeResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
31
+ <GetFeeResult>
32
+ <ErrorDetails>
33
+ <ErrorInfo>
34
+ <ErrCode>NpoNotFound</ErrCode>
35
+ <ErrData>The NPO EIN "54-545454" is invalid.</ErrData>
36
+ </ErrorInfo>
37
+ </ErrorDetails>
38
+ <Message></Message>
39
+ <CallDuration>0</CallDuration>
40
+ <TotalChargeAmount>0.0</TotalChargeAmount>
41
+ <TotalAddFee>0.0</TotalAddFee>
42
+ <TotalDeductFee>0.0</TotalDeductFee>
43
+ <TipAmount>0.0</TipAmount>
44
+ </GetFeeResult>
45
+ </GetFeeResponse>
46
+ </soap:Body>
47
+ </soap:Envelope>
48
+ XML
49
+ end
@@ -0,0 +1,46 @@
1
+ require 'unit/response_stubs/spec_response_helpers'
2
+
3
+ def successful_make_cof_donation_response
4
+ <<-XML
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
7
+ <soap:Body>
8
+ <MakeCOFDonationResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
9
+ <MakeCOFDonationResult>
10
+ <ChargeId>3333333</ChargeId>
11
+ <CofId>1111111</CofId>
12
+ <StatusCode>Success</StatusCode>
13
+ <Message></Message>
14
+ <ErrorDetails></ErrorDetails>
15
+ <CallDuration>0.051235</CallDuration>
16
+ </MakeCOFDonationResult>
17
+ </MakeCOFDonationResponse>
18
+ </soap:Body>
19
+ </soap:Envelope>
20
+ XML
21
+ end
22
+
23
+ def unsuccessful_make_cof_donation_response
24
+ <<-XML
25
+ <?xml version="1.0" encoding="utf-8"?>
26
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
27
+ <soap:Body>
28
+ <MakeCOFDonationResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
29
+ <MakeCOFDonationResult>
30
+ <ChargeId></ChargeId>
31
+ <CofId></CofId>
32
+ <StatusCode>ChargeFailed</StatusCode>
33
+ <Message>InvalidCardOnFile - Specified Card on File could not be found or has been cancelled</Message>
34
+ <ErrorDetails>
35
+ <ErrorInfo>
36
+ <ErrCode>InvalidCardOnFile</ErrCode>
37
+ <ErrData></ErrData>
38
+ </ErrorInfo>
39
+ </ErrorDetails>
40
+ <CallDuration>0.051235</CallDuration>
41
+ </MakeCOFDonationResult>
42
+ </MakeCOFDonationResponse>
43
+ </soap:Body>
44
+ </soap:Envelope>
45
+ XML
46
+ end
@@ -0,0 +1,47 @@
1
+ require 'unit/response_stubs/spec_response_helpers'
2
+
3
+ def successful_make_donation_add_cof_response(donor_token)
4
+ <<-XML
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
7
+ <soap:Body>
8
+ <MakeDonationAddCOFResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
9
+ <MakeDonationAddCOFResult>
10
+ <ChargeId>3333333</ChargeId>
11
+ <CofId>1111111</CofId>
12
+ <StatusCode>Success</StatusCode>
13
+ <Message></Message>
14
+ <ErrorDetails></ErrorDetails>
15
+ <CallDuration>0.051235</CallDuration>
16
+ </MakeDonationAddCOFResult>
17
+ </MakeDonationAddCOFResponse>
18
+ </soap:Body>
19
+ </soap:Envelope>
20
+ XML
21
+ end
22
+
23
+ def unsuccessful_make_donation_add_cof_response(donor_token)
24
+ <<-XML
25
+ <?xml version="1.0" encoding="utf-8"?>
26
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
27
+ <soap:Body>
28
+ <MakeDonationAddCOFResponse xmlns="http://api.networkforgood.org/partnerdonationservice">
29
+ <MakeDonationAddCOFResult>
30
+ <ChargeId></ChargeId>
31
+ <CofId></CofId>
32
+ <StatusCode>ChargeFailed</StatusCode>
33
+ <Message>InvalidCreditCardNumber - Credit Card Number failed validation</Message>
34
+ <ErrorDetails>
35
+ <ErrorInfo>
36
+ <ErrCode>InvalidCreditCardNumber</ErrCode>
37
+ <ErrData></ErrData>
38
+ </ErrorInfo>
39
+ </ErrorDetails>
40
+ <CallDuration>0.051235</CallDuration>
41
+ </MakeDonationAddCOFResult>
42
+ </MakeDonationAddCOFResponse>
43
+ </soap:Body>
44
+ </soap:Envelope>
45
+ XML
46
+ end
47
+
@@ -0,0 +1,16 @@
1
+ require 'ostruct'
2
+
3
+ def server_error_response
4
+ <<-XML
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
7
+ <soap:Body>
8
+ Unauthorized Client IP Address ERR ID: 163556345
9
+ </soap:Body>
10
+ </soap:Envelope>
11
+ XML
12
+ end
13
+
14
+ def nfg_response(code, body)
15
+ OpenStruct.new(code: code, body: body)
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfg-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Ruano Cuesta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: andand
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Client for the Network for Good SOAP API.
56
70
  email:
57
71
  - ruanest@gmail.com
@@ -70,8 +84,26 @@ files:
70
84
  - lib/nfg-client/utils.rb
71
85
  - lib/nfg-client/version.rb
72
86
  - nfg-client.gemspec
73
- - spec/nfg_client_spec.rb
87
+ - spec/remote/nfg-client_remote_spec.rb
74
88
  - spec/spec_helper.rb
89
+ - spec/support/api_parameters.rb
90
+ - spec/unit/create_cof_spec.rb
91
+ - spec/unit/delete_donor_cof_spec.rb
92
+ - spec/unit/get_donation_report_spec.rb
93
+ - spec/unit/get_donor_cofs_spec.rb
94
+ - spec/unit/get_donor_donation_history_spec.rb
95
+ - spec/unit/get_fee_spec.rb
96
+ - spec/unit/make_cof_donation_spec.rb
97
+ - spec/unit/make_donation_add_cof_spec.rb
98
+ - spec/unit/response_stubs/create_cof_stubs.rb
99
+ - spec/unit/response_stubs/delete_donor_cof_stubs.rb
100
+ - spec/unit/response_stubs/get_donation_report_stubs.rb
101
+ - spec/unit/response_stubs/get_donor_cofs_stubs.rb
102
+ - spec/unit/response_stubs/get_donor_donation_history_stubs.rb
103
+ - spec/unit/response_stubs/get_fee_stubs.rb
104
+ - spec/unit/response_stubs/make_cof_donation_stubs.rb
105
+ - spec/unit/response_stubs/make_donation_add_cof_stubs.rb
106
+ - spec/unit/response_stubs/spec_response_helpers.rb
75
107
  homepage: https://github.com/aruanoc/nfg-client
76
108
  licenses:
77
109
  - MIT
@@ -97,6 +129,24 @@ signing_key:
97
129
  specification_version: 4
98
130
  summary: Client for the Network for Good SOAP API.
99
131
  test_files:
100
- - spec/nfg_client_spec.rb
132
+ - spec/remote/nfg-client_remote_spec.rb
101
133
  - spec/spec_helper.rb
134
+ - spec/support/api_parameters.rb
135
+ - spec/unit/create_cof_spec.rb
136
+ - spec/unit/delete_donor_cof_spec.rb
137
+ - spec/unit/get_donation_report_spec.rb
138
+ - spec/unit/get_donor_cofs_spec.rb
139
+ - spec/unit/get_donor_donation_history_spec.rb
140
+ - spec/unit/get_fee_spec.rb
141
+ - spec/unit/make_cof_donation_spec.rb
142
+ - spec/unit/make_donation_add_cof_spec.rb
143
+ - spec/unit/response_stubs/create_cof_stubs.rb
144
+ - spec/unit/response_stubs/delete_donor_cof_stubs.rb
145
+ - spec/unit/response_stubs/get_donation_report_stubs.rb
146
+ - spec/unit/response_stubs/get_donor_cofs_stubs.rb
147
+ - spec/unit/response_stubs/get_donor_donation_history_stubs.rb
148
+ - spec/unit/response_stubs/get_fee_stubs.rb
149
+ - spec/unit/response_stubs/make_cof_donation_stubs.rb
150
+ - spec/unit/response_stubs/make_donation_add_cof_stubs.rb
151
+ - spec/unit/response_stubs/spec_response_helpers.rb
102
152
  has_rdoc:
File without changes