
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
A wrapper for the PayuLatam.com payment gateway, it include the managment of clients, plans, subscriptions and creditCards.
Add this line to your application's Gemfile:
gem 'payu_payments'
And then execute:
$ bundle
Or install it yourself as:
$ gem install payu_payments
All the clases work as a simple CRUD objects, the models also have a basic attributes validations.
To use the gem you need to set the keys available on your account
PayuPayments.config do |config|
config.api_key = "xxxxxxxxxxxxxx"
config.api_login = "xxxxxxx"
config.merchant_id = "123456"
config.account = "7890"
config.mode = "development" # or production to point to production end-point
end
To perform transactions with the API an entity representing the custormer needs to be created, this entity is de Client and can be created and updated using the PayuPayments::Client class.
@client = PayuPayments::Client.new(:fullName => "john Doe", :email => "johndoe@gmail.com")
# or
@client = PayuPayments::Client.new
@client.fullName = "john Doe"
@client.email = "johndoe@gmail.com"
@client.save
You can also retrieve clients from the API if you know it's id
@client = PayuPayments::Client.find(123)
@client.fullName = "New name"
@client.save
You can store a tokenized credit card on the gateway tekenization service by adding it to a client, in that way the credit card will be stored directly in the PCI compliant gateway and can be used to charge the client in future transactiosn without requiring to fill the credit card form again.
@client = PayuPayments::Client.find(123)
creditCard: {
name: "Sample User Name",
document: "1020304050",
number: "4242424242424242",
expMonth: "01",
expYear: "2020",
type: "VISA",
address: {
line1: "Address Name",
line2: "17 25",
line3: "Of 301",
postalCode: "00000",
city: "City Name",
state: "State Name",
country: "CO",
phone: "300300300"
}
}
credit_card = @client.add_credit_card(creditCard)
### To list the credit cards from a client
@client.credit_cards
To create a recurring payment model you need to create plans, plans describe the different ways that you can sell your suscription based products, here you describe the product how much you will charge for it an how you want to charge for it
planParams = {
plan: {
planCode: "sample-plan-code-001",
description: "Sample Plan 001",
accountId: "1",
intervalCount: "1",
interval: "MONTH",
maxPaymentsAllowed: "12",
maxPaymentAttempts: "3",
paymentAttemptsDelay: "1",
maxPendingPayments: "0",
trialDays: "30",
additionalValues: {
additionalValue: [{ name: "PLAN_VALUE",
value: "20000",
currency: "COP"
},
{
name: "PLAN_TAX",
value: "1600",
currency: "COP"
}]
}
}
}
plan = PayuPayments::Plan.new(planParams)
plan.save
# or
plan = PayuPayments::Plan.create(planParams)
Subscription will glue all together to create a subscription based products, with a suscription you will bind a client with a tokenized credit card with a plan,
PayuPayments::Subscription.create(subscription: {
quantity: "1",
installments: "1",
trialDays: "15",
customer: {
id: @client.id,
creditCards: {
creditCard: { "token": credit_card.token }
}
},
plan: { "planCode": plan.planCode }
})
# to check a client susbscriptions
@client.subscriptions
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that payu_payments 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.