killbill-invoice-test 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.travis.yml +19 -0
- data/Gemfile +5 -0
- data/Jarfile +8 -0
- data/README.md +6 -0
- data/Rakefile +17 -0
- data/VERSION +1 -0
- data/killbill-invoice-test.gemspec +30 -0
- data/killbill.properties +3 -0
- data/lib/invoice_test.rb +2 -0
- data/lib/invoice_test/api.rb +14 -0
- data/pom.xml +38 -0
- data/release.sh +41 -0
- data/spec/invoice_test/base_plugin_spec.rb +39 -0
- data/spec/spec_helper.rb +10 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82d0509829e577cbfbd6c4401e163dff33bf1e17
|
4
|
+
data.tar.gz: b6301771772e158094e2dd8ac59a58c0e962a8ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b7ab718467e72483c7bfacc4738d8a29b534399145b6deebfe70e5c7909b20869a2e66b983a076241883de7e209dc4978e1605034d7b77cab510a396fbe18990
|
7
|
+
data.tar.gz: 082962826a8c3a170ea286bf119dda3c4d06cba43b420a0a18a1cd431e6f132f8943dab2cfa109b42427a24aded00d23dc2b0fb1980947115425cd1b320d128c
|
data/.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.idea
|
6
|
+
coverage
|
7
|
+
InstalledFiles
|
8
|
+
lib/bundler/man
|
9
|
+
pkg
|
10
|
+
rdoc
|
11
|
+
spec/reports
|
12
|
+
test/tmp
|
13
|
+
test/version_tmp
|
14
|
+
tmp
|
15
|
+
build
|
16
|
+
# YARD artifacts
|
17
|
+
.yardoc
|
18
|
+
_yardoc
|
19
|
+
doc/
|
20
|
+
|
21
|
+
.jbundler
|
22
|
+
Jarfile.lock
|
23
|
+
Gemfile.lock
|
24
|
+
*.swp
|
25
|
+
killbill-invoice-test
|
26
|
+
|
27
|
+
.DS_Store
|
28
|
+
pom.xml.asc
|
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
notifications:
|
4
|
+
email:
|
5
|
+
- kill-bill-commits@googlegroups.com
|
6
|
+
|
7
|
+
rvm:
|
8
|
+
- jruby-19mode
|
9
|
+
- jruby-20mode
|
10
|
+
- jruby-head
|
11
|
+
|
12
|
+
jdk:
|
13
|
+
- openjdk6
|
14
|
+
- openjdk7
|
15
|
+
- oraclejdk7
|
16
|
+
|
17
|
+
matrix:
|
18
|
+
allow_failures:
|
19
|
+
- rvm: jruby-head
|
data/Gemfile
ADDED
data/Jarfile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
jar 'org.kill-bill.billing:killbill-api', '0.10.3'
|
2
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.2'
|
3
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.2'
|
4
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.2'
|
5
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.8.1'
|
6
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.8.2'
|
7
|
+
jar 'org.kill-bill.billing:killbill-util:tests', '0.12.1'
|
8
|
+
jar 'javax.servlet:javax.servlet-api', '3.0.1'
|
data/README.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
killbill-invoice-test-plugin
|
2
|
+
==============================
|
3
|
+
|
4
|
+
Plugin to test the Kill Bill InvoicePlugin API.
|
5
|
+
|
6
|
+
Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.plugin.ruby%22%20AND%20a%3A%22invoice-test-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:invoice-test-plugin`.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
# Install tasks to build and release the plugin
|
4
|
+
require 'bundler/setup'
|
5
|
+
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
# Install test tasks
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
desc "Run RSpec"
|
10
|
+
RSpec::Core::RakeTask.new
|
11
|
+
|
12
|
+
# Install tasks to package the plugin for Killbill
|
13
|
+
require 'killbill/rake_task'
|
14
|
+
Killbill::PluginHelper.install_tasks
|
15
|
+
|
16
|
+
# Run tests by default
|
17
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,30 @@
|
|
1
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'killbill-invoice-test'
|
5
|
+
s.version = version
|
6
|
+
s.summary = 'Plugin to test the invoice plugin api.'
|
7
|
+
s.description = 'Kill Bill Plugin to test the invoice plugin api.'
|
8
|
+
|
9
|
+
s.required_ruby_version = '>= 1.9.3'
|
10
|
+
|
11
|
+
s.license = 'Apache License (2.0)'
|
12
|
+
|
13
|
+
s.author = 'Kill Bill core team'
|
14
|
+
s.email = 'killbilling-users@googlegroups.com'
|
15
|
+
s.homepage = 'http://killbill.io'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.bindir = 'bin'
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.rdoc_options << '--exclude' << '.'
|
24
|
+
|
25
|
+
s.add_dependency 'killbill', '~> 3.2.2'
|
26
|
+
|
27
|
+
s.add_development_dependency 'jbundler', '~> 0.4.1'
|
28
|
+
s.add_development_dependency 'rake', '>= 10.0.0'
|
29
|
+
s.add_development_dependency 'rspec', '~> 2.12.0'
|
30
|
+
end
|
data/killbill.properties
ADDED
data/lib/invoice_test.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module InvoiceTest
|
2
|
+
|
3
|
+
class InvoicePlugin < Killbill::Plugin::Invoice
|
4
|
+
|
5
|
+
def get_additional_invoice_items(invoice, properties, context)
|
6
|
+
additional_items = []
|
7
|
+
invoice.invoice_items.each do |original_item|
|
8
|
+
additional_items << build_item(original_item, original_item.amount * 7 / 100, 'Tax item', :TAX) unless original_item.amount == 0
|
9
|
+
end
|
10
|
+
|
11
|
+
additional_items
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/pom.xml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
~ Copyright 2010-2013 Ning, Inc.
|
4
|
+
~ Copyright 2014-2015 Groupon, Inc
|
5
|
+
~ Copyright 2014-2015 The Billing Project, LLC
|
6
|
+
~
|
7
|
+
~ The Billing Project licenses this file to you under the Apache License, version 2.0
|
8
|
+
~ (the "License"); you may not use this file except in compliance with the
|
9
|
+
~ License. You may obtain a copy of the License at:
|
10
|
+
~
|
11
|
+
~ http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
~
|
13
|
+
~ Unless required by applicable law or agreed to in writing, software
|
14
|
+
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
~ License for the specific language governing permissions and limitations
|
17
|
+
~ under the License.
|
18
|
+
-->
|
19
|
+
|
20
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
21
|
+
<parent>
|
22
|
+
<groupId>org.sonatype.oss</groupId>
|
23
|
+
<artifactId>oss-parent</artifactId>
|
24
|
+
<version>5</version>
|
25
|
+
</parent>
|
26
|
+
<modelVersion>4.0.0</modelVersion>
|
27
|
+
<groupId>org.kill-bill.billing.plugin.ruby</groupId>
|
28
|
+
<artifactId>invoice-test-plugin</artifactId>
|
29
|
+
<packaging>pom</packaging>
|
30
|
+
<version>0.0.1</version>
|
31
|
+
<name>invoice-test-plugin</name>
|
32
|
+
<description></description>
|
33
|
+
<scm>
|
34
|
+
<connection>scm:git:git://github.com/killbill/killbill-invoice-test-plugin.git</connection>
|
35
|
+
<url>https://github.com/killbill/killbill-invoice-test-plugin/</url>
|
36
|
+
<developerConnection>scm:git:git@github.com:killbill/killbill-invoice-test-plugin.git</developerConnection>
|
37
|
+
</scm>
|
38
|
+
</project>
|
data/release.sh
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
set -e
|
2
|
+
|
3
|
+
if [ "GNU" != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
|
4
|
+
echo "Unable to release: make sure to use GNU tar"
|
5
|
+
exit 1
|
6
|
+
fi
|
7
|
+
|
8
|
+
if $(ruby -e'require "java"'); then
|
9
|
+
# Good
|
10
|
+
echo "Detected JRuby"
|
11
|
+
else
|
12
|
+
echo "Unable to release: make sure to use JRuby"
|
13
|
+
exit 1
|
14
|
+
fi
|
15
|
+
|
16
|
+
VERSION=`grep -E '<version>([0-9]+\.[0-9]+\.[0-9]+)</version>' pom.xml | sed 's/[\t \n]*<version>\(.*\)<\/version>[\t \n]*/\1/'`
|
17
|
+
if [ "$VERSION" != "$(cat $PWD/VERSION)" ]; then
|
18
|
+
echo "Unable to release: make sure the versions in pom.xml and VERSION match"
|
19
|
+
exit 1
|
20
|
+
fi
|
21
|
+
|
22
|
+
echo "Cleaning up"
|
23
|
+
rake killbill:clean ; rake build
|
24
|
+
|
25
|
+
echo "Pushing the gem to Rubygems"
|
26
|
+
rake release
|
27
|
+
|
28
|
+
echo "Building artifact"
|
29
|
+
rake killbill:package
|
30
|
+
|
31
|
+
ARTIFACT="$PWD/pkg/killbill-invoice-test-$VERSION.tar.gz"
|
32
|
+
echo "Pushing $ARTIFACT to Maven Central"
|
33
|
+
mvn gpg:sign-and-deploy-file \
|
34
|
+
-DgroupId=org.kill-bill.billing.plugin.ruby \
|
35
|
+
-DartifactId=invoice-test-plugin \
|
36
|
+
-Dversion=$VERSION \
|
37
|
+
-Dpackaging=tar.gz \
|
38
|
+
-DrepositoryId=ossrh-releases \
|
39
|
+
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
|
40
|
+
-Dfile=$ARTIFACT \
|
41
|
+
-DpomFile=pom.xml
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
describe InvoiceTest::InvoicePlugin do
|
5
|
+
before(:each) do
|
6
|
+
|
7
|
+
kb_apis = Killbill::Plugin::KillbillApi.new('killbill-invoice-test', {})
|
8
|
+
@plugin = InvoiceTest::InvoicePlugin.new
|
9
|
+
@plugin.logger = Logger.new(STDOUT)
|
10
|
+
@plugin.kb_apis = kb_apis
|
11
|
+
|
12
|
+
@properties = []
|
13
|
+
@call_context = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should start and stop correctly' do
|
17
|
+
@plugin.start_plugin
|
18
|
+
@plugin.stop_plugin
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should add additional item' do
|
22
|
+
item = Killbill::Plugin::Model::InvoiceItem.new
|
23
|
+
item.id = SecureRandom.uuid
|
24
|
+
item.amount = 100
|
25
|
+
|
26
|
+
invoice = Killbill::Plugin::Model::Invoice.new
|
27
|
+
invoice.id = SecureRandom.uuid
|
28
|
+
invoice.invoice_items = [item]
|
29
|
+
|
30
|
+
new_items = @plugin.get_additional_invoice_items(invoice, @properties, @call_context)
|
31
|
+
new_items.size.should == 1
|
32
|
+
|
33
|
+
new_item = new_items.first
|
34
|
+
new_item.should be_an_instance_of Killbill::Plugin::Model::InvoiceItem
|
35
|
+
new_item.amount.should == 7
|
36
|
+
new_item.invoice_item_type.should == :TAX
|
37
|
+
new_item.linked_item_id.should == item.id
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: killbill-invoice-test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kill Bill core team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: killbill
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.2
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.2.2
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jbundler
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.4.1
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.4.1
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 10.0.0
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 10.0.0
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.12.0
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.12.0
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
69
|
+
description: Kill Bill Plugin to test the invoice plugin api.
|
70
|
+
email: killbilling-users@googlegroups.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- .travis.yml
|
77
|
+
- Gemfile
|
78
|
+
- Jarfile
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- VERSION
|
82
|
+
- killbill-invoice-test.gemspec
|
83
|
+
- killbill.properties
|
84
|
+
- lib/invoice_test.rb
|
85
|
+
- lib/invoice_test/api.rb
|
86
|
+
- pom.xml
|
87
|
+
- release.sh
|
88
|
+
- spec/invoice_test/base_plugin_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
homepage: http://killbill.io
|
91
|
+
licenses:
|
92
|
+
- Apache License (2.0)
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options:
|
96
|
+
- --exclude
|
97
|
+
- .
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.9.3
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.2.2
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Plugin to test the invoice plugin api.
|
116
|
+
test_files:
|
117
|
+
- spec/invoice_test/base_plugin_spec.rb
|
118
|
+
- spec/spec_helper.rb
|