tsubaiso-sdk 1.2.6 → 1.2.7
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/Rakefile +3 -2
- data/lib/tsubaiso_sdk.rb +550 -118
- data/test/stubbings/stub_register.rb +196 -0
- data/test/tsubaiso_sdk/common_setup_and_teardown.rb +23 -0
- data/test/tsubaiso_sdk/test_ap_reason_masters.rb +26 -0
- data/test/tsubaiso_sdk/test_api_history.rb +27 -0
- data/test/tsubaiso_sdk/test_ar_reason_masters.rb +26 -0
- data/test/tsubaiso_sdk/test_bank_account.rb +34 -0
- data/test/tsubaiso_sdk/test_bank_account_master.rb +119 -0
- data/test/tsubaiso_sdk/test_bank_account_transaction.rb +61 -0
- data/test/tsubaiso_sdk/test_bank_reason_master.rb +90 -0
- data/test/tsubaiso_sdk/test_bonus.rb +26 -0
- data/test/tsubaiso_sdk/test_bulk_scheduled_dates.rb +24 -0
- data/test/tsubaiso_sdk/test_corporate_master.rb +27 -0
- data/test/tsubaiso_sdk/test_customer.rb +71 -0
- data/test/tsubaiso_sdk/test_dept.rb +66 -0
- data/test/tsubaiso_sdk/test_fixed_assets.rb +18 -0
- data/test/tsubaiso_sdk/test_journal.rb +53 -0
- data/test/tsubaiso_sdk/test_journal_distribution.rb +29 -0
- data/test/tsubaiso_sdk/test_manual_journal.rb +84 -0
- data/test/tsubaiso_sdk/test_payrolles.rb +26 -0
- data/test/tsubaiso_sdk/test_petty_cash_reason_master.rb +72 -0
- data/test/tsubaiso_sdk/test_physical_inventory_master.rb +84 -0
- data/test/tsubaiso_sdk/test_purchase.rb +120 -0
- data/test/tsubaiso_sdk/test_reimbursement_reason_master.rb +27 -0
- data/test/tsubaiso_sdk/test_reimbursements.rb +63 -0
- data/test/tsubaiso_sdk/test_reimbursements_transactions.rb +75 -0
- data/test/tsubaiso_sdk/test_sale.rb +125 -0
- data/test/tsubaiso_sdk/test_scheduled_dates.rb +16 -0
- data/test/tsubaiso_sdk/test_staff.rb +26 -0
- data/test/tsubaiso_sdk/test_staff_data.rb +71 -0
- data/test/tsubaiso_sdk/test_staff_datum_master.rb +37 -0
- data/test/tsubaiso_sdk/test_tag.rb +53 -0
- data/test/tsubaiso_sdk/test_tax_master.rb +25 -0
- metadata +35 -5
- data/test/test_tsubaiso_sdk.rb +0 -964
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class JournalDistriibutionTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@journal_distribution_1 = {
|
|
9
|
+
title: 'title',
|
|
10
|
+
start_date: '2012-07-01',
|
|
11
|
+
finish_date: '2012-07-31',
|
|
12
|
+
account_codes: ['135~999','604'],
|
|
13
|
+
dept_code: 'SETSURITSU',
|
|
14
|
+
memo: '',
|
|
15
|
+
criteria: 'dept',
|
|
16
|
+
target_timestamp: '2017-02-01',
|
|
17
|
+
distribution_conditions: { 'SETSURITSU' => '1', 'COMMON' => '1' }
|
|
18
|
+
}
|
|
19
|
+
super('journal_distributions')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_create_journal_distribution
|
|
23
|
+
journal_distribution = @api.create_journal_distribution(@journal_distribution_1)
|
|
24
|
+
assert_equal 200, journal_distribution[:status].to_i, journal_distribution.inspect
|
|
25
|
+
assert_equal Time.parse(@journal_distribution_1[:target_timestamp]), Time.parse(journal_distribution[:json][:target_ym])
|
|
26
|
+
assert_equal @journal_distribution_1[:account_codes], journal_distribution[:json][:target_conditions_account_codes].split(',').map{|x| x.delete("'")}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class ManualJournalTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@manual_journal_1 = {
|
|
9
|
+
journal_timestamp: '2016-04-01',
|
|
10
|
+
journal_dcs: [
|
|
11
|
+
{
|
|
12
|
+
debit: {
|
|
13
|
+
account_code: '110',
|
|
14
|
+
price_including_tax: 200_000,
|
|
15
|
+
tax_type: 0
|
|
16
|
+
},
|
|
17
|
+
credit: {
|
|
18
|
+
account_code: '100',
|
|
19
|
+
price_including_tax: 200_000,
|
|
20
|
+
tax_type: 0
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
debit: {
|
|
25
|
+
account_code: '1',
|
|
26
|
+
price_including_tax: 54_321,
|
|
27
|
+
tax_type: 0
|
|
28
|
+
},
|
|
29
|
+
credit: {
|
|
30
|
+
account_code: '110',
|
|
31
|
+
price_including_tax: 54_321,
|
|
32
|
+
tax_type: 0
|
|
33
|
+
},
|
|
34
|
+
memo: 'Created From API'
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
data_partner: { link_url: 'www.example.com/7', id_code: '7' }
|
|
38
|
+
}
|
|
39
|
+
super('manual_journals')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_list_manual_journals
|
|
43
|
+
manual_journals_list = @api.list_manual_journals(2016, 4)
|
|
44
|
+
assert_equal 200, manual_journals_list[:status].to_i, manual_journals_list.inspect
|
|
45
|
+
assert !manual_journals_list[:json].empty?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_show_manual_journal
|
|
49
|
+
manual_journal = @api.create_manual_journal(@manual_journal_1)
|
|
50
|
+
manual_journals_list = @api.list_manual_journals(2016, 4)
|
|
51
|
+
last_manual_journal_id = manual_journals_list[:json].last[:id]
|
|
52
|
+
|
|
53
|
+
manual_journal = @api.show_manual_journal(last_manual_journal_id)
|
|
54
|
+
assert_equal 200, manual_journal[:status].to_i, manual_journal.inspect
|
|
55
|
+
assert_equal last_manual_journal_id, manual_journal[:json][:id]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_create_manual_journal
|
|
59
|
+
manual_journal = @api.create_manual_journal(@manual_journal_1)
|
|
60
|
+
assert_equal 200, manual_journal[:status].to_i, manual_journal.inspect
|
|
61
|
+
assert_equal @manual_journal_1[:journal_dcs][0][:debit][:price_including_tax], manual_journal[:json][:journal_dcs][0][:debit][:price_including_tax]
|
|
62
|
+
assert_equal @manual_journal_1[:data_partner][:id_code], manual_journal[:json][:data_partner][:id_code]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_update_manual_journal
|
|
66
|
+
manual_journal = @api.create_manual_journal(@manual_journal_1)
|
|
67
|
+
options = {
|
|
68
|
+
id: manual_journal[:json][:id],
|
|
69
|
+
journal_dcs: manual_journal[:json][:journal_dcs],
|
|
70
|
+
data_partner: { :id_code => '700' },
|
|
71
|
+
}
|
|
72
|
+
options[:journal_dcs][0][:debit][:price_including_tax] = 2000
|
|
73
|
+
options[:journal_dcs][0][:credit][:price_including_tax] = 2000
|
|
74
|
+
options[:journal_dcs][0][:memo] = 'Updated from API'
|
|
75
|
+
options[:journal_dcs][1][:dept_code] = 'SETSURITSU'
|
|
76
|
+
|
|
77
|
+
updated_manual_journal = @api.update_manual_journal(options)
|
|
78
|
+
assert_equal 200, updated_manual_journal[:status].to_i, updated_manual_journal.inspect
|
|
79
|
+
assert_equal options[:journal_dcs][0][:debit][:price_including_tax], updated_manual_journal[:json][:journal_dcs][0][:debit][:price_including_tax]
|
|
80
|
+
assert_equal options[:journal_dcs][0][:memo], updated_manual_journal[:json][:journal_dcs][0][:memo]
|
|
81
|
+
assert_equal options[:journal_dcs][1][:dept_code], updated_manual_journal[:json][:journal_dcs][1][:dept_code]
|
|
82
|
+
assert_equal options[:data_partner][:id_code], updated_manual_journal[:json][:data_partner][:id_code]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class PayrollsTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super("payrolls")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_show_payroll
|
|
12
|
+
payrolls_list = @api.list_payrolls(2017, 2)
|
|
13
|
+
first_payroll_id = payrolls_list[:json].first[:id]
|
|
14
|
+
|
|
15
|
+
payroll = @api.show_payroll(first_payroll_id)
|
|
16
|
+
assert_equal 200, payroll[:status].to_i, payroll.inspect
|
|
17
|
+
assert_equal first_payroll_id, payroll[:json][:id]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_list_payrolls
|
|
21
|
+
payrolls_list = @api.list_payrolls(2017, 2)
|
|
22
|
+
|
|
23
|
+
assert_equal 200, payrolls_list[:status].to_i, payrolls_list.inspect
|
|
24
|
+
assert !payrolls_list.empty?
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative 'common_setup_and_teardown'
|
|
3
|
+
|
|
4
|
+
class PettyCashReasonMaster < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@petty_cash_reason_master_1 = {
|
|
9
|
+
reason_code: 'sdk_test_create',
|
|
10
|
+
reason_name: 'SDK before update',
|
|
11
|
+
dc: 'd',
|
|
12
|
+
account_code: '100',
|
|
13
|
+
is_valid: '0',
|
|
14
|
+
memo: 'this is test before update',
|
|
15
|
+
port_type: '0',
|
|
16
|
+
sort_number: '0'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@petty_cash_reason_master_2 = {
|
|
20
|
+
reason_code: "sdk_test_create2",
|
|
21
|
+
reason_name: "TEST_REASON",
|
|
22
|
+
dc: "d",
|
|
23
|
+
account_code: "999",
|
|
24
|
+
is_valid: "0",
|
|
25
|
+
memo: "This is Test reason.",
|
|
26
|
+
port_type: "0",
|
|
27
|
+
sort_number: "0"
|
|
28
|
+
}
|
|
29
|
+
super("petty_cash_reason_masters")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_create_petty_cash_reason_master
|
|
33
|
+
created_pcrm = @api.create_petty_cash_reason_master(@petty_cash_reason_master_1)
|
|
34
|
+
assert_equal 200, created_pcrm[:status].to_i, created_pcrm.inspect
|
|
35
|
+
assert_equal @petty_cash_reason_master_1[:reason_code], created_pcrm[:json][:reason_code]
|
|
36
|
+
|
|
37
|
+
shown_prcm = @api.show_petty_cash_reason_master(created_pcrm[:json][:id].to_i)
|
|
38
|
+
assert_equal 200, created_pcrm[:status].to_i, created_pcrm.inspect
|
|
39
|
+
@petty_cash_reason_master_1.each_pair do |key,val|
|
|
40
|
+
assert_equal val, shown_prcm[:json][key], "col :#{key}, #{val} was expected but #{shown_prcm[:json][key]} was found."
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_update_petty_cash_reason_master
|
|
45
|
+
old_petty_cash_reason_master = @api.create_petty_cash_reason_master(@petty_cash_reason_master_1)
|
|
46
|
+
options = {
|
|
47
|
+
reason_name: 'updating from API',
|
|
48
|
+
memo: 'updating memo from API'
|
|
49
|
+
}
|
|
50
|
+
updated_petty_cash_reason_master = @api.update_petty_cash_reason_master(old_petty_cash_reason_master[:json][:id], options)
|
|
51
|
+
|
|
52
|
+
assert_equal 200, updated_petty_cash_reason_master[:status].to_i, updated_petty_cash_reason_master.inspect
|
|
53
|
+
assert_equal options[:reason_name], updated_petty_cash_reason_master[:json][:reason_name]
|
|
54
|
+
assert_equal options[:memo], updated_petty_cash_reason_master[:json][:memo]
|
|
55
|
+
assert_equal old_petty_cash_reason_master[:json][:reason_code], updated_petty_cash_reason_master[:json][:reason_code]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_list_petty_cash_reason_masters
|
|
59
|
+
listed_pcrms = @api.list_petty_cash_reason_masters
|
|
60
|
+
assert_equal listed_pcrms[:json].size, 2
|
|
61
|
+
pcrm1 = listed_pcrms[:json].find{|record| record[:reason_code] == "sdk_test_create"}
|
|
62
|
+
@petty_cash_reason_master_1.each_pair do |key, val|
|
|
63
|
+
assert_equal val, pcrm1[key], "col :#{key}, #{val} was expected but #{pcrm1[key]} was found."
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
pcrm2 = listed_pcrms[:json].find{|record| record[:reason_code] == "sdk_test_create2"}
|
|
67
|
+
@petty_cash_reason_master_2.each_pair do |key, val|
|
|
68
|
+
assert_equal val, pcrm2[key], "col :#{key}, #{val} was expected but #{pcrm2[key]} was found."
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class PhysicalInventoryMaster < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@pim_201901 = {
|
|
9
|
+
name: 'sendai',
|
|
10
|
+
memo: 'this inventory is registered from SDK test',
|
|
11
|
+
start_ymd: '2019/01/01',
|
|
12
|
+
finish_ymd: nil,
|
|
13
|
+
tag_list: 'GROUP2_1,GROUP3_2',
|
|
14
|
+
dept_code: 'NEVER_ENDING'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@pim_201902 = {
|
|
18
|
+
name: 'osaka',
|
|
19
|
+
memo: 'this inventory is registered from SDK test #2',
|
|
20
|
+
start_ymd: '2019/02/01',
|
|
21
|
+
finish_ymd: '2020/12/02'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@pim_201903 = {
|
|
25
|
+
name: 'nagoya',
|
|
26
|
+
memo: 'this inventory is registered from SDK test #3',
|
|
27
|
+
start_ymd: '2019/03/01',
|
|
28
|
+
finish_ymd: '2020/12/03'
|
|
29
|
+
}
|
|
30
|
+
super("physical_inventory_masters")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_create_physical_inventory_masters
|
|
34
|
+
physical_inventory_master = @api.create_physical_inventory_masters(@pim_201901)
|
|
35
|
+
assert physical_inventory_master[:json] != nil
|
|
36
|
+
|
|
37
|
+
assert_equal 200, physical_inventory_master[:status].to_i, physical_inventory_master.inspect
|
|
38
|
+
assert_equal @pim_201901[:name], physical_inventory_master[:json][:name]
|
|
39
|
+
assert_equal @pim_201901[:memo], physical_inventory_master[:json][:memo]
|
|
40
|
+
assert_equal @pim_201901[:start_ymd], physical_inventory_master[:json][:start_ymd]
|
|
41
|
+
assert_equal @pim_201901[:finish_ymd], physical_inventory_master[:json][:finish_ymd]
|
|
42
|
+
assert_equal @pim_201901[:tag_list], physical_inventory_master[:json][:tag_list].join(",")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_list_physical_inventory_masters
|
|
46
|
+
pim_201901 = @api.create_physical_inventory_masters(@pim_201901)
|
|
47
|
+
pim_201902 = @api.create_physical_inventory_masters(@pim_201902)
|
|
48
|
+
pim_201903 = @api.create_physical_inventory_masters(@pim_201903)
|
|
49
|
+
|
|
50
|
+
pim_201901_id = pim_201901[:json][:id]
|
|
51
|
+
pim_201902_id = pim_201902[:json][:id]
|
|
52
|
+
pim_201903_id = pim_201903[:json][:id]
|
|
53
|
+
|
|
54
|
+
list_physical_inventory_masters = @api.list_physical_inventory_masters
|
|
55
|
+
assert_equal 200, list_physical_inventory_masters[:status].to_i, list_physical_inventory_masters.inspect
|
|
56
|
+
|
|
57
|
+
assert(list_physical_inventory_masters[:json].any? { |x| x[:id] == pim_201901_id })
|
|
58
|
+
assert(list_physical_inventory_masters[:json].any? { |x| x[:id] == pim_201902_id })
|
|
59
|
+
assert(list_physical_inventory_masters[:json].any? { |x| x[:id] == pim_201903_id })
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_update_physical_inventory_masters
|
|
63
|
+
physical_inventory_master = @api.create_physical_inventory_masters(@pim_201901)
|
|
64
|
+
assert physical_inventory_master[:json][:id], physical_inventory_master
|
|
65
|
+
options = {
|
|
66
|
+
id: physical_inventory_master[:json][:id],
|
|
67
|
+
memo: 'Updated memo',
|
|
68
|
+
name: 'kanazawa',
|
|
69
|
+
start_ymd: '2019/11/21',
|
|
70
|
+
}
|
|
71
|
+
# NOTE: updating dept and tag_list is not permitted in physical_inventory_master.
|
|
72
|
+
updated_physical_inventory_master = @api.update_physical_inventory_masters(options)
|
|
73
|
+
assert physical_inventory_master[:json] != nil
|
|
74
|
+
|
|
75
|
+
assert_equal 200, updated_physical_inventory_master[:status].to_i, updated_physical_inventory_master.inspect
|
|
76
|
+
assert_equal options[:id], updated_physical_inventory_master[:json][:id]
|
|
77
|
+
assert_equal options[:memo], updated_physical_inventory_master[:json][:memo]
|
|
78
|
+
assert_equal options[:name], updated_physical_inventory_master[:json][:name]
|
|
79
|
+
assert_equal options[:start_ymd], updated_physical_inventory_master[:json][:start_ymd]
|
|
80
|
+
assert_equal physical_inventory_master[:json][:finish_ymd], updated_physical_inventory_master[:json][:finish_ymd]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class PurchaseTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@purchase_201608 = {
|
|
9
|
+
price_including_tax: 5400,
|
|
10
|
+
year: 2016,
|
|
11
|
+
month: 8,
|
|
12
|
+
accrual_timestamp: '2016-08-01',
|
|
13
|
+
customer_master_code: '102',
|
|
14
|
+
dept_code: 'SETSURITSU',
|
|
15
|
+
reason_master_code: 'BUYING_IN',
|
|
16
|
+
dc: 'c',
|
|
17
|
+
memo: '',
|
|
18
|
+
tax_code: 1007,
|
|
19
|
+
port_type: 1,
|
|
20
|
+
data_partner: { link_url: 'www.example.com/3', id_code: '3', partner_code: 'Example' }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@purchase_201609 = {
|
|
24
|
+
price_including_tax: 5400,
|
|
25
|
+
year: 2016,
|
|
26
|
+
month: 9,
|
|
27
|
+
accrual_timestamp: '2016-09-01',
|
|
28
|
+
customer_master_code: '102',
|
|
29
|
+
dept_code: 'SETSURITSU',
|
|
30
|
+
reason_master_code: 'BUYING_IN',
|
|
31
|
+
dc: 'c',
|
|
32
|
+
memo: '',
|
|
33
|
+
tax_code: 1007,
|
|
34
|
+
port_type: 1,
|
|
35
|
+
data_partner: { link_url: 'www.example.com/4', id_code: '4' }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@purchase_201702 = {
|
|
39
|
+
price_including_tax: 5400,
|
|
40
|
+
year: 2017,
|
|
41
|
+
month: 2,
|
|
42
|
+
accrual_timestamp: '2017-02-28',
|
|
43
|
+
customer_master_code: '105',
|
|
44
|
+
reason_master_code: 'BUYING_IN',
|
|
45
|
+
dc: 'c',
|
|
46
|
+
memo: '',
|
|
47
|
+
tax_code: 18,
|
|
48
|
+
port_type: 1,
|
|
49
|
+
data_partner: { link_url: 'www.example.com/9', id_code: '9' }
|
|
50
|
+
}
|
|
51
|
+
super("ap_payments")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_create_purchase
|
|
55
|
+
purchase = @api.create_purchase(@purchase_201608)
|
|
56
|
+
assert_equal 200, purchase[:status].to_i, purchase.inspect
|
|
57
|
+
assert_equal @purchase_201608[:dept_code], purchase[:json][:dept_code]
|
|
58
|
+
assert_equal @purchase_201608[:data_partner][:id_code], purchase[:json][:data_partner][:id_code]
|
|
59
|
+
assert_equal @purchase_201608[:data_partner][:partner_code], purchase[:json][:data_partner][:partner_code]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_find_or_create_purchase
|
|
63
|
+
key_options = { key:
|
|
64
|
+
{ id_code: @purchase_201608[:data_partner][:id_code],
|
|
65
|
+
partner_code: @purchase_201608[:data_partner][:partner_code] } }
|
|
66
|
+
purchase1 = @api.find_or_create_purchase(@purchase_201608.merge(key_options))
|
|
67
|
+
|
|
68
|
+
assert_equal 200, purchase1[:status].to_i, purchase1.inspect
|
|
69
|
+
assert_equal @purchase_201608[:dept_code], purchase1[:json][:dept_code]
|
|
70
|
+
assert_equal @purchase_201608[:data_partner][:id_code], purchase1[:json][:data_partner][:id_code]
|
|
71
|
+
assert_equal @purchase_201608[:data_partner][:partner_code], purchase1[:json][:data_partner][:partner_code]
|
|
72
|
+
|
|
73
|
+
purchase2 = @api.find_or_create_purchase(@purchase_201608.merge(key_options))
|
|
74
|
+
assert_equal 200, purchase2[:status].to_i, purchase2.inspect
|
|
75
|
+
assert_equal purchase2[:json][:id], purchase1[:json][:id]
|
|
76
|
+
assert_equal purchase2[:json][:data_partner][:id_code], purchase1[:json][:data_partner][:id_code]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_update_purchase
|
|
80
|
+
purchase = @api.create_purchase(@purchase_201702)
|
|
81
|
+
assert purchase[:json][:id], purchase
|
|
82
|
+
options = {
|
|
83
|
+
id: purchase[:json][:id].to_i,
|
|
84
|
+
price_including_tax: 50_000,
|
|
85
|
+
memo: 'Updated memo',
|
|
86
|
+
data_partner: { id_code: '300' }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
updated_purchase = @api.update_purchase(options)
|
|
90
|
+
assert_equal 200, updated_purchase[:status].to_i, updated_purchase.inspect
|
|
91
|
+
assert_equal options[:id], updated_purchase[:json][:id]
|
|
92
|
+
assert_equal options[:memo], updated_purchase[:json][:memo]
|
|
93
|
+
assert_equal options[:price_including_tax], updated_purchase[:json][:price_including_tax]
|
|
94
|
+
assert_equal options[:data_partner][:id_code], updated_purchase[:json][:data_partner][:id_code]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def test_show_purchase
|
|
98
|
+
purchase = @api.create_purchase(@purchase_201608)
|
|
99
|
+
|
|
100
|
+
get_purchase = @api.show_purchase("AP#{purchase[:json][:id]}")
|
|
101
|
+
assert_equal 200, get_purchase[:status].to_i, get_purchase.inspect
|
|
102
|
+
assert_equal purchase[:json][:id], get_purchase[:json][:id]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def test_list_purchases_and_account_balances
|
|
106
|
+
# Without customer_master_code and ar_segment option parameters
|
|
107
|
+
balance_lists = @api.list_purchases_and_account_balances(2019, 12)
|
|
108
|
+
assert_equal 200, balance_lists[:status].to_i, balance_lists.inspect
|
|
109
|
+
assert_equal 3, balance_lists[:json].size
|
|
110
|
+
|
|
111
|
+
# With customer_master_id option parameters
|
|
112
|
+
balance_list_with_opts = @api.list_purchases_and_account_balances(2019, 12,
|
|
113
|
+
:customer_master_id => 101)
|
|
114
|
+
|
|
115
|
+
assert_equal 200, balance_list_with_opts[:status].to_i, balance_list_with_opts.inspect
|
|
116
|
+
assert_equal 2, balance_list_with_opts[:json].size
|
|
117
|
+
assert(balance_list_with_opts[:json].all? { |x| x[:customer_master_code] == "101"})
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class ReimbursementReasonMasterTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super("reimbursement_reason_masters")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_list_reimbursement_reason_masters
|
|
12
|
+
reimbursement_reason_masters_list = @api.list_reimbursement_reason_masters
|
|
13
|
+
assert_equal 200, reimbursement_reason_masters_list[:status].to_i, reimbursement_reason_masters_list.inspect
|
|
14
|
+
assert reimbursement_reason_masters_list[:json]
|
|
15
|
+
assert !reimbursement_reason_masters_list[:json].empty?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_show_reimbursement_reason_master
|
|
19
|
+
reim_reason_msts = @api.list_reimbursement_reason_masters
|
|
20
|
+
reim_reason_mst_id = reim_reason_msts[:json].first[:id]
|
|
21
|
+
reim_reason_mst = @api.show_reimbursement_reason_master(reim_reason_mst_id)
|
|
22
|
+
|
|
23
|
+
assert_equal 200, reim_reason_mst[:status].to_i, reim_reason_mst.inspect
|
|
24
|
+
assert_equal reim_reason_mst[:json][:id], reim_reason_mst_id
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|