diff --git a/lib/prawn/swiss_qr_bill/sections/payment_amount.rb b/lib/prawn/swiss_qr_bill/sections/payment_amount.rb index 8f71950..7bb1d53 100644 --- a/lib/prawn/swiss_qr_bill/sections/payment_amount.rb +++ b/lib/prawn/swiss_qr_bill/sections/payment_amount.rb @@ -40,7 +40,7 @@ def draw_currency doc.bounding_box([doc.bounds.left, doc.bounds.top], width: CURRENCY_WIDTH, height: specs.height) do label I18n.t('currency', scope: i18n_scope) - content 'CHF' + content @data.fetch(:currency, 'CHF') end end diff --git a/lib/prawn/swiss_qr_bill/sections/receipt_amount.rb b/lib/prawn/swiss_qr_bill/sections/receipt_amount.rb index cb0dac4..61648b3 100644 --- a/lib/prawn/swiss_qr_bill/sections/receipt_amount.rb +++ b/lib/prawn/swiss_qr_bill/sections/receipt_amount.rb @@ -38,7 +38,7 @@ def draw_currency doc.bounding_box([doc.bounds.left, doc.bounds.top], width: CURRENCY_WIDTH, height: specs.height) do doc.pad_top(1.4) { label I18n.t('currency', scope: i18n_scope) } - doc.pad_top(2.5) { content 'CHF' } + doc.pad_top(2.5) { content @data.fetch(:currency, 'CHF') } end end diff --git a/spec/features/pdf_generation_spec.rb b/spec/features/pdf_generation_spec.rb index 1ca580d..092c7b6 100644 --- a/spec/features/pdf_generation_spec.rb +++ b/spec/features/pdf_generation_spec.rb @@ -90,4 +90,12 @@ expect(reader_for_bill.pages.length).to eq(1) end end + + context 'when currency EUR' do + let(:bill_data) { DataManager.build_bill(:default).merge(currency: 'EUR') } + + it 'generates a correct pdf' do + expect(reader_for_bill.pages[0].text).to include('EUR').twice + end + end end