einvoice 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/docs/Tradevan E-Invoice APIs.md +171 -0
 - data/lib/einvoice/tradevan/provider.rb +2 -2
 - data/lib/einvoice/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a96f4ae906d84a08f028612f47571365a760565d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c969d5965b45cd5cef0e210e9225b8f47162aab0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: db6ad17e57979e0571562e3a7633a2e5e1e52c56bd71452d9d9fbea12176411ef4b44031f9338463a5ddbb6bdda3df72aa1f662cccae15cc16fe48871c6e3136
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 19e6e6b2860302bd964ac9fc24a8e45f34857d9b9085460388b2f60fb9bff6e74b50f59569a65360f1f60455a59b84287b101e40587f39f2f5284edf5310c08f
         
     | 
| 
         @@ -0,0 +1,171 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Tradevan E-Invoice APIs
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## Overview
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Partnership
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Authentication
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Encode and Decode
         
     | 
| 
      
 8 
     | 
    
         
            +
            * APIs
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ## Partnership
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ## Authentication
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ## Encode and Decode
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## APIs
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ### POST /DEFAULTAPI/post/issue
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            You could use this API to do
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            1. issue an new invoice
         
     | 
| 
      
 23 
     | 
    
         
            +
            2. issue an existed invoice
         
     | 
| 
      
 24 
     | 
    
         
            +
            3. issue an allowance
         
     | 
| 
      
 25 
     | 
    
         
            +
            4. issue an existed allowance
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            * issueData
         
     | 
| 
      
 30 
     | 
    
         
            +
                * type: json
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            ### POST /DEFAULTAPI/post/cancel
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            You could use this API to do
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            1. cancel an existed invoice
         
     | 
| 
      
 37 
     | 
    
         
            +
            2. cancel an allowance
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            * voidData
         
     | 
| 
      
 42 
     | 
    
         
            +
                * type: json
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ### GET /DEFAULTAPI/get/searchInvoiceByMemberId
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            * invoiceStartDate
         
     | 
| 
      
 49 
     | 
    
         
            +
                * description: begining of invoice issued date interval
         
     | 
| 
      
 50 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 51 
     | 
    
         
            +
                * require: false
         
     | 
| 
      
 52 
     | 
    
         
            +
                * format: yyyyMMdd
         
     | 
| 
      
 53 
     | 
    
         
            +
            * invoiceEndDate
         
     | 
| 
      
 54 
     | 
    
         
            +
                * description: end of invoice issued date interval
         
     | 
| 
      
 55 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 56 
     | 
    
         
            +
                * require: false
         
     | 
| 
      
 57 
     | 
    
         
            +
                * format: yyyyMMdd
         
     | 
| 
      
 58 
     | 
    
         
            +
            * companyUn
         
     | 
| 
      
 59 
     | 
    
         
            +
                * description: company universal business number(ubn) of Taiwan
         
     | 
| 
      
 60 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 61 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 62 
     | 
    
         
            +
            * memberId
         
     | 
| 
      
 63 
     | 
    
         
            +
                * description: customer's member id of your service
         
     | 
| 
      
 64 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 65 
     | 
    
         
            +
                * require: true if `sellTargetCode` and `carrierId` are empty
         
     | 
| 
      
 66 
     | 
    
         
            +
            * carrierId
         
     | 
| 
      
 67 
     | 
    
         
            +
                * description: customer's carrier id of invoices
         
     | 
| 
      
 68 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 69 
     | 
    
         
            +
                * require: true if `memberId` and `sellTargetCode` are empty
         
     | 
| 
      
 70 
     | 
    
         
            +
            * sellTargetCode
         
     | 
| 
      
 71 
     | 
    
         
            +
                * description: ?
         
     | 
| 
      
 72 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 73 
     | 
    
         
            +
                * require: true if `memberId` and `carrierId` are empty
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            ### GET /DEFAULTAPI/get/searchInvoiceDetail
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            * invoiceNumber
         
     | 
| 
      
 80 
     | 
    
         
            +
                * description: invoice number
         
     | 
| 
      
 81 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 82 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            ### GET /DEFAULTAPI/get/sendCardInfotoCust
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            * companyUn
         
     | 
| 
      
 89 
     | 
    
         
            +
                * description: company universal business number(ubn) of Taiwan
         
     | 
| 
      
 90 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 91 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 92 
     | 
    
         
            +
            * sellTargetCode
         
     | 
| 
      
 93 
     | 
    
         
            +
                * description: ?
         
     | 
| 
      
 94 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 95 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 96 
     | 
    
         
            +
            * invoiceStartYM
         
     | 
| 
      
 97 
     | 
    
         
            +
                * description: begining of invoice issued year and month interval
         
     | 
| 
      
 98 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 99 
     | 
    
         
            +
                * require: false
         
     | 
| 
      
 100 
     | 
    
         
            +
                * format: yyyyMM
         
     | 
| 
      
 101 
     | 
    
         
            +
            * invoiceEndYM
         
     | 
| 
      
 102 
     | 
    
         
            +
                * description: end of invoice issued year and month interval
         
     | 
| 
      
 103 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 104 
     | 
    
         
            +
                * require: false
         
     | 
| 
      
 105 
     | 
    
         
            +
                * format: yyyyMM
         
     | 
| 
      
 106 
     | 
    
         
            +
            * receiverEmail
         
     | 
| 
      
 107 
     | 
    
         
            +
                * description: receiver's email
         
     | 
| 
      
 108 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 109 
     | 
    
         
            +
                * require: true if `receiverMobile` is empty
         
     | 
| 
      
 110 
     | 
    
         
            +
            * receiverMobile
         
     | 
| 
      
 111 
     | 
    
         
            +
                * description: receiver's mobile
         
     | 
| 
      
 112 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 113 
     | 
    
         
            +
                * require: true if `receiverEmail` is empty
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            ### GET /DEFAULTAPI/get/getInvoiceMarkInfo
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            * companyUn
         
     | 
| 
      
 120 
     | 
    
         
            +
                * description: your company universal business number(ubn) of Taiwan
         
     | 
| 
      
 121 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 122 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 123 
     | 
    
         
            +
            * orgId
         
     | 
| 
      
 124 
     | 
    
         
            +
                * description: your orgId
         
     | 
| 
      
 125 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 126 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 127 
     | 
    
         
            +
            * uniFiedNumber
         
     | 
| 
      
 128 
     | 
    
         
            +
                * description: your company or branch ubn used to issue invoices
         
     | 
| 
      
 129 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 130 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 131 
     | 
    
         
            +
            * bookType
         
     | 
| 
      
 132 
     | 
    
         
            +
                * description: your book type
         
     | 
| 
      
 133 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 134 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 135 
     | 
    
         
            +
            * period
         
     | 
| 
      
 136 
     | 
    
         
            +
                * description: query year with or without months
         
     | 
| 
      
 137 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 138 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 139 
     | 
    
         
            +
                * format: yyyymm
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
            ### GET /DEFAULTAPI/get/getDonateUnitList
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
            * companyUn
         
     | 
| 
      
 146 
     | 
    
         
            +
                * description: company universal business number(ubn) of Taiwan
         
     | 
| 
      
 147 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 148 
     | 
    
         
            +
                * require: true
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
            ### GET /DEFAULTAPI/get/getInvoiceContent
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            #### Parameters
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
            * invoiceNumber
         
     | 
| 
      
 155 
     | 
    
         
            +
                * description: invoice number
         
     | 
| 
      
 156 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 157 
     | 
    
         
            +
                * require: true if `sellTargetCode` is empty
         
     | 
| 
      
 158 
     | 
    
         
            +
            * sellTargetCode
         
     | 
| 
      
 159 
     | 
    
         
            +
                * description: ?
         
     | 
| 
      
 160 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 161 
     | 
    
         
            +
                * require: true if `invoiceNumber` is empty
         
     | 
| 
      
 162 
     | 
    
         
            +
            * invoiceStartDate
         
     | 
| 
      
 163 
     | 
    
         
            +
                * description: begining of invoice issued date interval
         
     | 
| 
      
 164 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 165 
     | 
    
         
            +
                * require: false
         
     | 
| 
      
 166 
     | 
    
         
            +
                * format: yyyyMMdd
         
     | 
| 
      
 167 
     | 
    
         
            +
            * invoiceEndDate
         
     | 
| 
      
 168 
     | 
    
         
            +
                * description: end of invoice issued date interval
         
     | 
| 
      
 169 
     | 
    
         
            +
                * type: string
         
     | 
| 
      
 170 
     | 
    
         
            +
                * require: false
         
     | 
| 
      
 171 
     | 
    
         
            +
                * format: yyyyMMdd
         
     | 
| 
         @@ -98,7 +98,7 @@ module Einvoice 
     | 
|
| 
       98 
98 
     | 
    
         
             
                        verify: false
         
     | 
| 
       99 
99 
     | 
    
         
             
                      }
         
     | 
| 
       100 
100 
     | 
    
         
             
                    ).get do |request|
         
     | 
| 
       101 
     | 
    
         
            -
                      request.url endpoint_url || endpoint + "/DEFAULTAPI/get/ 
     | 
| 
      
 101 
     | 
    
         
            +
                      request.url endpoint_url || endpoint + "/DEFAULTAPI/get/getInvoiceMarkInfo"
         
     | 
| 
       102 
102 
     | 
    
         
             
                      request.params[:v] = encrypted_params(payload)
         
     | 
| 
       103 
103 
     | 
    
         
             
                    end.body
         
     | 
| 
       104 
104 
     | 
    
         | 
| 
         @@ -155,7 +155,7 @@ module Einvoice 
     | 
|
| 
       155 
155 
     | 
    
         
             
                    # padding with "\u0000"
         
     | 
| 
       156 
156 
     | 
    
         
             
                    q, m = content.bytesize.divmod(cipher.block_size)
         
     | 
| 
       157 
157 
     | 
    
         
             
                    content_bytes_with_padding = content.bytes.fill(0, content.bytesize..(cipher.block_size * (q + 1) - 1))
         
     | 
| 
       158 
     | 
    
         
            -
                    content = content_bytes_with_padding.pack('C*').force_encoding('utf-8') if m!= 0
         
     | 
| 
      
 158 
     | 
    
         
            +
                    content = content_bytes_with_padding.pack('C*').force_encoding('utf-8') if m!= 0 || q == 0
         
     | 
| 
       159 
159 
     | 
    
         | 
| 
       160 
160 
     | 
    
         
             
                    Base64.strict_encode64(cipher.update(content) + cipher.final)
         
     | 
| 
       161 
161 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/einvoice/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: einvoice
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - David Yun
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-04-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -222,6 +222,7 @@ files: 
     | 
|
| 
       222 
222 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       223 
223 
     | 
    
         
             
            - bin/console
         
     | 
| 
       224 
224 
     | 
    
         
             
            - bin/setup
         
     | 
| 
      
 225 
     | 
    
         
            +
            - docs/Tradevan E-Invoice APIs.md
         
     | 
| 
       225 
226 
     | 
    
         
             
            - docs/neweb.md
         
     | 
| 
       226 
227 
     | 
    
         
             
            - einvoice.gemspec
         
     | 
| 
       227 
228 
     | 
    
         
             
            - lib/einvoice.rb
         
     |