-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marc Altmann
committed
Mar 12, 2016
1 parent
843d666
commit 64d721d
Showing
19 changed files
with
158 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) 2012-2016, Fairmondo eG. This file is | ||
# licensed under the GNU Affero General Public License version 3 or later. | ||
# See the COPYRIGHT file for details. | ||
|
||
require 'sinatra/base' | ||
require 'rack/contrib' | ||
|
||
class FakeFastbill < Sinatra::Base | ||
use ::Rack::PostBodyContentTypeParser | ||
|
||
use Rack::Auth::Basic do |username, password| | ||
username == 'my_email' && password == 'my_fastbill_api_key' | ||
end | ||
|
||
post '/api/1.0/api.php' do | ||
case params['service'] | ||
when 'customer.create' | ||
json_response 'customer_create_response.json' | ||
when 'subscription.create' | ||
json_response 'subscription_create_response.json' | ||
when 'subscription.setusagedata' | ||
json_response 'subscription_set_usage_data_response.json' | ||
else | ||
json_response 'standard_response.json' | ||
end | ||
end | ||
|
||
private | ||
|
||
def json_response(file_name) | ||
content_type :json | ||
status 200 | ||
File.open(File.dirname(__FILE__) + '/fixtures/' + file_name, 'rb').read | ||
end | ||
end |
34 changes: 34 additions & 0 deletions
34
test/support/fake_services/fixtures/customer_create_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"REQUEST":{ | ||
"SERVICE":"customer.create", | ||
"DATA":{ | ||
"CUSTOMER_TYPE":"business", | ||
"ORGANIZATION":"hettie4", | ||
"SALUTATION":null, | ||
"FIRST_NAME":"Erika", | ||
"LAST_NAME":"Mustermann", | ||
"ADDRESS":"Eldenaer Strau00dfe 17", | ||
"ADDRESS_2":null, | ||
"ZIPCODE":"10247", | ||
"CITY":"Berlin", | ||
"COUNTRY_CODE":"DE", | ||
"LANGUAGE_CODE":"DE", | ||
"EMAIL":"petra.leuschke@konopelskimarks.com", | ||
"CURRENCY_CODE":"EUR", | ||
"PAYMENT_TYPE":"1", | ||
"SHOW_PAYMENT_NOTICE":"1", | ||
"BANK_NAME":"Jacky Fay I", | ||
"BANK_CODE":"31330910", | ||
"BANK_ACCOUNT_NUMBER":"95517526", | ||
"BANK_ACCOUNT_OWNER":"Eliane Roob", | ||
"CUSTOMER_NUMBER":1 | ||
} | ||
}, | ||
"RESPONSE":{ | ||
"STATUS":"success", | ||
"CUSTOMER_ID":1185408, | ||
"HASH":"aeaeebb07f47a1942e44d197cae78710", | ||
"CHANGEDATA_URL":"https://automatic.fastbill.com/accountdata/527d3ca69ba41db0905687319f8eb6ef/aeaeebb07f47a1942e44d197cae78710", | ||
"DASHBOARD_URL":"https://automatic.fastbill.com/dashboard/527d3ca69ba41db0905687319f8eb6ef/aeaeebb07f47a1942e44d197cae78710" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/support/fake_services/fixtures/standard_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"REQUEST":{ | ||
"SERVICE":"customer.create", | ||
"DATA":{ | ||
"CUSTOMER_TYPE":"business" | ||
} | ||
}, | ||
"RESPONSE":{ | ||
"ERRORS":["Login Error: Wrong API KEY or user credentials."] | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/support/fake_services/fixtures/subscription_create_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"REQUEST":{ | ||
"SERVICE":"subscription.create", | ||
"DATA":{ | ||
"ARTICLE_NUMBER":10, | ||
"CUSTOMER_ID":1185408 | ||
} | ||
}, | ||
"RESPONSE":{ | ||
"STATUS":"success", | ||
"SUBSCRIPTION_ID":639548, | ||
"HASH":"c3e0d432d43e542765091e63858db6d9", | ||
"INVOICE_ID":1033382, | ||
"PAYPAL_URL":"https://automatic.fastbill.com/paypal/MtmL1mch4xaiTqDPDXmoMVeKSMzF2zUDh6OWgq4ZcT7w9-_AWmpi8HtOUgUKUpO1" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
test/support/fake_services/fixtures/subscription_set_usage_data_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"REQUEST":{ | ||
"SERVICE":"subscription.setusagedata", | ||
"DATA":{ | ||
"SUBSCRIPTION_ID":639548, | ||
"ARTICLE_NUMBER":11, | ||
"QUANTITY":1, | ||
"UNIT_PRICE":0.34, | ||
"DESCRIPTION":"1 Book 23 (Faires Prozent)", | ||
"USAGE_DATE":"2016-03-06 18:41:36" | ||
} | ||
}, | ||
"RESPONSE":{ | ||
"STATUS":"success", | ||
"USAGEDATA_ID":2164690 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.