No commit activity in last 3 years
No release in over 3 years
Checks integrity of Yandex.Money payment notification by comparing SHA of strigified params including a secret shared with Yandex.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 12.3
git-cop
~> 2.2
~> 0.10
~> 12.3
~> 5.0
~> 3.8
~> 0.58
 Project Readme

Yandex.Money notification validator

Gem Version Maintainability Test Coverage Build Status

Table of Contents

  • Features
  • Requirements
  • Setup
  • Usage
  • Tests
  • Credits

Features

Checks integrity of Yandex.Money payment notification by comparing SHA of strigified params including a secret shared with Yandex.

Here are the official docs for the notification service and validating notifications specifically.

Requirements

Setup

Add the following to your Gemfile:

gem "integral-yandex-money-notification_validator"

Usage

Intended to use in a Rails controller like so:

class YandexMoneyReceiptsController < ApplicationController

  def create
    secret    = "YOUR_YANDEX_MONEY_NOTIFICATIONS_SHARED_SECRET"
    validator = Integral::Yandex::Money::NotificationValidator.new(params: params, secret: secret)

    if validator.valid?
      # Do your thing here, for example create a new `YandexMoneyReceipt` record in DB
    else
      render text: validator.errors.join(". "), status: :bad_request and return
    end
  end

end

params are supposed to be an ActionController::Parameters or just a Hash.

validator.errors returns an Array of message strings — most often only 1 message, but who knows.

secret is recommended to be kept in an ENV variable, Rails credentials or elsewhere secure.

Tests

To test, run:

bundle exec rake

Credits

Developed by Sergey Pedan at Integral Design.