homebrew-core/Formula/libofx.rb

137 lines
4.5 KiB
Ruby

class Libofx < Formula
desc "Library to support OFX command responses"
homepage "https://github.com/libofx/libofx"
url "https://github.com/libofx/libofx/releases/download/0.10.9/libofx-0.10.9.tar.gz"
sha256 "1ca89ff7d681c9edad312172ac464231a8de686e653213612f9417492cef0d37"
license "GPL-2.0-or-later"
bottle do
sha256 arm64_ventura: "4c2f9ec0e41e667c21b2a6c1fbe81d11e356e1d5d5afdf80b1f3e771a6da3183"
sha256 arm64_monterey: "c6e732fd8e3dac426fea0f2845c634af8542661058265f43886ef2f65828f95f"
sha256 arm64_big_sur: "0cbb926e59cd1032c9db87a9c4b33747a45dc6f48b2e4a1c26fefd066401c8f5"
sha256 ventura: "64a1c8fe606555249a4a3610912062525f0253c98f479f1246d7cd57355d185d"
sha256 monterey: "aa32a1500793c8add1ae49017887b2288f5c0d921d4db3681c1150f854da1038"
sha256 big_sur: "8e0d20d6e6f664a559e2e4cd665562b514b17ec491fe9a433bc8b85fb4ba221e"
sha256 catalina: "08593e309b9133e1b534200b44ed4a87446fa305f63dfdc79e1de93a9ac22835"
sha256 x86_64_linux: "88107478b5837f83a6f9f6f99279b3fa10c9465b7fca30fb52ff51a6b07f1271"
end
head do
url "https://github.com/libofx/libofx.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gengetopt" => :build
depends_on "libtool" => :build
end
depends_on "open-sp"
def install
ENV.cxx11
system "./autogen.sh" if build.head?
opensp = Formula["open-sp"]
system "./configure", "--disable-dependency-tracking",
"--with-opensp-includes=#{opensp.opt_include}/OpenSP",
"--with-opensp-libs=#{opensp.opt_lib}",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.ofx").write <<~EOS
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<DTSERVER>20130525225731.258
<LANGUAGE>ENG
<DTPROFUP>20050531060000.000
<FI>
<ORG>FAKE
<FID>1101
</FI>
<INTU.BID>51123
<INTU.USERID>9774652
</SONRS>
</SIGNONMSGSRSV1>
<BANKMSGSRSV1>
<STMTTRNRS>
<TRNUID>0
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<STMTRS>
<CURDEF>USD
<BANKACCTFROM>
<BANKID>5472369148
<ACCTID>145268707
<ACCTTYPE>CHECKING
</BANKACCTFROM>
<BANKTRANLIST>
<DTSTART>20000101070000.000
<DTEND>20130525060000.000
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>20110331120000.000
<TRNAMT>0.01
<FITID>0000486
<NAME>DIVIDEND EARNED FOR PERIOD OF 03
<MEMO>DIVIDEND ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20110405120000.000
<TRNAMT>-34.51
<FITID>0000487
<NAME>AUTOMATIC WITHDRAWAL, ELECTRIC BILL
<MEMO>AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
</STMTTRN>
<STMTTRN>
<TRNTYPE>CHECK
<DTPOSTED>20110407120000.000
<TRNAMT>-25.00
<FITID>0000488
<CHECKNUM>319
<NAME>RETURNED CHECK FEE, CHECK # 319
<MEMO>RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
</STMTTRN>
</BANKTRANLIST>
<LEDGERBAL>
<BALAMT>100.99
<DTASOF>20130525225731.258
</LEDGERBAL>
<AVAILBAL>
<BALAMT>75.99
<DTASOF>20130525225731.258
</AVAILBAL>
</STMTRS>
</STMTTRNRS>
</BANKMSGSRSV1>
</OFX>
EOS
output = shell_output("#{bin}/ofxdump #{testpath}/test.ofx")
assert_equal output.scan(/Account ID\s?: 5472369148 145268707/).length, 5
%w[0000486 0000487 0000488].each do |fid|
assert_match "Financial institution's ID for this transaction: #{fid}", output
end
end
end