lib/reapal/http/communicate.rb in reapal-0.1.0 vs lib/reapal/http/communicate.rb in reapal-0.2.0
- old
+ new
@@ -45,12 +45,11 @@
Reapal.logger.info "[#{service}] 返回结果为:\n#{result}\n\n"
result
end
- private
-
+ # 表单的 body
def self.get_body(service, params, config)
data = {
version: VERSION,
service: service,
partner: config[:partner_id],
@@ -64,9 +63,11 @@
merchant_id: config[:merchant_id],
encryptkey: Encrypt::RSA.encrypt(random_key, config[:public_key]),
data: Encrypt::AES.encrypt(data.to_json, random_key),
}
end
+
+ private
def self.unpack_body(body_string, config)
# 返回是 json 字符串格式
body = Utils.symbolize_keys(JSON.parse(body_string))