SpreeVpago

Spree Vpago

Installation

  1. Add this extension to your Gemfile with this line:
   gem 'spree_vpago', github: '[your-github-handle]/spree_vpago'
  1. Install the gem using Bundler
   bundle install
  1. Copy & run migrations
   bundle exec rails g spree_vpago:install
  1. Restart your server

If your server was running, restart it so that it can find the assets properly.

Releasing

To release the gem:

  1. Bump new version in the file: lib/spree_vpago/version.rb, for example
   VERSION = '1.8.0-beta1'.freeze

to release 1.8.0-beta1

  1. Tag a repo with the same version, for example
   git tag 1.8.0-beta1
  1. Push the tag to the repo and github action will build and push the gem to rubygem.org

  2. Get the gem version to the project in cm-market-server.

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_vpago/factories'

Run test

rspec spec/

Required Variables

Acleda

For mobile ruby ENV['ACLEDA_MOBILE_SECRET_HASH_KEY'] For desktop ruby ENV['ACLEDA_CHECK_STATUS_PATH'] ENV['ACLEDA_CREATE_SESSION_PATH'] Payment method configuration:

Icon Name: acleda

Payway

ENV configuration:

ENV['PAYWAY_MERCHANT_PROFILE_CONTENT_TYPE'] # html, json
ENV['PAYWAY_CHECKOUT_PATH']
ENV['PAYWAY_CHECK_TRANSACTION_PATH']
ENV['PAYWAY_RETURN_CALLBACK_URL']
ENV['PAYWAY_CONTINUE_SUCCESS_CALLBACK_URL']

#pre-auth
ENV['PAYWAY_V2_PRE_AUTH_COMPLETE_PATH']
ENV['PAYWAY_V2_PRE_AUTH_CANCEL_PATH']

Payment method configuration:

HOST: https://checkout-sandbox.payway.com.kh
Payment Option: one of the [abapay, cards]
Merchant: vtenh
Api Key: xxxxx
Icon Name: one of the [payway_abapay, payway_cards]

Push Back Setting

PayWay will call POST request to return_url when transaction is completed in either form-data or json. By default, its will request with json. If you prefer to use html or form-data format, asks ABA integration team to set the following settings AKA Pushback:

# push back settings
Format: html

Make sure to set to env as well to let our system know how to handle when ABA push back.

PAYWAY_MERCHANT_PROFILE_CONTENT_TYPE="html"

Note

Most payment gateways are written in php, you might compare ruby with its php counterpart by running code in the .php file.

Handle missing info

Some payment gateway require email for payment info. So we use enviroment variable "DEFAULT_EMAIL_FOR_PAYMENT" as default email when there is no email provided.

Support Documents

Contributing

If you'd like to contribute, please take a look at the instructions for installing dependencies and crafting a good pull request.

Copyright (c) 2021 [name of extension creator], released under the New BSD License