einvoice 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91eb4fa34dad822da5f4a2ef6e6e8073c10ac30a
4
- data.tar.gz: 539034a2ed9a51c6c32021ed6616e29b643202ec
3
+ metadata.gz: 40f2b2396cadfedbe87f45989db798e6b665b765
4
+ data.tar.gz: d30bebc188094a7ca72e572d207af12ba7ebd518
5
5
  SHA512:
6
- metadata.gz: 2008b2db088823286811a7e955bc57d73a4cc99ec0de838fba9ea14f23de8f3ad917634da74eef5cbb38486e522486e7fcd15dcdc2299d473436486327b9ca55
7
- data.tar.gz: 9ee1b049ad98759c6fe3a5d5216823298dcce1c2f4b13c90f5191e4b4082e6026b07a441808a487f1314ce86ffcb61b3af69acf33ffc7c16f7517029d5b0cff2
6
+ metadata.gz: 7fb5f09976f2335250f66ca18ca5edb656f154b7de20b1ea46c20ae93761b8914d04c9861ead4181f98e1d694033febbda7b28dfd8938c17d7f1f5393f43ea69
7
+ data.tar.gz: b8c38e67ca831017fc2d8416668822a860245f09a7f9fb7bb01209f67ffce0d03284f2e7ab1ea3b2299a707d2a2643cc913615817b2390ef69acdce6c75b11ae
data/.travis.yml CHANGED
@@ -1,12 +1,10 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
- before_install: gem install bundler -v 1.11.2
4
+ before_install: gem install bundler
5
5
  rvm:
6
- - 2.0.0
7
- - 2.1.0
8
- - 2.2.0
9
- - 2.3.0
6
+ - 2.2.5
7
+ - 2.3.1
10
8
  addons:
11
9
  code_climate:
12
10
  repo_token: 134e1f1cc8b60db4f2a491152c9227a6dbbfbeba5c1d05ee8b44cd78a1069f28
@@ -2,16 +2,46 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- * Partnership
6
- * Authentication
7
- * Encode and Decode
5
+ * Preparation
6
+ * Encode Request
7
+ * Decode Response
8
8
  * APIs
9
9
 
10
- ## Partnership
11
-
12
- ## Authentication
13
-
14
- ## Encode and Decode
10
+ ## Preparation
11
+
12
+ After contacting with Tradevan, you'll get
13
+
14
+ * acnt: your account name
15
+ * acntp: your account password
16
+ * key1: 1st AES encryption key
17
+ * key2: 2nd AES encryption key
18
+
19
+ ## Encode Request
20
+
21
+ * Method: POST/GET
22
+ * URL: "#{endpoint}/#{path}"
23
+ * Parameters: "#{v}"
24
+ * v: `Base64_strict.encode(AES.encrypt(key2, { acnt: "#{acnt}", acntp: "#{acntp}", api_key1: "#{encryption_of_api_value1}", api_key2: "#{encryption_of_api_value2}", ... }))`
25
+ * `AES.encrypt(key, content)`:
26
+ * mode: CBC-128
27
+ * key: use `key2` for outter encryption, use `key1` for inner value encryption
28
+ * iv: same as key
29
+ * padding: no, but you should manually pad with `"\u0000"`(character space in bytes format) to fit correct CBC block size
30
+ * encryption_of_api_value1: `Base64_strict.encode(AES.encrypt(key1, api_value1))`
31
+
32
+ ## Decode Response
33
+
34
+ * Format: JSON, i.e. `{ "Success": "Y", "Message": "#{encryption_of_message}" }`
35
+ * Success: "Y" for OK, "N" for Failure, "E" for Error
36
+ * Message:
37
+ * Plain Text when `"Success": "E"`
38
+ * Encryption Text when `"Success": "Y"` or `"Success": "N"`
39
+ * Decryption: `AES.decrypt(key2, Base64_strict.decode(response["Message"]))`
40
+ * `AES.decrypt(key, content)`:
41
+ * mode: CBC-128
42
+ * key: use `key2` for decrypt `response["Message"]` content
43
+ * iv: key
44
+ * padding: no
15
45
 
16
46
  ## APIs
17
47
 
@@ -1,3 +1,3 @@
1
1
  module Einvoice
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
@@ -30,7 +30,7 @@ module Faraday
30
30
  cipher.padding = 0
31
31
 
32
32
  decrypted = cipher.update(Base64.decode64(content)) + cipher.final
33
- JSON.load(decrypted.strip!)
33
+ JSON.load(decrypted.strip)
34
34
  end
35
35
  end
36
36
  end
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.2.3
4
+ version: 1.2.4
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-27 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday