Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Apruve helps B2B merchants by helping manage complex business sales. The apruve gem makes it easier for merchants on Ruby-based platforms to integrate Apruve!
Add this line to your application's Gemfile:
gem 'apruve'
And then execute:
$ bundle
Or install it yourself as:
$ gem install apruve
The following snippets are based on our apruve-ruby-demo project, which is a functional demo of how a merchant can integrate Apruve.
https://github.com/apruve/apruve-ruby-demo
Have a look though our Getting Started documentation and be sure to use test.apruve.com for test accounts.
For test.apruve.com Apruve.configure('YOUR_APRUVE_API_KEY', 'test')
For app.apruve.com Apruve.configure('YOUR_APRUVE_API_KEY', 'prod')
@order = Apruve::Order.new(
merchant_id: your_merchant_id,
currency: 'USD',
amount_cents: 6000,
shipping_cents: 500
)
@order.order_items << Apruve::OrderItem.new(
title: 'Letter Paper',
description: '20 lb ream (500 Sheets). Paper dimensions are 8.5 x 11.00 inches.',
sku: 'LTR-20R',
price_ea_cents: 1200,
quantity: 3,
price_total_cents: 3600,
view_product_url: 'https://www.example.com/letter-paper'
)
(example in ERB...)
At the top of the file, import the apruve.js script.
<%= Apruve.js %>
Write a little Javascript to configure apruve.js
apruve.setOrder(<%= @order.to_json %>, '<%= @order.secure_hash %>');
apruve.registerApruveCallback(apruve.APRUVE_COMPLETE_EVENT, function (orderId) {
$('#orderId').val(orderId)
$('#finishOrder').submit();
});
Decide where to put the Apruve button
<%= Apruve.button %>
Use the orderId to issue an Invoice
apruve_invoice = Apruve::Invoice.new(order_id: params[:order_id], amount_cents: params[:charge], issue_on_create: true)
apruve_invoice.save!
Save the status and the invoice ID with the payment in your database
# dependent on your system, but something like this...
my_invoice.apruve_invoice_id = apruve_invoice.id
my_invoice.apruve_invoice_status = apruve_payment.status
my_invoice.save!
(optional) If you track orders separately from payments, save the orderId with your order in your database
# dependent on your system, but something like this...
my_order.apruve_order_id = params[:order_id]
my_order.save
# dependent on your system, but if you use Sinatra, it might look something like this...
post '/webhook_notify' do
# We got a webhook. You should look up the order in your database and complete or cancel it as appropriate.
puts "GOT WEBHOOK DATA FOR INVOICE #{@webhook_data}"
my_invoice.find_by(apruve_invoice_id: @webhook_data[:invoice_id])
my_invoice.apruve_payment_status = @webhook_data[:status]
if my_invoice.apruve_invoice_status == 'closed'
my_invoice.complete_order
elsif my_invoice.apruve_invoice_status == 'canceled'
my_invoice.cancel_order
end
end
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that apruve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.