Skip to content

Commit 0cfb047

Browse files
committed
Update the readme to use credential instead of certificate
1 parent 6e154b3 commit 0cfb047

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Croatia is a gem that contains various utilities for performing Croatia-specific
88
- [x] Validation
99
- [x] Parsing
1010
- [x] Generation
11-
- [ ] Invoices
11+
- [ ] Invoices [MISSING E-INVOICE SUPPORT]
1212
- [x] Discounts
1313
- [x] Percentage
1414
- [x] Total
@@ -19,12 +19,12 @@ Croatia is a gem that contains various utilities for performing Croatia-specific
1919
- [x] Margins _(Marza)_
2020
- [x] Payment barcodes
2121
- [x] HUB3 standard 2D barcode generation
22-
- [ ] Fiscalization v2.3 _(Fiskalizacija)_
22+
- [ ] Fiscalization v2.3 _(Fiskalizacija)_ [NOT YET VERIFIED]
2323
- [x] Issuer protection code generation _(ZKI)_
2424
- [x] Reverse _(storno)_
25-
- [ ] Invoices _(racuni)_
26-
- [ ] Supporting documents _(prateci dokumenti - otpremnice, radni nalozi, ponude, ugovori, ...)_
27-
- [ ] Payment method change
25+
- [x] Invoices _(racuni)_
26+
- [x] Supporting documents _(prateci dokumenti - otpremnice, radni nalozi, ponude, ugovori, ...)_
27+
- [x] Payment method change
2828
- [x] Verification QR code generation
2929
- [ ] E-Invoice _(e-Racun)_
3030

@@ -64,13 +64,17 @@ Croatia.configure do |config|
6464

6565
# Fiscalization defaults
6666
config.fiscalization = {
67-
certificate: "path/to/your/certificate.p12", # or File.read("path/to/your/certificate.p12")
68-
password: ENV["FISCALIZATION_CERTIFICATE_PASSWORD"]
67+
credential: "path/to/your/credential.p12", # or File.read("path/to/your/credential.p12")
68+
password: ENV["FISCALIZATION_CREDENTIAL_PASSWORD"]
6969
}
70-
# You can also use a plain private key (.key) file instead of a full certificate (.p12)
71-
# if you don't have a .p12 or don't want to store/manage a password.
70+
# You can also use separate private key and certificate files instead of a full credential (.p12)
7271
# config.fiscalization = {
73-
# certificate: "path/to/your/private_key.key", # or ENV["FISCALIZATION_PRIVATE_KEY"],
72+
# credential: {
73+
# private_key: "path/to/your/private_key.key", # or ENV["FISCALIZATION_PRIVATE_KEY"]
74+
# certificate: "path/to/your/certificate.crt", # or ENV["FISCALIZATION_CERTIFICATE"]
75+
# ca_chain: ENV["FISCALIZATION_CA_CHAIN"] # optional, or "path/to/your/ca_cert.crt"
76+
# },
77+
# password: "credential_password" # only needed for encrypted private keys
7478
# }
7579
end
7680
```
@@ -255,10 +259,10 @@ barcode.to_png # => "\b..."
255259
# Issuer protection code (ZKI) is generated automatically
256260
invoice.issuer_protection_code # => "abcd1234efgh5678ijkl9012mnop3456"
257261

258-
# Fiscalize an invoice using the certificate from the config
262+
# Fiscalize an invoice using the credential from the config
259263
invoice.fiscalize!
260-
# Fiscalize an invoice using a custom certificate and password
261-
invoice.fiscalize!(certificate: "path/to/your/certificate.p12", password: "your_password")
264+
# Fiscalize an invoice using a custom credential and password
265+
invoice.fiscalize!(credential: "path/to/your/credential.p12", password: "your_password")
262266

263267
# In case you want to "undo" a fiscalized invoice, you can reverse the invoice
264268
invoice.reverse!

lib/croatia/fiscalizer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def load_certificate(credential, password)
8080
OpenSSL::PKCS12.new(File.read(credential), password)
8181
in String
8282
OpenSSL::PKCS12.new(credential, password)
83-
in { private_key: String, public_certificate: String, **rest }
83+
in { private_key: String, certificate: String, **rest }
8484
private_key_content = is_a_file_path?(credential[:private_key]) ? File.read(credential[:private_key]) : credential[:private_key]
85-
certificate_content = is_a_file_path?(credential[:public_certificate]) ? File.read(credential[:public_certificate]) : credential[:public_certificate]
85+
certificate_content = is_a_file_path?(credential[:certificate]) ? File.read(credential[:certificate]) : credential[:certificate]
8686

8787
private_key = OpenSSL::PKey::RSA.new(private_key_content)
8888
certificate = OpenSSL::X509::Certificate.new(certificate_content)

0 commit comments

Comments
 (0)