1
|
#!/usr/bin/ruby
|
2
|
|
3
|
require 'uri'
|
4
|
require 'net/https'
|
5
|
|
6
|
CA_CERT = "root.crt"
|
7
|
CERT = "004633__JP_u00000624_client2870.crt"
|
8
|
CERTKEY = "004633__JP_u00000624_client2870.pem"
|
9
|
KEYPASS = "zoUKB7+Fp3"
|
10
|
APIUSER = "ormaster"
|
11
|
APIKEY = "dea21f1b3236bdfcc65bbc166362c5241269dce7599c69c7dc378484ae56e66a"
|
12
|
|
13
|
|
14
|
Net::HTTP.version_1_2
|
15
|
|
16
|
|
17
|
|
18
|
https = Net::HTTP.new("demo-weborca.cloud.orcamo.jp","443")
|
19
|
https.use_ssl = true
|
20
|
https.ca_file = CA_CERT
|
21
|
https.cert = OpenSSL::X509::Certificate.new(File.read(CERT))
|
22
|
https.key = OpenSSL::PKey::RSA.new(File.read(CERTKEY),KEYPASS)
|
23
|
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
24
|
https.verify_depth = 5
|
25
|
|
26
|
https.start do
|
27
|
req = Net::HTTP::Post.new("/api/orca44/receiptdatamakev3")
|
28
|
req.body = <<-EOF
|
29
|
<data>
|
30
|
<receiptdata_makev3req type="record">
|
31
|
<Request_Number type="string">00</Request_Number>
|
32
|
<Karte_Uid type="string">94e16fd4-4664-49cf-9be0-0af44ac25d4a</Karte_Uid>
|
33
|
<Orca_Uid type="string"></Orca_Uid>
|
34
|
<Perform_Date type="string">2024-07-10</Perform_Date>
|
35
|
<Perform_Month type="string">2024-07</Perform_Month>
|
36
|
<Ac_Date type="string">2024-07-10</Ac_Date>
|
37
|
<Receipt_Mode type="string">02</Receipt_Mode>
|
38
|
<InOut type="string">O</InOut>
|
39
|
<Create_Mode type="string">Check</Create_Mode>
|
40
|
<Submission_Mode type="string">02</Submission_Mode>
|
41
|
<Check_Mode type="string">Yes</Check_Mode>
|
42
|
</receiptdata_makev3req>
|
43
|
</data>
|
44
|
EOF
|
45
|
|
46
|
req.content_type = "application/xml"
|
47
|
req.content_length = req.body.size
|
48
|
req.basic_auth(APIUSER,APIKEY)
|
49
|
|
50
|
res = https.request(req)
|
51
|
|
52
|
unless res.code == "200"
|
53
|
raise "http error:#{res.code}"
|
54
|
end
|
55
|
|
56
|
puts res.body
|
57
|
end
|