weborcacloud_demo_u00000624_02.rb

金 基鐘, 2024/07/22 15:21

다운로드 (1.836 KB)

 
1
#!/usr/bin/ruby
2
# coding:utf-8
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
#https = Net::HTTP.new("weborca.cloud.orcamo.jp","443")
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

30
<data>
31
        <receiptdata_makev3req type="record">
32
                <Request_Number type="string">02</Request_Number>
33
                <Karte_Uid type="string">94e16fd4-4664-49cf-9be0-0af44ac25d4a</Karte_Uid>
34
                <Orca_Uid type="string">b724dbe3-9537-4ffa-8ca3-532ccf3929f3</Orca_Uid>
35
                <Perform_Date type="string">2024-07-11</Perform_Date>
36
                <Perform_Month type="string">2024-07</Perform_Month>
37
                <Ac_Date type="string">2024-07-11</Ac_Date>
38
                <Receipt_Mode type="string">02</Receipt_Mode>
39
                <InOut type="string">O</InOut>
40
                <Create_Mode type="string">Check</Create_Mode>
41
                <Submission_Mode type="string">02</Submission_Mode>
42
                <Check_Mode type="string">Yes</Check_Mode>
43
        </receiptdata_makev3req>
44
</data>
45

46
  EOF
47

    
48
  req.content_type = "application/xml"
49
  req.content_length = req.body.size
50
  req.basic_auth(APIUSER,APIKEY)
51

    
52
  res = https.request(req)
53

    
54
  unless res.code == "200"
55
   raise "http error:#{res.code}"
56
  end
57

    
58
  puts res.body
59
end
클립보드 이미지 추가 (최대 크기: 50 MB)