qpay-rails 1.0.0 → 1.0.1

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: 7767296ec61fadc425f9c4f83b9645e464c79407e85e7b6b5783777601b5fd73
4
- data.tar.gz: c20862358e7e1ea2633e9185988d832c46d5d325a23a799ac180ca9a32b29ddb
3
+ metadata.gz: 357a6b71e6c57c8a9bc0d624f12a59bdce0d940c7a332380c88a1c9e55d05ce4
4
+ data.tar.gz: 693ed80c9f789557b861e1f7798d0c8b24f68d6c7a6e01f0df6a763d5eb73a5a
5
5
  SHA512:
6
- metadata.gz: 5a28a1e6d830189263d1945437578f6a3c8ea935094131120594ff176481b64cdf21026cbcc1e01bff294825727921aa60b449f11ab68e2eccc74da11d783685
7
- data.tar.gz: 6f5e9a3a5ec53f4fdcc1211c1aedbbfe828ef9919edc6da0b1fa6107a9a36a9359484c38f492e70be9770313a4326e518540c279196169a81b759b6a577df284
6
+ metadata.gz: 12d26a6b99df2eafa747ae1d3a364555d0c5f85c9506598f335958d04d4010ed41f21e1c2479f5861c579007ad347a0ec9b50a2c7badc7b5a01faa504d8eeefd
7
+ data.tar.gz: '018a9a81a9d73ec0cc822fab072d14d62e2129873e8b7881417393176a9400dfc53c62fc17b1077dfa2020eb315e14ac1bc6a52d5a714eff3464eafcf19730bc'
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # QPay Rails
2
2
 
3
+ [![Gem](https://img.shields.io/gem/v/qpay-rails)](https://rubygems.org/gems/qpay-rails)
4
+ [![CI](https://github.com/qpay-sdk/qpay-rails/actions/workflows/ci.yml/badge.svg)](https://github.com/qpay-sdk/qpay-rails/actions)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+
3
7
  QPay V2 payment integration for Rails.
4
8
 
5
9
  ## Install
@@ -33,11 +37,14 @@ invoice = client.create_simple_invoice(
33
37
 
34
38
  ## Webhook
35
39
 
40
+ QPay sends a `GET` request with `?qpay_payment_id=...` when payment is completed. The engine handles verification automatically.
41
+
36
42
  Subscribe to payment events:
37
43
 
38
44
  ```ruby
39
45
  ActiveSupport::Notifications.subscribe("payment_received.qpay") do |_name, _start, _finish, _id, payload|
40
- invoice_id = payload[:invoice_id]
46
+ payment_id = payload[:payment_id]
47
+ result = payload[:result] # QPay::PaymentDetail
41
48
  # handle payment
42
49
  end
43
50
  ```
@@ -1,31 +1,28 @@
1
1
  module QPay
2
2
  class WebhooksController < ActionController::API
3
- def create
4
- invoice_id = params[:invoice_id]
3
+ def show
4
+ payment_id = params[:qpay_payment_id]
5
5
 
6
- unless invoice_id.present?
7
- render json: { error: "Missing invoice_id" }, status: :bad_request
6
+ unless payment_id.present?
7
+ render plain: "ERROR", status: :bad_request
8
8
  return
9
9
  end
10
10
 
11
11
  begin
12
12
  client = QPay::Rails.client
13
- result = client.check_payment(
14
- object_type: "INVOICE",
15
- object_id: invoice_id
16
- )
13
+ result = client.get_payment(payment_id)
17
14
 
18
- if result.rows&.any?
15
+ if result&.payment_status == "PAID"
19
16
  ActiveSupport::Notifications.instrument("payment_received.qpay", {
20
- invoice_id: invoice_id,
17
+ payment_id: payment_id,
21
18
  result: result
22
19
  })
23
- render json: { status: "paid" }
24
- else
25
- render json: { status: "unpaid" }
26
20
  end
21
+
22
+ render plain: "SUCCESS", status: :ok
27
23
  rescue StandardError => e
28
- render json: { error: e.message }, status: :internal_server_error
24
+ ::Rails.logger.error("[QPay] Callback verification failed: #{e.message}")
25
+ render plain: "SUCCESS", status: :ok
29
26
  end
30
27
  end
31
28
  end
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  QPay::Rails::Engine.routes.draw do
2
- post "webhooks", to: "webhooks#create"
2
+ get "webhooks", to: "webhooks#show"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  module QPay
2
2
  module Rails
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qpay-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - QPay SDK
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-26 00:00:00.000000000 Z
11
+ date: 2026-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: qpay
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '7.0'
41
41
  description: Rails engine for QPay V2 payment API with view helpers and webhook support
42
- email:
42
+ email:
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
@@ -60,7 +60,7 @@ homepage: https://github.com/qpay-sdk/qpay-rails
60
60
  licenses:
61
61
  - MIT
62
62
  metadata: {}
63
- post_install_message:
63
+ post_install_message:
64
64
  rdoc_options: []
65
65
  require_paths:
66
66
  - lib
@@ -75,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.4.19
79
- signing_key:
78
+ rubygems_version: 3.0.3.1
79
+ signing_key:
80
80
  specification_version: 4
81
81
  summary: QPay V2 payment integration for Rails
82
82
  test_files: []