killbill 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Jarfile +5 -5
- data/NEWS +4 -0
- data/README.md +45 -8
- data/VERSION +1 -1
- data/generators/active_merchant/active_merchant_generator.rb +38 -0
- data/generators/active_merchant/templates/.gitignore.rb +36 -0
- data/generators/active_merchant/templates/.travis.yml.rb +19 -0
- data/generators/active_merchant/templates/Gemfile.rb +3 -0
- data/generators/active_merchant/templates/Jarfile.rb +6 -0
- data/generators/active_merchant/templates/LICENSE.rb +201 -0
- data/generators/active_merchant/templates/NEWS.rb +2 -0
- data/generators/active_merchant/templates/Rakefile.rb +30 -0
- data/generators/active_merchant/templates/VERSION.rb +1 -0
- data/generators/active_merchant/templates/config.ru.rb +4 -0
- data/generators/active_merchant/templates/config.yml.rb +13 -0
- data/generators/active_merchant/templates/db/ddl.sql.rb +64 -0
- data/generators/active_merchant/templates/db/schema.rb +64 -0
- data/generators/active_merchant/templates/killbill.properties.rb +3 -0
- data/generators/active_merchant/templates/lib/api.rb +119 -0
- data/generators/active_merchant/templates/lib/application.rb +84 -0
- data/generators/active_merchant/templates/lib/models/payment_method.rb +22 -0
- data/generators/active_merchant/templates/lib/models/response.rb +22 -0
- data/generators/active_merchant/templates/lib/models/transaction.rb +11 -0
- data/generators/active_merchant/templates/lib/plugin.rb +23 -0
- data/generators/active_merchant/templates/lib/private_api.rb +6 -0
- data/generators/active_merchant/templates/lib/views/form.erb +8 -0
- data/generators/active_merchant/templates/plugin.gemspec.rb +48 -0
- data/generators/active_merchant/templates/pom.xml.rb +44 -0
- data/generators/active_merchant/templates/release.sh.rb +41 -0
- data/generators/active_merchant/templates/spec/base_plugin_spec.rb +30 -0
- data/generators/active_merchant/templates/spec/integration_spec.rb +31 -0
- data/generators/active_merchant/templates/spec/spec_helper.rb +24 -0
- data/generators/killbill_generator.rb +38 -0
- data/killbill.gemspec +10 -2
- data/lib/killbill/gen/api/block.rb +82 -0
- data/lib/killbill/gen/api/direct_payment.rb +176 -0
- data/lib/killbill/gen/api/direct_payment_api.rb +329 -0
- data/lib/killbill/gen/api/direct_payment_transaction.rb +156 -0
- data/lib/killbill/gen/api/fixed.rb +63 -0
- data/lib/killbill/gen/api/invoice_item.rb +7 -1
- data/lib/killbill/gen/api/invoice_item_formatter.rb +7 -1
- data/lib/killbill/gen/api/invoice_user_api.rb +18 -136
- data/lib/killbill/gen/api/migration_plan.rb +6 -6
- data/lib/killbill/gen/api/payment_api.rb +216 -54
- data/lib/killbill/gen/api/payment_method_plugin.rb +3 -3
- data/lib/killbill/gen/api/plan.rb +6 -6
- data/lib/killbill/gen/api/plan_phase.rb +16 -23
- data/lib/killbill/gen/api/plugin_property.rb +71 -0
- data/lib/killbill/gen/api/recurring.rb +63 -0
- data/lib/killbill/gen/api/require_gen.rb +10 -1
- data/lib/killbill/gen/api/static_catalog.rb +8 -1
- data/lib/killbill/gen/api/tier.rb +77 -0
- data/lib/killbill/gen/api/tiered_block.rb +88 -0
- data/lib/killbill/gen/api/usage.rb +111 -0
- data/lib/killbill/gen/api/usage_user_api.rb +59 -3
- data/lib/killbill/gen/plugin-api/billing_address.rb +85 -0
- data/lib/killbill/gen/plugin-api/customer.rb +73 -0
- data/lib/killbill/gen/plugin-api/hosted_payment_page_descriptor_fields.rb +145 -0
- data/lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb +80 -0
- data/lib/killbill/gen/plugin-api/hosted_payment_page_notification.rb +129 -0
- data/lib/killbill/gen/plugin-api/payment_info_plugin.rb +20 -1
- data/lib/killbill/gen/plugin-api/payment_plugin_api.rb +358 -39
- data/lib/killbill/gen/plugin-api/refund_info_plugin.rb +20 -1
- data/lib/killbill/gen/plugin-api/require_gen.rb +3 -0
- data/lib/killbill/helpers/active_merchant.rb +21 -0
- data/lib/killbill/helpers/active_merchant/active_record.rb +17 -0
- data/lib/killbill/helpers/active_merchant/active_record/models/helpers.rb +25 -0
- data/lib/killbill/helpers/active_merchant/active_record/models/payment_method.rb +195 -0
- data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +178 -0
- data/lib/killbill/helpers/active_merchant/active_record/models/streamy_result_set.rb +35 -0
- data/lib/killbill/helpers/active_merchant/active_record/models/transaction.rb +63 -0
- data/lib/killbill/helpers/active_merchant/configuration.rb +54 -0
- data/lib/killbill/helpers/active_merchant/core_ext.rb +41 -0
- data/lib/killbill/helpers/active_merchant/gateway.rb +35 -0
- data/lib/killbill/helpers/active_merchant/killbill_spec_helper.rb +117 -0
- data/lib/killbill/helpers/active_merchant/payment_plugin.rb +365 -0
- data/lib/killbill/helpers/active_merchant/private_payment_plugin.rb +119 -0
- data/lib/killbill/helpers/active_merchant/properties.rb +20 -0
- data/lib/killbill/helpers/active_merchant/sinatra.rb +30 -0
- data/lib/killbill/helpers/active_merchant/utils.rb +23 -0
- data/lib/killbill/payment.rb +22 -10
- data/script/generate +15 -0
- data/spec/killbill/helpers/payment_method_spec.rb +101 -0
- data/spec/killbill/helpers/response_spec.rb +74 -0
- data/spec/killbill/helpers/test_schema.rb +57 -0
- data/spec/killbill/helpers/utils_spec.rb +22 -0
- data/spec/killbill/payment_plugin_api_spec.rb +23 -18
- data/spec/killbill/payment_plugin_spec.rb +11 -10
- data/spec/killbill/payment_test.rb +9 -9
- data/spec/spec_helper.rb +8 -3
- metadata +130 -5
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'action_controller'
|
2
|
+
require 'active_record'
|
3
|
+
require 'action_view'
|
4
|
+
require 'active_merchant'
|
5
|
+
require 'active_support'
|
6
|
+
require 'bigdecimal'
|
7
|
+
require 'money'
|
8
|
+
require 'monetize'
|
9
|
+
require 'pathname'
|
10
|
+
require 'sinatra'
|
11
|
+
require 'singleton'
|
12
|
+
require 'yaml'
|
13
|
+
|
14
|
+
require 'killbill'
|
15
|
+
require 'killbill/helpers/active_merchant'
|
16
|
+
|
17
|
+
require '<%= identifier %>/api'
|
18
|
+
require '<%= identifier %>/private_api'
|
19
|
+
|
20
|
+
require '<%= identifier %>/models/payment_method'
|
21
|
+
require '<%= identifier %>/models/response'
|
22
|
+
require '<%= identifier %>/models/transaction'
|
23
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'killbill-<%= identifier %>'
|
5
|
+
s.version = version
|
6
|
+
s.summary = 'Plugin to use <%= class_name %> as a gateway.'
|
7
|
+
s.description = 'Kill Bill payment plugin for <%= class_name %>.'
|
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://kill-bill.org'
|
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.0.0'
|
26
|
+
s.add_dependency 'activemerchant', '~> 1.42.9'
|
27
|
+
s.add_dependency 'activerecord', '~> 4.1.0'
|
28
|
+
s.add_dependency 'actionpack', '~> 4.1.0'
|
29
|
+
s.add_dependency 'actionview', '~> 4.1.0'
|
30
|
+
s.add_dependency 'activesupport', '~> 4.1.0'
|
31
|
+
s.add_dependency 'money', '~> 6.1.1'
|
32
|
+
s.add_dependency 'monetize', '~> 0.3.0'
|
33
|
+
s.add_dependency 'sinatra', '~> 1.3.4'
|
34
|
+
if defined?(JRUBY_VERSION)
|
35
|
+
s.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.3.7'
|
36
|
+
# Required to avoid errors like java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DERBoolean
|
37
|
+
s.add_dependency 'jruby-openssl', '~> 0.9.4'
|
38
|
+
end
|
39
|
+
|
40
|
+
s.add_development_dependency 'jbundler', '~> 0.4.1'
|
41
|
+
s.add_development_dependency 'rake', '>= 10.0.0'
|
42
|
+
s.add_development_dependency 'rspec', '~> 2.12.0'
|
43
|
+
if defined?(JRUBY_VERSION)
|
44
|
+
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.3.7'
|
45
|
+
else
|
46
|
+
s.add_development_dependency 'sqlite3', '~> 1.3.7'
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
~ Copyright 2014 The Billing Project, LLC
|
4
|
+
~
|
5
|
+
~ Ning licenses this file to you under the Apache License, version 2.0
|
6
|
+
~ (the "License"); you may not use this file except in compliance with the
|
7
|
+
~ License. You may obtain a copy of the License at:
|
8
|
+
~
|
9
|
+
~ http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
~
|
11
|
+
~ Unless required by applicable law or agreed to in writing, software
|
12
|
+
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
~ License for the specific language governing permissions and limitations
|
15
|
+
~ under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<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">
|
19
|
+
<parent>
|
20
|
+
<groupId>org.sonatype.oss</groupId>
|
21
|
+
<artifactId>oss-parent</artifactId>
|
22
|
+
<version>5</version>
|
23
|
+
</parent>
|
24
|
+
<modelVersion>4.0.0</modelVersion>
|
25
|
+
<groupId>org.kill-bill.billing.plugin.ruby</groupId>
|
26
|
+
<artifactId><%= identifier %>-plugin</artifactId>
|
27
|
+
<packaging>pom</packaging>
|
28
|
+
<version>0.0.1</version>
|
29
|
+
<name><%= identifier %>-plugin</name>
|
30
|
+
<url>http://github.com/killbill/killbill-<%= identifier %>-plugin</url>
|
31
|
+
<description>Plugin for accessing <%= class_name %> as a payment gateway</description>
|
32
|
+
<licenses>
|
33
|
+
<license>
|
34
|
+
<name>Apache License 2.0</name>
|
35
|
+
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
|
36
|
+
<distribution>repo</distribution>
|
37
|
+
</license>
|
38
|
+
</licenses>
|
39
|
+
<scm>
|
40
|
+
<connection>scm:git:git://github.com/killbill/killbill-<%= identifier %>-plugin.git</connection>
|
41
|
+
<url>https://github.com/killbill/killbill-<%= identifier %>-plugin/</url>
|
42
|
+
<developerConnection>scm:git:git@github.com:killbill/killbill-<%= identifier %>-plugin.git</developerConnection>
|
43
|
+
</scm>
|
44
|
+
</project>
|
@@ -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-<%= identifier %>-$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=<%= identifier %>-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,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Killbill::<%= class_name %>::PaymentPlugin do
|
4
|
+
before(:each) do
|
5
|
+
Dir.mktmpdir do |dir|
|
6
|
+
file = File.new(File.join(dir, '<%= identifier %>.yml'), "w+")
|
7
|
+
file.write(<<-eos)
|
8
|
+
:<%= identifier %>:
|
9
|
+
:test: true
|
10
|
+
# As defined by spec_helper.rb
|
11
|
+
:database:
|
12
|
+
:adapter: 'sqlite3'
|
13
|
+
:database: 'test.db'
|
14
|
+
eos
|
15
|
+
file.close
|
16
|
+
|
17
|
+
@plugin = Killbill::<%= class_name %>::PaymentPlugin.new
|
18
|
+
@plugin.logger = Logger.new(STDOUT)
|
19
|
+
@plugin.logger.level = Logger::INFO
|
20
|
+
@plugin.conf_dir = File.dirname(file)
|
21
|
+
|
22
|
+
# Start the plugin here - since the config file will be deleted
|
23
|
+
@plugin.start_plugin
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should start and stop correctly' do
|
28
|
+
@plugin.stop_plugin
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
ActiveMerchant::Billing::Base.mode = :test
|
4
|
+
|
5
|
+
describe Killbill::<%= class_name %>::PaymentPlugin do
|
6
|
+
|
7
|
+
include ::Killbill::Plugin::ActiveMerchant::RSpec
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@plugin = Killbill::<%= class_name %>::PaymentPlugin.new
|
11
|
+
|
12
|
+
@account_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaUserAccountApi.new
|
13
|
+
svcs = {:account_user_api => @account_api}
|
14
|
+
@plugin.kb_apis = Killbill::Plugin::KillbillApi.new('<%= identifier %>', svcs)
|
15
|
+
|
16
|
+
@plugin.logger = Logger.new(STDOUT)
|
17
|
+
@plugin.logger.level = Logger::INFO
|
18
|
+
@plugin.conf_dir = File.expand_path(File.dirname(__FILE__) + '../../../../')
|
19
|
+
@plugin.start_plugin
|
20
|
+
end
|
21
|
+
|
22
|
+
after(:each) do
|
23
|
+
@plugin.stop_plugin
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should be able to create and retrieve payment methods' do
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should be able to charge and refund' do
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require '<%= identifier %>'
|
3
|
+
require 'killbill/helpers/active_merchant/killbill_spec_helper'
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
require 'rspec'
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.color_enabled = true
|
11
|
+
config.tty = true
|
12
|
+
config.formatter = 'documentation'
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'active_record'
|
16
|
+
ActiveRecord::Base.establish_connection(
|
17
|
+
:adapter => 'sqlite3',
|
18
|
+
:database => 'test.db'
|
19
|
+
)
|
20
|
+
# For debugging
|
21
|
+
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
22
|
+
# Create the schema
|
23
|
+
require File.expand_path(File.dirname(__FILE__) + '../../db/schema.rb')
|
24
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "thor/group"
|
2
|
+
|
3
|
+
class KillbillGenerator < Thor::Group
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
argument :name
|
7
|
+
argument :dir
|
8
|
+
class_option :destroy, :type => :boolean, :desc => 'Destroys rather than generates the template'
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
rescue Thor::InvocationError
|
13
|
+
at_exit { print self.class.help(shell) }
|
14
|
+
raise
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def template(source, dest)
|
20
|
+
if options[:destroy]
|
21
|
+
remove_file dest
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def output_path
|
28
|
+
@output_path ||= File.expand_path(dir)
|
29
|
+
end
|
30
|
+
|
31
|
+
def identifier
|
32
|
+
@identifier ||= class_name.gsub(%r{([A-Z])}) { |m| "_#{$1.downcase}" }.sub(%r{^_}, '')
|
33
|
+
end
|
34
|
+
|
35
|
+
def class_name
|
36
|
+
@class_name ||= name.gsub(%r{(^[a-z])|_([a-zA-Z])}) { |m| ($1||$2).upcase }
|
37
|
+
end
|
38
|
+
end
|
data/killbill.gemspec
CHANGED
@@ -23,12 +23,20 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.rdoc_options << '--exclude' << '.'
|
24
24
|
|
25
25
|
s.add_dependency 'sinatra', '~> 1.3.4'
|
26
|
-
s.add_dependency 'tzinfo', '~>
|
27
|
-
|
26
|
+
s.add_dependency 'tzinfo', '~> 1.1.0'
|
27
|
+
|
28
|
+
s.add_development_dependency 'activerecord', '~> 4.1.0'
|
29
|
+
if defined?(JRUBY_VERSION)
|
30
|
+
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.3.7'
|
31
|
+
else
|
32
|
+
s.add_development_dependency 'sqlite3', '~> 1.3.7'
|
33
|
+
end
|
34
|
+
s.add_development_dependency 'activemerchant', '~> 1.36.0'
|
28
35
|
s.add_development_dependency 'jbundler', '~> 0.4.3'
|
29
36
|
s.add_development_dependency 'rack', '>= 1.5.2'
|
30
37
|
s.add_development_dependency 'rake', '>= 0.8.7'
|
31
38
|
s.add_development_dependency 'rspec', '~> 2.12.0'
|
39
|
+
s.add_development_dependency 'thor', '~> 0.19.1'
|
32
40
|
|
33
41
|
s.requirements << "jar 'org.kill-bill.billing:killbill-api'"
|
34
42
|
# For testing only
|
@@ -0,0 +1,82 @@
|
|
1
|
+
###################################################################################
|
2
|
+
# #
|
3
|
+
# Copyright 2010-2013 Ning, Inc. #
|
4
|
+
# #
|
5
|
+
# Ning licenses this file to you under the Apache License, version 2.0 #
|
6
|
+
# (the "License"); you may not use this file except in compliance with the #
|
7
|
+
# License. You may obtain a copy of the License at: #
|
8
|
+
# #
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
10
|
+
# #
|
11
|
+
# Unless required by applicable law or agreed to in writing, software #
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
14
|
+
# License for the specific language governing permissions and limitations #
|
15
|
+
# under the License. #
|
16
|
+
# #
|
17
|
+
###################################################################################
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# DO NOT EDIT!!!
|
22
|
+
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
23
|
+
#
|
24
|
+
|
25
|
+
|
26
|
+
module Killbill
|
27
|
+
module Plugin
|
28
|
+
module Model
|
29
|
+
|
30
|
+
java_package 'org.killbill.billing.catalog.api'
|
31
|
+
class Block
|
32
|
+
|
33
|
+
include org.killbill.billing.catalog.api.Block
|
34
|
+
|
35
|
+
attr_accessor :type, :unit, :size, :price, :min_top_up_credit
|
36
|
+
|
37
|
+
def initialize()
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_java()
|
41
|
+
# conversion for type [type = org.killbill.billing.catalog.api.BlockType]
|
42
|
+
@type = Java::org.killbill.billing.catalog.api.BlockType.value_of("#{@type.to_s}") unless @type.nil?
|
43
|
+
|
44
|
+
# conversion for unit [type = org.killbill.billing.catalog.api.Unit]
|
45
|
+
@unit = @unit.to_java unless @unit.nil?
|
46
|
+
|
47
|
+
# conversion for size [type = java.lang.Double]
|
48
|
+
@size = @size
|
49
|
+
|
50
|
+
# conversion for price [type = org.killbill.billing.catalog.api.InternationalPrice]
|
51
|
+
@price = @price.to_java unless @price.nil?
|
52
|
+
|
53
|
+
# conversion for min_top_up_credit [type = java.lang.Double]
|
54
|
+
@min_top_up_credit = @min_top_up_credit
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def to_ruby(j_obj)
|
59
|
+
# conversion for type [type = org.killbill.billing.catalog.api.BlockType]
|
60
|
+
@type = j_obj.type
|
61
|
+
@type = @type.to_s.to_sym unless @type.nil?
|
62
|
+
|
63
|
+
# conversion for unit [type = org.killbill.billing.catalog.api.Unit]
|
64
|
+
@unit = j_obj.unit
|
65
|
+
@unit = Killbill::Plugin::Model::Unit.new.to_ruby(@unit) unless @unit.nil?
|
66
|
+
|
67
|
+
# conversion for size [type = java.lang.Double]
|
68
|
+
@size = j_obj.size
|
69
|
+
|
70
|
+
# conversion for price [type = org.killbill.billing.catalog.api.InternationalPrice]
|
71
|
+
@price = j_obj.price
|
72
|
+
@price = Killbill::Plugin::Model::InternationalPrice.new.to_ruby(@price) unless @price.nil?
|
73
|
+
|
74
|
+
# conversion for min_top_up_credit [type = java.lang.Double]
|
75
|
+
@min_top_up_credit = j_obj.min_top_up_credit
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
###################################################################################
|
2
|
+
# #
|
3
|
+
# Copyright 2010-2013 Ning, Inc. #
|
4
|
+
# #
|
5
|
+
# Ning licenses this file to you under the Apache License, version 2.0 #
|
6
|
+
# (the "License"); you may not use this file except in compliance with the #
|
7
|
+
# License. You may obtain a copy of the License at: #
|
8
|
+
# #
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
10
|
+
# #
|
11
|
+
# Unless required by applicable law or agreed to in writing, software #
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
14
|
+
# License for the specific language governing permissions and limitations #
|
15
|
+
# under the License. #
|
16
|
+
# #
|
17
|
+
###################################################################################
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# DO NOT EDIT!!!
|
22
|
+
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
23
|
+
#
|
24
|
+
|
25
|
+
|
26
|
+
module Killbill
|
27
|
+
module Plugin
|
28
|
+
module Model
|
29
|
+
|
30
|
+
java_package 'org.killbill.billing.payment.api'
|
31
|
+
class DirectPayment
|
32
|
+
|
33
|
+
include org.killbill.billing.payment.api.DirectPayment
|
34
|
+
|
35
|
+
attr_accessor :id, :created_date, :updated_date, :account_id, :payment_method_id, :payment_number, :external_key, :auth_amount, :captured_amount, :refunded_amount, :currency, :payment_status, :transactions
|
36
|
+
|
37
|
+
def initialize()
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_java()
|
41
|
+
# conversion for id [type = java.util.UUID]
|
42
|
+
@id = java.util.UUID.fromString(@id.to_s) unless @id.nil?
|
43
|
+
|
44
|
+
# conversion for created_date [type = org.joda.time.DateTime]
|
45
|
+
if !@created_date.nil?
|
46
|
+
@created_date = (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
|
47
|
+
@created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
48
|
+
end
|
49
|
+
|
50
|
+
# conversion for updated_date [type = org.joda.time.DateTime]
|
51
|
+
if !@updated_date.nil?
|
52
|
+
@updated_date = (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
|
53
|
+
@updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
54
|
+
end
|
55
|
+
|
56
|
+
# conversion for account_id [type = java.util.UUID]
|
57
|
+
@account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
|
58
|
+
|
59
|
+
# conversion for payment_method_id [type = java.util.UUID]
|
60
|
+
@payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
|
61
|
+
|
62
|
+
# conversion for payment_number [type = java.lang.Integer]
|
63
|
+
@payment_number = @payment_number
|
64
|
+
|
65
|
+
# conversion for external_key [type = java.lang.String]
|
66
|
+
@external_key = @external_key.to_s unless @external_key.nil?
|
67
|
+
|
68
|
+
# conversion for auth_amount [type = java.math.BigDecimal]
|
69
|
+
if @auth_amount.nil?
|
70
|
+
@auth_amount = java.math.BigDecimal::ZERO
|
71
|
+
else
|
72
|
+
@auth_amount = java.math.BigDecimal.new(@auth_amount.to_s)
|
73
|
+
end
|
74
|
+
|
75
|
+
# conversion for captured_amount [type = java.math.BigDecimal]
|
76
|
+
if @captured_amount.nil?
|
77
|
+
@captured_amount = java.math.BigDecimal::ZERO
|
78
|
+
else
|
79
|
+
@captured_amount = java.math.BigDecimal.new(@captured_amount.to_s)
|
80
|
+
end
|
81
|
+
|
82
|
+
# conversion for refunded_amount [type = java.math.BigDecimal]
|
83
|
+
if @refunded_amount.nil?
|
84
|
+
@refunded_amount = java.math.BigDecimal::ZERO
|
85
|
+
else
|
86
|
+
@refunded_amount = java.math.BigDecimal.new(@refunded_amount.to_s)
|
87
|
+
end
|
88
|
+
|
89
|
+
# conversion for currency [type = org.killbill.billing.catalog.api.Currency]
|
90
|
+
@currency = Java::org.killbill.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
|
91
|
+
|
92
|
+
# conversion for payment_status [type = org.killbill.billing.payment.api.PaymentStatus]
|
93
|
+
@payment_status = Java::org.killbill.billing.payment.api.PaymentStatus.value_of("#{@payment_status.to_s}") unless @payment_status.nil?
|
94
|
+
|
95
|
+
# conversion for transactions [type = java.util.List]
|
96
|
+
tmp = java.util.ArrayList.new
|
97
|
+
(@transactions || []).each do |m|
|
98
|
+
# conversion for m [type = org.killbill.billing.payment.api.DirectPaymentTransaction]
|
99
|
+
m = m.to_java unless m.nil?
|
100
|
+
tmp.add(m)
|
101
|
+
end
|
102
|
+
@transactions = tmp
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
def to_ruby(j_obj)
|
107
|
+
# conversion for id [type = java.util.UUID]
|
108
|
+
@id = j_obj.id
|
109
|
+
@id = @id.nil? ? nil : @id.to_s
|
110
|
+
|
111
|
+
# conversion for created_date [type = org.joda.time.DateTime]
|
112
|
+
@created_date = j_obj.created_date
|
113
|
+
if !@created_date.nil?
|
114
|
+
fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
|
115
|
+
str = fmt.print(@created_date)
|
116
|
+
@created_date = DateTime.iso8601(str)
|
117
|
+
end
|
118
|
+
|
119
|
+
# conversion for updated_date [type = org.joda.time.DateTime]
|
120
|
+
@updated_date = j_obj.updated_date
|
121
|
+
if !@updated_date.nil?
|
122
|
+
fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
|
123
|
+
str = fmt.print(@updated_date)
|
124
|
+
@updated_date = DateTime.iso8601(str)
|
125
|
+
end
|
126
|
+
|
127
|
+
# conversion for account_id [type = java.util.UUID]
|
128
|
+
@account_id = j_obj.account_id
|
129
|
+
@account_id = @account_id.nil? ? nil : @account_id.to_s
|
130
|
+
|
131
|
+
# conversion for payment_method_id [type = java.util.UUID]
|
132
|
+
@payment_method_id = j_obj.payment_method_id
|
133
|
+
@payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
|
134
|
+
|
135
|
+
# conversion for payment_number [type = java.lang.Integer]
|
136
|
+
@payment_number = j_obj.payment_number
|
137
|
+
|
138
|
+
# conversion for external_key [type = java.lang.String]
|
139
|
+
@external_key = j_obj.external_key
|
140
|
+
|
141
|
+
# conversion for auth_amount [type = java.math.BigDecimal]
|
142
|
+
@auth_amount = j_obj.auth_amount
|
143
|
+
@auth_amount = @auth_amount.nil? ? 0 : BigDecimal.new(@auth_amount.to_s)
|
144
|
+
|
145
|
+
# conversion for captured_amount [type = java.math.BigDecimal]
|
146
|
+
@captured_amount = j_obj.captured_amount
|
147
|
+
@captured_amount = @captured_amount.nil? ? 0 : BigDecimal.new(@captured_amount.to_s)
|
148
|
+
|
149
|
+
# conversion for refunded_amount [type = java.math.BigDecimal]
|
150
|
+
@refunded_amount = j_obj.refunded_amount
|
151
|
+
@refunded_amount = @refunded_amount.nil? ? 0 : BigDecimal.new(@refunded_amount.to_s)
|
152
|
+
|
153
|
+
# conversion for currency [type = org.killbill.billing.catalog.api.Currency]
|
154
|
+
@currency = j_obj.currency
|
155
|
+
@currency = @currency.to_s.to_sym unless @currency.nil?
|
156
|
+
|
157
|
+
# conversion for payment_status [type = org.killbill.billing.payment.api.PaymentStatus]
|
158
|
+
@payment_status = j_obj.payment_status
|
159
|
+
@payment_status = @payment_status.to_s.to_sym unless @payment_status.nil?
|
160
|
+
|
161
|
+
# conversion for transactions [type = java.util.List]
|
162
|
+
@transactions = j_obj.transactions
|
163
|
+
tmp = []
|
164
|
+
(@transactions || []).each do |m|
|
165
|
+
# conversion for m [type = org.killbill.billing.payment.api.DirectPaymentTransaction]
|
166
|
+
m = Killbill::Plugin::Model::DirectPaymentTransaction.new.to_ruby(m) unless m.nil?
|
167
|
+
tmp << m
|
168
|
+
end
|
169
|
+
@transactions = tmp
|
170
|
+
self
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|