
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
A ruby gem for the easy integration of the Simplepay payment platform
Add this line to your application's Gemfile:
gem 'simplepayNG'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install simplepayNG
How to get started
<style>
body {
background-color: #efefef;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8" style="background-color: #ffffff; margin: 20px; padding: 20px;">
<%= simple_form_for('', url: pay_verify_path, html: {id: 'checkout_form'}) do |f| %>
<%= f.input :sp_token, as: 'hidden', input_html: {id: 'sp_token'} %>
<%= f.input :sp_amount, as: 'hidden', input_html: {id: 'sp_amount'} %>
<%= f.input :sp_status, as: 'hidden', input_html: {id: 'sp_status'} %>
<%= f.input :sp_currency, as: 'hidden', input_html: {id: 'sp_currency', value: 'NGN'} %>
<%= f.input :transaction_id, as: 'hidden', input_html: {id: 'transaction_id'} %>
<%= f.input :email, as: 'email', required: false, input_html: {id: 'email'} %>
<%= f.input :amount, input_html: {id: 'amount'} %>
<%= f.input :phone, required: false, input_html: {id: 'phone'} %>
<%= f.submit :submit, class: 'btn btn-primary btn-block', id: 'btn-checkout' %>
<% end %>
</div>
<div class="col-md-2"></div>
</div>
</div>
<script src="https://checkout.simplepay.ng/v2/simplepay.js"></script>
<script type="text/javascript">
// Use the "token" to validate the payment
function processPayment(token, paid) {
// put token, status, amount and transaction ID to be sent forward
// token, status and amount need to be passed forward
$('#sp_token').val(token);
$('#sp_status').val(paid);
$('#sp_amount').val(SimplePay.amountToLower($('#amount').val()));
$('#transaction_id').val('1234TRID');
$('#checkout_form').submit();
}
var handler = SimplePay.configure({
token: processPayment,
key: 'test_pu_demo' // put you public key here
});
$('#btn-checkout').on('click', function (e) {
e.preventDefault();
handler.open(SimplePay.CHECKOUT,
{
email: 'customer@store.com',
phone: '+23412345678',
description: 'My Test Store Checkout 123-456',
address: '31 Kade St, Abuja, Nigeria',
postal_code: '110001',
city: 'Abuja',
country: 'NG',
amount: SimplePay.amountToLower($('#amount').val()),
currency: 'NGN'
});
});
</script>
To start processing payments, first you'd have to declare your simplepay private keys, through
simple_pay_secret: "test_pr_demo"
For Example
api_key = 'test_pr_demo'
token = params['sp_token'] #Token Gotten From Form
amount = params['sp_amount'] #Amount Gotten From Form
amount_currency = params['sp_currency'] #Currency your willingg to accept
status = params['sp_status'] #Payment status
transaction_id = params['transaction_id'] #Transaction id Gotten From Form
transaction = Simplepay.new(token, amount, amount_currency, status, api_key: api_key)
token = params['sp_token'] #Token Gotten From Form
amount = params['sp_amount'] #Amount Gotten From Form
amount_currency = params['sp_currency'] #Currency your willingg to accept
status = params['sp_status'] #Payment status
transaction_id = params['transaction_id'] #Transaction id Gotten From Form
transaction = Simplepay.new(token, amount, amount_currency, status)
def verify
token = params['sp_token']
amount = params['sp_amount']
amount_currency = params['sp_currency']
status = params['sp_status']
transaction_id = params['transaction_id']
transaction = Simplepay.new(token, amount, amount_currency, status)
if transaction['success'].eql? true
respond_to do |format|
format.html { redirect_to success_path, notice: transaction['message'] }
end
else
respond_to do |format|
format.html { redirect_to failed_path, alert: transaction['message'] }
end
end
end
If a transaction is successful the response it sends is the
{response: res, message: 'Payment Completed Successfully', success: true}
{ "response": {
"id":"trans_iKdhkLxPZEaGoNodfWoEFW",
"amount":110000,
"currency":"NGN",
"captured":true,
"created":1455897064,
"customer":{
"id": "cus_NpX9DDh5qCP5FYyxobPJk8",
"email": "customer@simplepay.ng",
"phone": "+23412345678",
"address": "31 Kade St, Abuja, Nigeria",
"address_city": "Nigeria",
"address_country": "NG",
"address_state": null,
"address_postal": "110001"
},
"payment_reference": "56297034526707",
"livemode":true,
"source":{
"id":"card_xcgz3en8iyNqjrkUyuispC",
"object":"card",
"brand":"VISA",
"exp_month":12,
"exp_year":2034,
"funding":"credit",
"last4":"1111"
},
"response_code":20000
}
}
Else if it fails it sends the
{message: 'Payment could not be processed', logs: res, success: false}.to_json
Bug reports and pull requests are welcome on GitHub at https://github.com/patrickoramah/simplepayNG. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that simplepayNG demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.