0.0
No commit activity in last 3 years
No release in over 3 years
The best way to generate Japan Net Bank CSV to transfer.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

 Project Readme

JapanNetBank

ジャパンネット銀行の振込用 CSV を生成処理をサポートするライブラリです。

(サンプル CSV)

1,33,1,1,1111111,カ)ニホンシヨウジ,1000,ジヤパネタロウ
1,33,1,1,2222222,カ)ヤマモトシヨウテン,1000,ジヤパネタロウ
1,33,1,1,3333333,ニホンコウギヨウ(カ,1000,ジヤパネタロウ
1,33,1,1,4444444,ササキシヨウカイ(カ,1000,ジヤパネタロウ
1,33,1,1,5555555,カトウハナコ,1000,ジヤパネタロウ
1,33,1,1,6666666,サトウタロウ,1000,ジヤパネタロウ
1,33,1,1,7777777,ザイ)マルマルキヨウカイ,1000,ジヤパネタロウ
1,33,1,1,8888888,イ-.マネ-(カ,1000,ジヤパネタロウ
1,33,1,1,9999999,イケダ(カ)ニホンジムシヨ,1000,ジヤパネタロウ
1,33,1,1,1234567,ミタブングテン(カ,1000,ジヤパネタロウ
2,,,,,10,10000,

振込用 CSV の詳細については下記を参照してください。

また、下記に基づいて振込手数料を算出できます。

Installation

Add this line to your application's Gemfile:

gem 'japan_net_bank'

And then execute:

$ bundle

Or install it yourself as:

$ gem install japan_net_bank

Usage

Generate CSV for transfer (1)

transfer_data = [
    {
        bank_code:    '0123',
        branch_code:  '012',
        account_type: 'ordinary', # ordinary / checking / savings
        number:       '0123456',
        name:         'サトウキテコ',
        amount:       1600,
    },
    {
        bank_code:    '0234',
        branch_code:  '023',
        account_type: 'ordinary',
        number:       '0234567',
        name:         'サトウハナコ',
        amount:       3200,
    }
]

csv_string = JapanNetBank::Transfer.from_hash_array(transfer_data).to_csv
# or csv_string = JNB::Transfer.from_hash_array(transfer_data).to_csv

puts csv_string #=> "1,0123,012,1,0123456,サトウキテコ,1600\r\n1,0234,023,1,0234567,サトウハナコ,3200\r\n2,,,,,2,4800\r\n"

Generate CSV for transfer (2)

row1 = JapanNetBank::Transfer::Row.new(
    bank_code:    '0123',
    branch_code:  '012',
    account_type: 'ordinary', # ordinary / checking / savings
    number:       '0123456',
    name:         'サトウキテコ',
    amount:       1600,
)

row2 = JapanNetBank::Transfer::Row.new(
    bank_code:    '0234',
    branch_code:  '023',
    account_type: 'ordinary',
    number:       '0234567',
    name:         'サトウハナコ',
    amount:       3200,
)

transfer = JapanNetBank::Transfer.generate do |t|
  t << row1
  t << row2
end

puts transfer.to_csv #=> "1,0123,012,1,0123456,サトウキテコ,1600\r\n1,0234,023,1,0234567,サトウハナコ,3200\r\n2,,,,,2,4800\r\n"

Parse CSV for transfer

puts csv_string #=> "1,0123,012,1,0123456,サトウキテコ,1600\r\n1,0234,023,1,0234567,サトウハナコ,3200\r\n2,,,,,2,4800\r\n"

transfer = JapanNetBank::Transfer.parse_csv(csv_string)
# or transfer = JNB::Transfer.parse_csv(csv_string)

transfer.each do |row|
  puts row.record_type  #=> "1"
  puts row.bank_code    #=> "0123"
  puts row.branch_code  #=> "012"
  puts row.account_type #=> "ordinary" # ordinary / checking / savings
  puts row.number       #=> "0123456"
  puts row.name         #=> "サトウキテコ"
  puts row.amount       #=> 1600
end

Transfer fee

transfer_fee = JapanNetBank::Transfer.fee_for(bank_code: '0123', amount: 30_000)
# or transfer_fee = JNB::Transfer.fee_for(bank_code: '0123', amount: 30_000)

puts transfer_fee #=> 270