SixSaferpay
⚠️ No longer maintained ⚠️
This repository is no longer actively maintained. Feel free to contact us to discuss transfer of the repo if you want to take over.
Current API Version
This gem is compatible with the SIX API version: 1.20
Installation
Add this line to your application's Gemfile:
gem 'six_saferpay'
And then execute:
$ bundle
Or install it yourself as:
$ gem install six_saferpay
Configuration
Please configure your gem:
SixSaferpay.configure do |config|
config.customer_id = YOUR_SIX_SAFERPAY_CUSTOMER_ID
config.terminal_id = YOUR_SIX_SAFERPAY_TERMINAL_ID
config.username = YOUR_SIX_SAFERPAY_USERNAME
config.password = YOUR_SIX_SAFERPAY_PASSWORD
config.success_url = YOUR_SIX_SAFERPAY_SUCCESS_URL
config.fail_url = YOUR_SIX_SAFERPAY_FAIL_URL
config.base_url = YOUR_SIX_SAFERPAY_BASE_URL
config.css_url = YOUR_SIX_SAFERPAY_CSS_URL
end
Usage
SIX Saferpay provides multiple interfaces. We give you a short introduction in the usage of the gem by showing you two examples for the initialize requests.
SIX Saferpay Payment Page
The SIX Saferpay Payment Page is a simple implementation of the payment gateway of SIX.
PaymentPage Initialize
Before we start we have to create a two basic objects. The first object is the SixSaferpay::Amount
. This object represents the value of your cart in the currency you sell your products. The second object is the SixSaferpay::Payment
. This object represents the payment a user of your shop will do. As you can see, the amount object is includes in this object.
amount = SixSaferpay::Amount.new(value: 100, currency_code: "CHF")
payment = SixSaferpay::Payment.new(amount: amount, order_id: 1234, description: 'Order #1234')
After we create those two objects, we can create the initialize object for the SIX Saferpay Payment Page.
initialize = SixSaferpay::SixPaymentPage::Initialize.new(payment: payment)
Now we can send the initialize request to the API. We can use the client object to send a post request to the API.
initialize_response = SixSaferpay::Client.post(initialize)
The client will return a response object. After an initialize request, the client will return you a initialize response object (SixSaferpay::InitializeResponse
).
If the request goes wrong the client raises a SixSaferpay::Error
Other Requests
You will find for all the other requests an predefined object. Feel free to use this according the SIX Saferpay API documentation.
SIX Saferpay Transaction
TODO
SIX Secure PayGate API
If you want to use the SIX Secure PayGate API, you have to use an other Client:
create_offer_request = SixSaferpay::SecurePayGateOffer.new(...)
create_offer_response = SixSaferpay::SecurePayGateApi::Client.new(create_offer_request)
Documentation
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/six_saferpay.
Implementation Status
SIX Payment Page
- Initialize
- Assert
SIX Transaction
- Initialize
- Authorize
- QueryPaymentMeans
- AdjustAmount
- AuthorizeDirect
- AuthorizeReferenced
- Capture
- MultipartCapture
- AssertCapture
- MultipartFinalize
- Refund
- AssertRefund
- RefundDirect
- Cancel
-
RedirectPayment(Deprecated) -
AssertRedirectPayment(Deprecated) - Inquire
SIX Secure Card Data
- Insert
- AssertInsert
- InsertDirect
- Delete
SIX Batch
- Close
SIX OmniChannel
- InsertAlias
- AcquireTransaction
Secure PayGate API
- CreateOffer
License
The gem is available as open source under the terms of the MIT License.