Single database for multiple shops
Use ActsAsTenant as Multi-tenancy for shops See below files: - app/controllers/concern/multi_tenancy.rb - app/models/application_record.rb - app/models/shop.rb An initializer can be created to control option in ActsAsTenant. config/initializers/acts_as_tenant.rb require 'acts_as_tenant/sidekiq' ActsAsTenant.configure do |config| config.require_tenant = false # true end more details: https://github.com/ErwinM/acts_as_tenant
This commit is contained in:
@@ -3,13 +3,13 @@ class KbzPay
|
||||
KBZ_PAY = 'KBZPay'
|
||||
|
||||
def self.pay(amount, receipt_no, url, key, app_id, code)
|
||||
shop = Shop.first
|
||||
shop = Shop.current_shop
|
||||
prefix = shop.shop_code
|
||||
receipt_no = "#{prefix}#{receipt_no}"
|
||||
|
||||
datetime = DateTime.now.strftime("%d%m%Y%H%M")
|
||||
kbz_app_id = app_id
|
||||
kbz_merch_code = code
|
||||
kbz_merch_code = code
|
||||
kbz_api_key = key
|
||||
kbz_provider_url = "#{url}/precreate"
|
||||
|
||||
@@ -58,17 +58,17 @@ class KbzPay
|
||||
# Rails.logger.debug result['Response']
|
||||
return false, result['Response']
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def self.query(receipt_no, current_user, url, key, app_id, code)
|
||||
shop = Shop.first
|
||||
shop = Shop.current_shop
|
||||
prefix = shop.shop_code
|
||||
receipt_no = "#{prefix}#{receipt_no}"
|
||||
amount = 0
|
||||
datetime = DateTime.now.strftime("%d%m%Y%H%M")
|
||||
kbz_app_id = app_id
|
||||
kbz_merch_code = code
|
||||
kbz_merch_code = code
|
||||
kbz_api_key = key
|
||||
kbz_provider_url = "#{url}/queryorder"
|
||||
|
||||
@@ -122,7 +122,7 @@ class KbzPay
|
||||
|
||||
# return true, "successfully paid by KBZ PAY"
|
||||
elsif result['Response']['trade_status'] == "PAY_FAILED"
|
||||
|
||||
|
||||
# return false, "pay failed by KBZ PAY"
|
||||
elsif result['Response']['trade_status'] == "WAIT_PAY"
|
||||
# return false , "Waiting to pay by KBZ PAY"
|
||||
@@ -135,4 +135,4 @@ class KbzPay
|
||||
return amount
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user