Module: UnionPay

Defined in:
lib/unionpay.rb,
lib/unionpay/conf.rb,
lib/unionpay/utils.rb,
lib/unionpay/service.rb,
lib/unionpay/version.rb

Defined Under Namespace

Classes: Service

Constant Summary collapse

VERIFY_HTTPS_CERT =
false
Timezone =

时区

"Asia/Shanghai"
Sign_method =

摘要算法,目前仅支持md5 (2011-08-22)

"md5"
PayParams =

支付请求预定义字段

{
  'version' => '1.0.0',
  'charset' => 'UTF-8', #UTF-8, GBK等
  'merId'   => '88888888', #商户填写
  'acqCode' => '', #收单机构填写
  'merCode' => '', #收单机构填写
  'merAbbr' => '商户名称'
}
FRONT_PAY =
1
BACK_PAY =
2
RESPONSE =
3
QUERY =
4
CONSUME =
"01"
CONSUME_VOID =
"31"
PRE_AUTH =
"02"
PRE_AUTH_VOID =
"32"
PRE_AUTH_COMPLETE =
"03"
PRE_AUTH_VOID_COMPLETE =
"33"
REFUND =
"04"
REGISTRATION =
"71"
CURRENCY_CNY =
"156"
PayParamsEmpty =

支付请求可为空字段(但必须填写)

{
  "origQid" => "",
  "acqCode" => "",
  "merCode" => "",
  "commodityUrl" => "",
  "commodityName" => "",
  "commodityUnitPrice" => "",
  "commodityQuantity" => "",
  "commodityDiscount" => "",
  "transferFee" => "",
  "customerName" => "",
  "defaultPayType" => "",
  "defaultBankNumber" => "",
  "transTimeout" => "",
  "merReserved" => ""
}
PayParamsCheck =

支付请求必填字段检查

[
  "version",
  "charset",
  "transType",
  "origQid",
  "merId",
  "merAbbr",
  "acqCode",
  "merCode",
  "commodityUrl",
  "commodityName",
  "commodityUnitPrice",
  "commodityQuantity",
  "commodityDiscount",
  "transferFee",
  "orderNumber",
  "orderAmount",
  "orderCurrency",
  "orderTime",
  "customerIp",
  "customerName",
  "defaultPayType",
  "defaultBankNumber",
  "transTimeout",
  "frontEndUrl",
  "backEndUrl",
  "merReserved"
]
QueryParamsCheck =

查询请求必填字段检查

[
  "version",
  "charset",
  "transType",
  "merId",
  "orderNumber",
  "orderTime",
  "merReserved",
]
MerParamsReserved =

商户保留域可能包含的字段

[
  #  NEW NAME            OLD NAME
  "cardNumber", "pan",
  "cardPasswd", "password",
  "credentialType", "idType",
  "cardCvn2", "cvn",
  "cardExpire", "expire",
  "credentialNumber", "idNo",
  "credentialName", "name",
  "phoneNumber", "mobile",
  "merAbstract",

  #  tdb only
  "orderTimeoutDate",
  "origOrderNumber",
  "origOrderTime",
]
NotifyParamCheck =
[
  "version",
  "charset",
  "transType",
  "respCode",
  "respMsg",
  "respTime",
  "merId",
  "merAbbr",
  "orderNumber",
  "traceNumber",
  "traceTime",
  "qid",
  "orderAmount",
  "orderCurrency",
  "settleAmount",
  "settleCurrency",
  "settleDate",
  "exchangeRate",
  "exchangeDate",
  "cupReserved",
  "signMethod",
  "signature",
]
SignIgnoreParams =
[
  "bank",
]
RESP_SUCCESS =

返回成功

'00'
QUERY_SUCCESS =

查询成功

'0'
QUERY_FAIL =
'1'
QUERY_WAIT =
'2'
QUERY_INVALID =
'3'
VERSION =
"0.0.9"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.back_pay_urlObject

Returns the value of attribute back_pay_url.



4
5
6
# File 'lib/unionpay/conf.rb', line 4

def back_pay_url
  @back_pay_url
end

.environmentObject

Returns the value of attribute environment.



8
9
10
# File 'lib/unionpay.rb', line 8

def environment
  @environment
end

.front_pay_urlObject

Returns the value of attribute front_pay_url.



4
5
6
# File 'lib/unionpay/conf.rb', line 4

def front_pay_url
  @front_pay_url
end

.mer_abbrObject

Returns the value of attribute mer_abbr.



8
9
10
# File 'lib/unionpay.rb', line 8

def mer_abbr
  @mer_abbr
end

.mer_idObject

Returns the value of attribute mer_id.



8
9
10
# File 'lib/unionpay.rb', line 8

def mer_id
  @mer_id
end

.query_urlObject

Returns the value of attribute query_url.



4
5
6
# File 'lib/unionpay/conf.rb', line 4

def query_url
  @query_url
end

.security_keyObject

Returns the value of attribute security_key.



8
9
10
# File 'lib/unionpay.rb', line 8

def security_key
  @security_key
end

Class Method Details

.empty?(str) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/unionpay/utils.rb', line 3

def empty? str
  str !~ /[^[:space:]]/
end