display qr code on second screen on qrpay
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
require 'rqrcode'
|
||||
|
||||
def init
|
||||
@cash_exist = PaymentMethodSetting.cash_exist
|
||||
@credit_exist = PaymentMethodSetting.credit_exist
|
||||
@@ -210,6 +212,34 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
@giftvouchercount += spay.payment_amount
|
||||
end
|
||||
end
|
||||
|
||||
qr_str = "00020101021226480015com.mmqrpay.www0115223743000377032020600000052045814530310454075000.005802MM5908Code2LAB6006Yangon61051101062730125ORDER_1747826957_5ae9cb900523MMQR1075L175919500000010813PAY_BY_QRCODE64300002MY0109ကုဒ်တူလက်0207ရန်ကုန်6304AD40";
|
||||
@string_to_encode = qr_str
|
||||
|
||||
qrcode = RQRCode::QRCode.new(@string_to_encode)
|
||||
|
||||
@qr_svg = qrcode.as_svg(
|
||||
color: "000", # Hex color for the QR code modules (black)
|
||||
shape_rendering: "crispEdges", # Renders sharp edges
|
||||
module_size: 2, # Size of each module (dot/square)
|
||||
standalone: true, # Outputs a complete SVG document
|
||||
use_path: true # Modern SVG path rendering
|
||||
)
|
||||
|
||||
png_data = qrcode.as_png(
|
||||
bit_depth: 1,
|
||||
border_modules: 4,
|
||||
color_mode: ChunkyPNG::COLOR_GRAYSCALE,
|
||||
color: 'black',
|
||||
file: nil,
|
||||
fill: 'white',
|
||||
module_px_size: 8, # Pixel size of each module
|
||||
resize_exactly_to: false,
|
||||
resize_gte_to: false,
|
||||
size: 240 # Approximate size of the image in pixels (e.g., 240x240)
|
||||
).to_s
|
||||
|
||||
ActionCable.server.broadcast('second_display_view_channel', { data: qr_str, qr_svg: @qr_svg })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user