Module: WechatPayment
- Defined in:
- lib/wechat_payment.rb,
lib/wechat_payment/sign.rb,
lib/wechat_payment/client.rb,
lib/wechat_payment/engine.rb,
lib/wechat_payment/version.rb,
lib/wechat_payment/concern/user.rb,
lib/wechat_payment/concern/goods.rb,
lib/wechat_payment/invoke_result.rb,
lib/wechat_payment/service_result.rb,
app/services/wechat_payment/service.rb,
lib/wechat_payment/missing_key_error.rb,
lib/wechat_payment/concern/user_goods.rb,
app/models/wechat_payment/refund_order.rb,
app/jobs/wechat_payment/application_job.rb,
app/models/wechat_payment/payment_order.rb,
app/models/wechat_payment/application_record.rb,
app/helpers/wechat_payment/application_helper.rb,
app/mailers/wechat_payment/application_mailer.rb,
app/controllers/wechat_payment/callback_controller.rb,
app/controllers/wechat_payment/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper, Concern, Sign Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, CallbackController, Client, Engine, FailureResult, GoodsGenerator, InstallGenerator, InvokeResult, Logger, MissingKeyError, PaymentLogger, PaymentOrder, PaymentOrdersController, RefundLogger, RefundOrder, RoutesGenerator, Service, ServiceResult, SuccessResult
Constant Summary collapse
- VERSION =
'2.1.3'
Class Attribute Summary collapse
-
.apiclient_cert ⇒ Object
readonly
Returns the value of attribute apiclient_cert.
-
.apiclient_key ⇒ Object
readonly
Returns the value of attribute apiclient_key.
-
.app_secret ⇒ Object
Returns the value of attribute app_secret.
-
.appid ⇒ Object
Returns the value of attribute appid.
-
.cert_path ⇒ Object
Returns the value of attribute cert_path.
-
.host ⇒ Object
Returns the value of attribute host.
-
.key ⇒ Object
Returns the value of attribute key.
-
.mch_id ⇒ Object
Returns the value of attribute mch_id.
-
.order_no_prefix ⇒ Object
Returns the value of attribute order_no_prefix.
-
.sub_app_secret ⇒ Object
Returns the value of attribute sub_app_secret.
-
.sub_appid ⇒ Object
Returns the value of attribute sub_appid.
-
.sub_mch_id ⇒ Object
Returns the value of attribute sub_mch_id.
Class Method Summary collapse
- .as_payment_params ⇒ Object
- .set_apiclient_by_pkcs12(str, pass) ⇒ Object
- .setup {|_self| ... } ⇒ Object
Instance Method Summary collapse
Class Attribute Details
.apiclient_cert ⇒ Object (readonly)
Returns the value of attribute apiclient_cert.
7 8 9 |
# File 'lib/wechat_payment.rb', line 7 def apiclient_cert @apiclient_cert end |
.apiclient_key ⇒ Object (readonly)
Returns the value of attribute apiclient_key.
7 8 9 |
# File 'lib/wechat_payment.rb', line 7 def apiclient_key @apiclient_key end |
.app_secret ⇒ Object
Returns the value of attribute app_secret.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def app_secret @app_secret end |
.appid ⇒ Object
Returns the value of attribute appid.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def appid @appid end |
.cert_path ⇒ Object
Returns the value of attribute cert_path.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def cert_path @cert_path end |
.host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def host @host end |
.key ⇒ Object
Returns the value of attribute key.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def key @key end |
.mch_id ⇒ Object
Returns the value of attribute mch_id.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def mch_id @mch_id end |
.order_no_prefix ⇒ Object
Returns the value of attribute order_no_prefix.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def order_no_prefix @order_no_prefix end |
.sub_app_secret ⇒ Object
Returns the value of attribute sub_app_secret.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def sub_app_secret @sub_app_secret end |
.sub_appid ⇒ Object
Returns the value of attribute sub_appid.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def sub_appid @sub_appid end |
.sub_mch_id ⇒ Object
Returns the value of attribute sub_mch_id.
8 9 10 |
# File 'lib/wechat_payment.rb', line 8 def sub_mch_id @sub_mch_id end |
Class Method Details
.as_payment_params ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/wechat_payment.rb', line 35 def self.as_payment_params { appid: appid, mch_id: mch_id, sub_appid: sub_appid, sub_mch_id: sub_mch_id } end |
.set_apiclient_by_pkcs12(str, pass) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/wechat_payment.rb', line 19 def self.set_apiclient_by_pkcs12(str, pass) pkcs12 = OpenSSL::PKCS12.new(str, pass) @apiclient_cert = pkcs12.certificate @apiclient_key = pkcs12.key pkcs12 end |
.setup {|_self| ... } ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/wechat_payment.rb', line 11 def self.setup yield self if block_given? if cert_path set_apiclient_by_pkcs12(File.binread(cert_path), mch_id) end end |
Instance Method Details
#apiclient_cert=(cert) ⇒ Object
27 28 29 |
# File 'lib/wechat_payment.rb', line 27 def apiclient_cert=(cert) @apiclient_cert = OpenSSL::X509::Certificate.new(cert) end |
#apiclient_key=(key) ⇒ Object
31 32 33 |
# File 'lib/wechat_payment.rb', line 31 def apiclient_key=(key) @apiclient_key = OpenSSL::PKey::RSA.new(key) end |