killbill-litle 1.10.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -5
- data/.travis.yml +22 -3
- data/Gemfile +1 -1
- data/Gemfile.head +5 -0
- data/Gemfile.lock +129 -0
- data/Jarfile +9 -6
- data/Jarfile.lock +58 -0
- data/LICENSE +201 -0
- data/NEWS +3 -0
- data/README.md +58 -98
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/config.ru +1 -1
- data/db/ddl.sql +32 -21
- data/db/schema.rb +44 -32
- data/killbill-litle.gemspec +20 -16
- data/lib/litle.rb +82 -12
- data/lib/litle/api.rb +144 -204
- data/lib/litle/application.rb +96 -0
- data/lib/litle/models/payment_method.rb +21 -0
- data/lib/litle/models/response.rb +44 -0
- data/lib/litle/models/transaction.rb +11 -0
- data/lib/litle/private_api.rb +42 -13
- data/lib/litle/views/paypage.erb +8 -5
- data/litle.yml +33 -11
- data/pom.xml +3 -2
- data/release.sh +41 -21
- data/spec/litle/base_plugin_spec.rb +35 -62
- data/spec/litle/remote/certification_spec.rb +713 -0
- data/spec/litle/remote/integration_spec.rb +97 -168
- data/spec/spec_helper.rb +3 -16
- metadata +102 -55
- data/lib/litle/config/application.rb +0 -66
- data/lib/litle/config/configuration.rb +0 -51
- data/lib/litle/config/properties.rb +0 -23
- data/lib/litle/litle/gateway.rb +0 -32
- data/lib/litle/models/litle_payment_method.rb +0 -167
- data/lib/litle/models/litle_response.rb +0 -199
- data/lib/litle/models/litle_transaction.rb +0 -44
- data/spec/litle/currency_conversion_spec.rb +0 -21
- data/spec/litle/litle_payment_method_spec.rb +0 -95
- data/spec/litle/litle_response_spec.rb +0 -91
- data/spec/litle/utils_spec.rb +0 -22
@@ -1,44 +0,0 @@
|
|
1
|
-
module Killbill::Litle
|
2
|
-
class LitleTransaction < ActiveRecord::Base
|
3
|
-
belongs_to :litle_response
|
4
|
-
attr_accessible :amount_in_cents, :currency, :api_call, :kb_payment_id, :litle_txn_id
|
5
|
-
|
6
|
-
def self.from_kb_payment_id(kb_payment_id)
|
7
|
-
transaction_from_kb_payment_id :charge, kb_payment_id, :single
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.refunds_from_kb_payment_id(kb_payment_id)
|
11
|
-
transaction_from_kb_payment_id :refund, kb_payment_id, :multiple
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.find_candidate_transaction_for_refund(kb_payment_id, amount_in_cents)
|
15
|
-
# Find one successful charge which amount is at least the amount we are trying to refund
|
16
|
-
litle_transactions = LitleTransaction.where("litle_transactions.amount_in_cents >= ?", amount_in_cents)
|
17
|
-
.find_all_by_api_call_and_kb_payment_id(:charge, kb_payment_id)
|
18
|
-
raise "Unable to find Litle transaction id for payment #{kb_payment_id}" if litle_transactions.size == 0
|
19
|
-
|
20
|
-
# We have candidates, but we now need to make sure we didn't refund more than for the specified amount
|
21
|
-
amount_refunded_in_cents = Killbill::Litle::LitleTransaction.where("api_call = ? and kb_payment_id = ?", :refund, kb_payment_id)
|
22
|
-
.sum("amount_in_cents")
|
23
|
-
|
24
|
-
amount_left_to_refund_in_cents = -amount_refunded_in_cents
|
25
|
-
litle_transactions.map { |transaction| amount_left_to_refund_in_cents += transaction.amount_in_cents }
|
26
|
-
raise "Amount #{amount_in_cents} too large to refund for payment #{kb_payment_id}" if amount_left_to_refund_in_cents < amount_in_cents
|
27
|
-
|
28
|
-
litle_transactions.first
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def self.transaction_from_kb_payment_id(api_call, kb_payment_id, how_many)
|
34
|
-
litle_transactions = find_all_by_api_call_and_kb_payment_id(api_call, kb_payment_id)
|
35
|
-
raise "Unable to find Litle transaction id for payment #{kb_payment_id}" if litle_transactions.empty?
|
36
|
-
if how_many == :single
|
37
|
-
raise "Killbill payment mapping to multiple Litle transactions for payment #{kb_payment_id}" if litle_transactions.size > 1
|
38
|
-
litle_transactions[0]
|
39
|
-
else
|
40
|
-
litle_transactions
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Killbill::Litle do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
Killbill::Litle.initialize!
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should not make currency conversion' do
|
10
|
-
Killbill::Litle.converted_currency(:USD).should be_false
|
11
|
-
Killbill::Litle.converted_currency('usd').should be_false
|
12
|
-
Killbill::Litle.converted_currency('USD').should be_false
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should make currency conversion' do
|
16
|
-
Killbill::Litle.converted_currency(:BRL).should == 'USD'
|
17
|
-
Killbill::Litle.converted_currency('brl').should == 'USD'
|
18
|
-
Killbill::Litle.converted_currency('BRL').should == 'USD'
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Killbill::Litle::LitlePaymentMethod do
|
4
|
-
before :all do
|
5
|
-
Killbill::Litle::LitlePaymentMethod.delete_all
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should generate the right SQL query' do
|
9
|
-
# Check count query (search query numeric)
|
10
|
-
expected_query = "SELECT COUNT(DISTINCT \"litle_payment_methods\".\"id\") FROM \"litle_payment_methods\" WHERE ((((((((((((\"litle_payment_methods\".\"litle_token\" = '1234' OR \"litle_payment_methods\".\"cc_type\" = '1234') OR \"litle_payment_methods\".\"state\" = '1234') OR \"litle_payment_methods\".\"zip\" = '1234') OR \"litle_payment_methods\".\"cc_first_name\" LIKE '%1234%') OR \"litle_payment_methods\".\"cc_last_name\" LIKE '%1234%') OR \"litle_payment_methods\".\"address1\" LIKE '%1234%') OR \"litle_payment_methods\".\"address2\" LIKE '%1234%') OR \"litle_payment_methods\".\"city\" LIKE '%1234%') OR \"litle_payment_methods\".\"country\" LIKE '%1234%') OR \"litle_payment_methods\".\"cc_exp_month\" = 1234) OR \"litle_payment_methods\".\"cc_exp_year\" = 1234) OR \"litle_payment_methods\".\"cc_last_4\" = 1234) ORDER BY \"litle_payment_methods\".\"id\""
|
11
|
-
# Note that Kill Bill will pass a String, even for numeric types
|
12
|
-
Killbill::Litle::LitlePaymentMethod.search_query('1234').to_sql.should == expected_query
|
13
|
-
|
14
|
-
# Check query with results (search query numeric)
|
15
|
-
expected_query = "SELECT DISTINCT \"litle_payment_methods\".* FROM \"litle_payment_methods\" WHERE ((((((((((((\"litle_payment_methods\".\"litle_token\" = '1234' OR \"litle_payment_methods\".\"cc_type\" = '1234') OR \"litle_payment_methods\".\"state\" = '1234') OR \"litle_payment_methods\".\"zip\" = '1234') OR \"litle_payment_methods\".\"cc_first_name\" LIKE '%1234%') OR \"litle_payment_methods\".\"cc_last_name\" LIKE '%1234%') OR \"litle_payment_methods\".\"address1\" LIKE '%1234%') OR \"litle_payment_methods\".\"address2\" LIKE '%1234%') OR \"litle_payment_methods\".\"city\" LIKE '%1234%') OR \"litle_payment_methods\".\"country\" LIKE '%1234%') OR \"litle_payment_methods\".\"cc_exp_month\" = 1234) OR \"litle_payment_methods\".\"cc_exp_year\" = 1234) OR \"litle_payment_methods\".\"cc_last_4\" = 1234) ORDER BY \"litle_payment_methods\".\"id\" LIMIT 10 OFFSET 0"
|
16
|
-
# Note that Kill Bill will pass a String, even for numeric types
|
17
|
-
Killbill::Litle::LitlePaymentMethod.search_query('1234', 0, 10).to_sql.should == expected_query
|
18
|
-
|
19
|
-
# Check count query (search query string)
|
20
|
-
expected_query = "SELECT COUNT(DISTINCT \"litle_payment_methods\".\"id\") FROM \"litle_payment_methods\" WHERE (((((((((\"litle_payment_methods\".\"litle_token\" = 'XXX' OR \"litle_payment_methods\".\"cc_type\" = 'XXX') OR \"litle_payment_methods\".\"state\" = 'XXX') OR \"litle_payment_methods\".\"zip\" = 'XXX') OR \"litle_payment_methods\".\"cc_first_name\" LIKE '%XXX%') OR \"litle_payment_methods\".\"cc_last_name\" LIKE '%XXX%') OR \"litle_payment_methods\".\"address1\" LIKE '%XXX%') OR \"litle_payment_methods\".\"address2\" LIKE '%XXX%') OR \"litle_payment_methods\".\"city\" LIKE '%XXX%') OR \"litle_payment_methods\".\"country\" LIKE '%XXX%') ORDER BY \"litle_payment_methods\".\"id\""
|
21
|
-
Killbill::Litle::LitlePaymentMethod.search_query('XXX').to_sql.should == expected_query
|
22
|
-
|
23
|
-
# Check query with results (search query string)
|
24
|
-
expected_query = "SELECT DISTINCT \"litle_payment_methods\".* FROM \"litle_payment_methods\" WHERE (((((((((\"litle_payment_methods\".\"litle_token\" = 'XXX' OR \"litle_payment_methods\".\"cc_type\" = 'XXX') OR \"litle_payment_methods\".\"state\" = 'XXX') OR \"litle_payment_methods\".\"zip\" = 'XXX') OR \"litle_payment_methods\".\"cc_first_name\" LIKE '%XXX%') OR \"litle_payment_methods\".\"cc_last_name\" LIKE '%XXX%') OR \"litle_payment_methods\".\"address1\" LIKE '%XXX%') OR \"litle_payment_methods\".\"address2\" LIKE '%XXX%') OR \"litle_payment_methods\".\"city\" LIKE '%XXX%') OR \"litle_payment_methods\".\"country\" LIKE '%XXX%') ORDER BY \"litle_payment_methods\".\"id\" LIMIT 10 OFFSET 0"
|
25
|
-
Killbill::Litle::LitlePaymentMethod.search_query('XXX', 0, 10).to_sql.should == expected_query
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should search all fields' do
|
29
|
-
do_search('foo').size.should == 0
|
30
|
-
|
31
|
-
pm = Killbill::Litle::LitlePaymentMethod.create :kb_account_id => '11-22-33-44',
|
32
|
-
:kb_payment_method_id => '55-66-77-88',
|
33
|
-
:litle_token => 38102343,
|
34
|
-
:cc_first_name => 'ccFirstName',
|
35
|
-
:cc_last_name => 'ccLastName',
|
36
|
-
:cc_type => 'ccType',
|
37
|
-
:cc_exp_month => 10,
|
38
|
-
:cc_exp_year => 11,
|
39
|
-
:cc_last_4 => 1234,
|
40
|
-
:address1 => 'address1',
|
41
|
-
:address2 => 'address2',
|
42
|
-
:city => 'city',
|
43
|
-
:state => 'state',
|
44
|
-
:zip => 'zip',
|
45
|
-
:country => 'country'
|
46
|
-
|
47
|
-
do_search('foo').size.should == 0
|
48
|
-
do_search(pm.litle_token).size.should == 1
|
49
|
-
do_search('ccType').size.should == 1
|
50
|
-
# Exact match only for cc_last_4
|
51
|
-
do_search('123').size.should == 0
|
52
|
-
do_search('1234').size.should == 1
|
53
|
-
# Test partial match
|
54
|
-
do_search('address').size.should == 1
|
55
|
-
do_search('Name').size.should == 1
|
56
|
-
|
57
|
-
pm2 = Killbill::Litle::LitlePaymentMethod.create :kb_account_id => '22-33-44-55',
|
58
|
-
:kb_payment_method_id => '66-77-88-99',
|
59
|
-
:litle_token => 49384029302,
|
60
|
-
:cc_first_name => 'ccFirstName',
|
61
|
-
:cc_last_name => 'ccLastName',
|
62
|
-
:cc_type => 'ccType',
|
63
|
-
:cc_exp_month => 10,
|
64
|
-
:cc_exp_year => 11,
|
65
|
-
:cc_last_4 => 1234,
|
66
|
-
:address1 => 'address1',
|
67
|
-
:address2 => 'address2',
|
68
|
-
:city => 'city',
|
69
|
-
:state => 'state',
|
70
|
-
:zip => 'zip',
|
71
|
-
:country => 'country'
|
72
|
-
|
73
|
-
do_search('foo').size.should == 0
|
74
|
-
do_search(pm.litle_token).size.should == 1
|
75
|
-
do_search(pm2.litle_token).size.should == 1
|
76
|
-
do_search('ccType').size.should == 2
|
77
|
-
# Exact match only for cc_last_4
|
78
|
-
do_search('123').size.should == 0
|
79
|
-
do_search('1234').size.should == 2
|
80
|
-
# Test partial match
|
81
|
-
do_search('cc').size.should == 2
|
82
|
-
do_search('address').size.should == 2
|
83
|
-
do_search('Name').size.should == 2
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
|
88
|
-
def do_search(search_key)
|
89
|
-
pagination = Killbill::Litle::LitlePaymentMethod.search(search_key)
|
90
|
-
pagination.current_offset.should == 0
|
91
|
-
results = pagination.iterator.to_a
|
92
|
-
pagination.total_nb_records.should == results.size
|
93
|
-
results
|
94
|
-
end
|
95
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Killbill::Litle::LitleResponse do
|
4
|
-
before :all do
|
5
|
-
Killbill::Litle::LitleResponse.delete_all
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should generate the right SQL query' do
|
9
|
-
# Check count query (search query numeric)
|
10
|
-
expected_query = "SELECT COUNT(DISTINCT \"litle_responses\".\"id\") FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = '1234' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = '1234') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\""
|
11
|
-
# Note that Kill Bill will pass a String, even for numeric types
|
12
|
-
Killbill::Litle::LitleResponse.search_query('charge', '1234').to_sql.should == expected_query
|
13
|
-
|
14
|
-
# Check query with results (search query numeric)
|
15
|
-
expected_query = "SELECT DISTINCT \"litle_responses\".* FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = '1234' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = '1234') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\" LIMIT 10 OFFSET 0"
|
16
|
-
# Note that Kill Bill will pass a String, even for numeric types
|
17
|
-
Killbill::Litle::LitleResponse.search_query('charge', '1234', 0, 10).to_sql.should == expected_query
|
18
|
-
|
19
|
-
# Check count query (search query string)
|
20
|
-
expected_query = "SELECT COUNT(DISTINCT \"litle_responses\".\"id\") FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = 'XXX' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = 'XXX') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\""
|
21
|
-
Killbill::Litle::LitleResponse.search_query('charge', 'XXX').to_sql.should == expected_query
|
22
|
-
|
23
|
-
# Check query with results (search query string)
|
24
|
-
expected_query = "SELECT DISTINCT \"litle_responses\".* FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = 'XXX' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = 'XXX') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\" LIMIT 10 OFFSET 0"
|
25
|
-
Killbill::Litle::LitleResponse.search_query('charge', 'XXX', 0, 10).to_sql.should == expected_query
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should search all fields' do
|
29
|
-
do_search('foo').size.should == 0
|
30
|
-
|
31
|
-
pm = Killbill::Litle::LitleResponse.create :api_call => 'charge',
|
32
|
-
:kb_payment_id => '11-22-33-44',
|
33
|
-
:params_litleonelineresponse_saleresponse_id => '55-66-77-88',
|
34
|
-
:params_litleonelineresponse_saleresponse_litle_txn_id => 38102343,
|
35
|
-
:params_litleonelineresponse_saleresponse_order_id => 'order-id-1',
|
36
|
-
:params_litleonelineresponse_saleresponse_auth_code => 'auth-code-1',
|
37
|
-
:success => true
|
38
|
-
|
39
|
-
# Wrong api_call
|
40
|
-
ignored1 = Killbill::Litle::LitleResponse.create :api_call => 'add_payment_method',
|
41
|
-
:kb_payment_id => pm.kb_payment_id,
|
42
|
-
:params_litleonelineresponse_saleresponse_id => pm.params_litleonelineresponse_saleresponse_id,
|
43
|
-
:params_litleonelineresponse_saleresponse_litle_txn_id => pm.params_litleonelineresponse_saleresponse_litle_txn_id,
|
44
|
-
:params_litleonelineresponse_saleresponse_order_id => pm.params_litleonelineresponse_saleresponse_order_id,
|
45
|
-
:params_litleonelineresponse_saleresponse_auth_code => pm.params_litleonelineresponse_saleresponse_auth_code,
|
46
|
-
:success => true
|
47
|
-
|
48
|
-
# Not successful
|
49
|
-
ignored2 = Killbill::Litle::LitleResponse.create :api_call => 'charge',
|
50
|
-
:kb_payment_id => pm.kb_payment_id,
|
51
|
-
:params_litleonelineresponse_saleresponse_id => pm.params_litleonelineresponse_saleresponse_id,
|
52
|
-
:params_litleonelineresponse_saleresponse_litle_txn_id => pm.params_litleonelineresponse_saleresponse_litle_txn_id,
|
53
|
-
:params_litleonelineresponse_saleresponse_order_id => pm.params_litleonelineresponse_saleresponse_order_id,
|
54
|
-
:params_litleonelineresponse_saleresponse_auth_code => pm.params_litleonelineresponse_saleresponse_auth_code,
|
55
|
-
:success => false
|
56
|
-
|
57
|
-
do_search('foo').size.should == 0
|
58
|
-
do_search(pm.params_litleonelineresponse_saleresponse_id).size.should == 1
|
59
|
-
do_search(pm.params_litleonelineresponse_saleresponse_litle_txn_id).size.should == 1
|
60
|
-
do_search(pm.params_litleonelineresponse_saleresponse_order_id).size.should == 1
|
61
|
-
do_search(pm.params_litleonelineresponse_saleresponse_auth_code).size.should == 1
|
62
|
-
|
63
|
-
pm2 = Killbill::Litle::LitleResponse.create :api_call => 'charge',
|
64
|
-
:kb_payment_id => '11-22-33-44',
|
65
|
-
:params_litleonelineresponse_saleresponse_id => '11-22-33-44',
|
66
|
-
:params_litleonelineresponse_saleresponse_litle_txn_id => pm.params_litleonelineresponse_saleresponse_litle_txn_id,
|
67
|
-
:params_litleonelineresponse_saleresponse_order_id => 'order-id-2',
|
68
|
-
:params_litleonelineresponse_saleresponse_auth_code => 'auth-code-2',
|
69
|
-
:success => true
|
70
|
-
|
71
|
-
do_search('foo').size.should == 0
|
72
|
-
do_search(pm.params_litleonelineresponse_saleresponse_id).size.should == 1
|
73
|
-
do_search(pm.params_litleonelineresponse_saleresponse_litle_txn_id).size.should == 2
|
74
|
-
do_search(pm.params_litleonelineresponse_saleresponse_order_id).size.should == 1
|
75
|
-
do_search(pm.params_litleonelineresponse_saleresponse_auth_code).size.should == 1
|
76
|
-
do_search(pm2.params_litleonelineresponse_saleresponse_id).size.should == 1
|
77
|
-
do_search(pm2.params_litleonelineresponse_saleresponse_litle_txn_id).size.should == 2
|
78
|
-
do_search(pm2.params_litleonelineresponse_saleresponse_order_id).size.should == 1
|
79
|
-
do_search(pm2.params_litleonelineresponse_saleresponse_auth_code).size.should == 1
|
80
|
-
end
|
81
|
-
|
82
|
-
private
|
83
|
-
|
84
|
-
def do_search(search_key)
|
85
|
-
pagination = Killbill::Litle::LitleResponse.search(search_key)
|
86
|
-
pagination.current_offset.should == 0
|
87
|
-
results = pagination.iterator.to_a
|
88
|
-
pagination.total_nb_records.should == results.size
|
89
|
-
results
|
90
|
-
end
|
91
|
-
end
|
data/spec/litle/utils_spec.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Killbill::Litle::Utils do
|
4
|
-
it "should convert back and forth UUIDs" do
|
5
|
-
uuid = SecureRandom.uuid
|
6
|
-
packed = Killbill::Litle::Utils.compact_uuid(uuid)
|
7
|
-
unpacked = Killbill::Litle::Utils.unpack_uuid(packed)
|
8
|
-
unpacked.should == uuid
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should respect leading 0s" do
|
12
|
-
uuid = "0ae18a4c-be57-44c3-84ba-a82962a2de03"
|
13
|
-
0.upto(35) do |i|
|
14
|
-
# Skip hyphens
|
15
|
-
next if [8, 13, 18, 23].include?(i)
|
16
|
-
uuid[i] = '0'
|
17
|
-
packed = Killbill::Litle::Utils.compact_uuid(uuid)
|
18
|
-
unpacked = Killbill::Litle::Utils.unpack_uuid(packed)
|
19
|
-
unpacked.should == uuid
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|