зеркало из
https://github.com/glebtv/yookassa.git
synced 2026-09-04 02:05:51 +03:00
Add Rails webhook engine, docs, and dependency refresh
Этот коммит содержится в:
@@ -7,6 +7,7 @@ require "yookassa/config"
|
||||
require "yookassa/payments"
|
||||
require "yookassa/refunds"
|
||||
require "yookassa/receipts"
|
||||
require "yookassa/webhooks"
|
||||
|
||||
module Yookassa
|
||||
class << self
|
||||
@@ -31,5 +32,11 @@ module Yookassa
|
||||
def receipts
|
||||
@receipts ||= Receipts.new
|
||||
end
|
||||
|
||||
def webhooks
|
||||
@webhooks ||= Webhooks.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require "yookassa/railtie" if defined?(Rails::Railtie)
|
||||
|
||||
@@ -2,6 +2,21 @@
|
||||
|
||||
module Yookassa
|
||||
class Config
|
||||
attr_accessor :shop_id, :api_key
|
||||
# Source: https://yookassa.ru/developers/using-api/webhooks#ip
|
||||
DEFAULT_WEBHOOK_ALLOWED_IPS = [
|
||||
"185.71.76.0/27",
|
||||
"185.71.77.0/27",
|
||||
"77.75.153.0/25",
|
||||
"77.75.156.11",
|
||||
"77.75.156.35",
|
||||
"77.75.154.128/25",
|
||||
"2a02:5180::/32"
|
||||
].freeze
|
||||
|
||||
attr_accessor :shop_id, :api_key, :webhook_token, :webhook_allowed_ips
|
||||
|
||||
def initialize
|
||||
@webhook_allowed_ips = DEFAULT_WEBHOOK_ALLOWED_IPS.dup
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
7
lib/yookassa/engine.rb
Обычный файл
7
lib/yookassa/engine.rb
Обычный файл
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Yookassa
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace Yookassa
|
||||
end
|
||||
end
|
||||
8
lib/yookassa/railtie.rb
Обычный файл
8
lib/yookassa/railtie.rb
Обычный файл
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "yookassa/engine"
|
||||
|
||||
module Yookassa
|
||||
class Railtie < ::Rails::Railtie
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Yookassa
|
||||
VERSION = "0.2.0"
|
||||
VERSION = "0.2.1"
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user