thai_qr_pay 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10ad6dfb66ac4d72976350536d490f9b342d04de47a592ad41620d8ad89c6e4e
4
- data.tar.gz: b1f04737a1e41e736a109fd82a5a1921fc7cd0c191c3bfce632df7eb56953d20
3
+ metadata.gz: 828bc541d1777d62f81d272d8da35181725baaebc3f574ca4d4b4a0db45685c4
4
+ data.tar.gz: 7884145360ea3e7b7cb069b3c5a028f766dadedf6cb903e8eefaf4122a573dd1
5
5
  SHA512:
6
- metadata.gz: b1a848f79452f2c9adb643c88af872a599900445a6023c3e4174e0d2dde48603e7699043696c46ebfa985036f510a1225053496f22814bc3df935f14a08e2369
7
- data.tar.gz: dc8aa130c9389eca193eeebeeb9368cf0b6dc9daa090b1504e36b989256d1e8a186a194cf0c85000b19c8ff54aa523918c5f2e24c9a5a32acfe8bef3bf1cfbd9
6
+ metadata.gz: fac8a555db8d8abc8de436fcedd38894914d369ba25d2688144e1b7b9694c15a01acbd862983617878d7a2f87db6439d60962cf1b28ae0d9918b553ddcb043ff
7
+ data.tar.gz: 50fbc9afbc67f268598d07b527e4031447f6961171c934a8443eb4a639de6328ad1b60a223c3f571f5190b1de37cbce2006fb0bf5ea600736e50804db3b08803
data/README.md CHANGED
@@ -23,7 +23,6 @@ Ruby Gem สำหรับการชำระเงินผ่าน QR ต
23
23
 
24
24
  ## Installation / การติดตั้ง
25
25
 
26
-
27
26
  ```bash
28
27
  gem install thai_qr_pay
29
28
  ````
@@ -38,10 +37,9 @@ require 'thai_qr_pay'
38
37
 
39
38
  ### 1. Parsing a QR payload / วิเคราะห์ QR payload
40
39
 
41
-
42
40
  ```ruby
43
41
  qr_string = '000201010212...6304ABCD'
44
- parser = ThaiQrPay::Parser.new(qr_string, strict: true)
42
+ parser = ThaiQrPay::Parser.new(qr_string, strict: true)
45
43
 
46
44
  puts parser.get_tag_value('00') # => '01'
47
45
  puts parser.get_tag_value('29', '01') # nested sub-tag
@@ -60,13 +58,10 @@ payload = ThaiQrPay::Generate::Promptpay::AnyID.payload(
60
58
  # => "00020101021229...6304XXXX"
61
59
  ```
62
60
 
63
-
64
-
65
61
  ---
66
62
 
67
63
  ### 3. Generating PromptPay Bill Payment / สร้าง PromptPay Bill Payment
68
64
 
69
-
70
65
  ```ruby
71
66
  payload = ThaiQrPay::Generate::Promptpay::BillPayment.payload(
72
67
  biller_id: '1234567890123',
@@ -75,23 +70,20 @@ payload = ThaiQrPay::Generate::Promptpay::BillPayment.payload(
75
70
  )
76
71
  ```
77
72
 
78
-
79
73
  ---
80
74
 
81
75
  ### 4. Converting BOT Barcode → QR Tag 30 / แปลง BOT Barcode เป็น QR Tag 30
82
76
 
83
-
84
77
  ```ruby
85
- raw = "|1234567890123\rINV001\r\r012345"
86
- bot = ThaiQrPay::BOTBarcode.from_string(raw)
87
- qr_tag30 = bot.to_qr_tag30
78
+ raw = "|1234567890123\rINV001\r\r012345"
79
+ bot = ThaiQrPay::BOTBarcode.from_string(raw)
80
+ qr_tag = bot.to_qr_tag30
88
81
  ```
89
82
 
90
83
  ---
91
84
 
92
85
  ### 5. Validating Slip Verify / ตรวจสอบ Slip-verify
93
86
 
94
-
95
87
  ```ruby
96
88
  result = ThaiQrPay::Validate::SlipVerify.call(qr_string)
97
89
  if result
@@ -117,6 +109,45 @@ else
117
109
  end
118
110
  ```
119
111
 
112
+ ---
113
+
114
+ ### 7. Generating Slip-Verify QR / สร้าง QR สำหรับ Slip-verify
115
+
116
+ ```ruby
117
+ payload = ThaiQrPay::Generate::SlipVerify.payload(
118
+ sending_bank: 'KBank',
119
+ trans_ref: 'REF12345'
120
+ )
121
+ # => "0004...5102TH...9104XXXX"
122
+ ```
123
+
124
+ ---
125
+
126
+ ### 8. Generating TrueMoney Payment QR / สร้าง QR สำหรับ TrueMoney
127
+
128
+ ```ruby
129
+ payload = ThaiQrPay::Generate::TrueMoney.payload(
130
+ mobile_no: '0812345678',
131
+ amount: 150.0,
132
+ message: 'สวัสดี'
133
+ )
134
+ # => "00020101...2920A000000677010111031514000081234567853037645802TH5406150.008112...6304XXXX"
135
+ ```
136
+
137
+ ---
138
+
139
+ ### 9. Generating TrueMoney Slip-Verify QR / สร้าง QR สำหรับ TrueMoney Slip-verify
140
+
141
+ ```ruby
142
+ payload = ThaiQrPay::Generate::TrueMoneySlipVerify.payload(
143
+ event_type: 'PAYMENT',
144
+ transaction_id: 'TX123456',
145
+ date: '20250615'
146
+ )
147
+ # => "0005...000101010402PAYMENT0308TX1234560408202506159104XXXX"
148
+ ```
149
+
150
+ ---
120
151
 
121
152
  ## License
122
153
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ThaiQrPay
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
data/lib/thai_qr_pay.rb CHANGED
@@ -6,6 +6,9 @@ require 'thai_qr_pay/crc16'
6
6
  require 'thai_qr_pay/parser'
7
7
  require 'thai_qr_pay/generate/promptpay/any_id'
8
8
  require 'thai_qr_pay/generate/promptpay/bill_payment'
9
+ require 'thai_qr_pay/generate/slip_verify'
10
+ require 'thai_qr_pay/generate/true_money'
11
+ require 'thai_qr_pay/generate/true_money_slip_verify'
9
12
  require 'thai_qr_pay/bot_barcode'
10
13
  require 'thai_qr_pay/validate/slip_verify'
11
14
  require 'thai_qr_pay/validate/true_money_slip_verify'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thai_qr_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chayut Orapinpatipat