Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pepabo/japan_net_bank
ジャパンネット銀行のサポートライブラリ
https://github.com/pepabo/japan_net_bank
Last synced: about 1 month ago
JSON representation
ジャパンネット銀行のサポートライブラリ
- Host: GitHub
- URL: https://github.com/pepabo/japan_net_bank
- Owner: pepabo
- License: mit
- Created: 2014-05-26T01:22:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-30T08:03:02.000Z (almost 5 years ago)
- Last Synced: 2024-11-06T08:06:08.322Z (about 2 months ago)
- Language: Ruby
- Homepage:
- Size: 86.9 KB
- Stars: 9
- Watchers: 206
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JapanNetBank
ジャパンネット銀行の振込用 CSV を生成処理をサポートするライブラリです。
(サンプル 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 の詳細については下記を参照してください。
* [操作説明|WEB総振|BA-PLUSオプションサービス|BA-PLUS|ビジネスでのご利用|ジャパンネット銀行](http://www.japannetbank.co.jp/business/baplus/service/web_all/manual.html)
* [csv_explain.pdf](http://www.japannetbank.co.jp/service/payment/web_all/csv_explain.pdf)また、下記に基づいて振込手数料を算出できます。
* http://www.japannetbank.co.jp/web_all_baplus_manual.pdf
* 現在、組戻手数料には対応していません
* 手数料の変更には追随していく方針ですが、追随が遅れる可能性があります## 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)
```ruby
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_csvputs 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)
```ruby
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
endputs 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
```ruby
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
```ruby
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
```