-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api update #32
Open
soenkex
wants to merge
17
commits into
shipcloud:main
Choose a base branch
from
soenkex:api_update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Api update #32
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
28fcb95
init api plans
b06dd3f
add 2 new resource-paths for customer
soenkex fe68572
testing without SSL-verification
soenkex 62799d5
add api resources coupons and discounts
soenkex 2585f83
create and update plans and plan-variants, add components-resource
soenkex a8993ba
change create_planvariants path
soenkex ef8a4b8
change create_plan path
soenkex b775e24
do not camelize exact string "_c"
soenkex 18a359f
Update README with some example
soenkex 9c716df
tweak README
soenkex 6154d97
tweak README
soenkex 88eaf74
add Components module to api.rb
soenkex f265205
add create method for coupons, discounts and components
soenkex 19eee4a
add "usage" method for components in api/contracts.rb
soenkex 1c879b5
Merge branch 'api_update' of github.com:soenkex/pactas_itero into api…
soenkex 4089f41
Search by couponCode only supported when enabled=true or active=true
soenkex 28abbcb
Merge branch 'api_update' of github.com:soenkex/pactas_itero into api…
soenkex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,79 @@ Or install it yourself as: | |
|
||
## Usage | ||
|
||
TODO: Write usage instructions here | ||
### INIT: | ||
``` | ||
PactasItero.client_id = "my_billwerk_client_id" | ||
PactasItero.client_secret = "my_billwerk_client_secret" | ||
@billwerkClient = PactasItero.client | ||
@billwerkClient.bearer_token = @billwerkClient.try(:token).try(:access_token) | ||
``` | ||
|
||
### Examples: | ||
|
||
#### 1) Create-Plan Example | ||
|
||
``` | ||
plangroup_id = "16dc8c7gba5c2202143de8b5" | ||
plan_options={} | ||
plan_options[:Name] = {"_c" => "Package XXL" } | ||
plan_options[:PlanDescription] = {"_c"=>"This is the Plan-Description for XXL"} | ||
plan_options[:PlanGroupId] = plangroup_id | ||
plan_options[:SetupDescription] = {"_c"=>"one-time setup-fee"} | ||
plan_options[:TrialEndNotificationPeriod] = {'Unit' => "Day", 'Quantity' => 3} | ||
plan_options[:TrialEndPolicy] = "RequestPayment" | ||
plan_options[:TrialPeriod] = {:Unit => "Day", :Quantity => 7} | ||
plan_options[:IsQuantityBased] = false | ||
plan_options[:Hidden] = false | ||
plan_options[:IsDeletable] = false | ||
@[email protected]_plan(plangroup_id,plan_options) | ||
``` | ||
|
||
#### 2) Create-Order Example | ||
|
||
##### Submitted via Order-Form (Example Data) | ||
|
||
``` | ||
Parameters: {"Cart"=>{"PlanVariantId"=>"19dc8c7gba5c2202143de1s9"}, | ||
"Customer"=>{"CompanyName"=>"Mustermann Ltd.", "EmailAddress"=>"[email protected]", "FirstName"=>"Klaus", "LastName"=>"Mustermann", "VatId"=>"DE63244715", | ||
"Address"=>{"Street"=>"Karl-Str.", "HouseNumber"=>"55", "PostalCode"=>"10421", "City"=>"Berlin", "Country"=>"DE"}}, | ||
"Bearer"=>{"holder"=>"Mustermann Ltd", "iban"=>"DE883299699663", "bic"=>"HAC556AXXX"}} | ||
``` | ||
|
||
##### Usage in Order-Controller | ||
|
||
``` | ||
orderOptions = {} | ||
orderOptions[:ContractCustomFields] = {} | ||
orderOptions[:AdditionalData] = {} | ||
orderOptions[:AdditionalData][:Contract] = {} | ||
orderOptions[:AdditionalData][:Contract][:CustomFields] = {} | ||
orderOptions[:Cart] = params[:Cart].to_h | ||
orderOptions[:Cart][:Quantity] = 1 | ||
orderOptions[:Cart][:EnableTrial] = true | ||
orderOptions[:Cart][:ComponentSubscriptions] = [] | ||
orderOptions[:Cart][:MeteredUsages] = [] | ||
orderOptions[:Cart][:DiscountSubscriptions] = [] | ||
orderOptions[:Cart][:RatedItems] = [] | ||
orderOptions[:Customer] = params[:Customer].to_h | ||
orderOptions[:Customer][:ExternalCustomerId] = "#{current_customer.id}" | ||
orderOptions[:Customer][:Language] = 'de-DE'; | ||
orderOptions[:Customer][:Locale] = 'de-DE'; | ||
orderOptions[:Customer][:DebitorAccount] = "#{current_customer.debit_id}" | ||
orderOptions[:Customer][:Hidden] = false | ||
orderOptions[:StartDate] = Time.now.to_formatted_s(:iso8601) | ||
@[email protected]_order(orderOptions) | ||
``` | ||
|
||
##### On Success Commit-Order via Order-Controller | ||
|
||
``` | ||
commitOptions = {} | ||
commitOptions[:PaymentMethod] = "Debit:FakeProvider" | ||
commitOptions[:Bearer] = params[:Bearer].to_h | ||
commitOptions[:Bearer][:mandatereference] = "Z-#{current_customer.debit_id}-#{current_customer.id}" | ||
@commit = @billwerkClient.commit_order(@order.id, commitOptions) | ||
``` | ||
|
||
## Contributing | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to me like some really special behaviour. Could you please elaborate why this is necessary and give some examples?