Project

myclear

0.0
No commit activity in last 3 years
No release in over 3 years
An unofficial simple myclear gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 5.0
~> 10.0
~> 3.0
 Project Readme

Myclear

A unofficial myclear ruby gem.

Myclear official document: https://fpxexchange.myclear.org.my:8443/MerchantIntegrationKit/

note:Password is required when accessing the official document, please go to Myclear for the password.

Installation

Add this line to your application's Gemfile:

gem 'myclear'

or

gem 'myclear', github: 'lanceyb/myclear'

And then execute:

$ bundle

Or install it yourself as:

$ gem install myclear

Configuration

Myclear.fpx_version = '7.0'
Myclear.seller_exchange_id = 'YOUR SELLER EXCHANGE ID'
Myclear.seller_id = 'YOUR SELLER ID'
Myclear.private_key = 'YOUR RSA PRIVATE KEY'
Myclear.fpx_certification = 'THE FPX CERTIFICATION'

# Myclear.debug_mode = true # Enable parameter check. Default is true.
# Myclear.fpx_standby_certification = 'THE STANDBY FPX CERTIFICATIO

eg:

if Rails.env.production?
  Myclear.fpx_version = '7.0'
  Myclear.seller_exchange_id = 'YOUR SELLER EXCHANGE ID'
  Myclear.seller_id = 'YOUR SELLER ID'
  Myclear.private_key = 'YOUR RSA PRIVATE KEY'
  Myclear.fpx_certification = 'THE FPX CERTIFICATION'
else
  Myclear.fpx_version = '7.0'
  Myclear.seller_exchange_id = 'EX00000000'
  Myclear.seller_id = 'SE00000000'
  Myclear.private_key = File.read(File.expand_path('./EX00000000.key', Rails.root))
  Myclear.fpx_certification = File.read(File.expand_path('./fpxuat.cer', Rails.root))
end

Service

bank list(银行列表)

Myclear::Service.bank_list_enquiry

Authorization Request(申请支付)

Myclear::Service.authorization_request_params({ARGUMENTS})

Example

Myclear::Service.authorization_request_params({
  fpx_msgToken:         '01',
  fpx_sellerExOrderNo:  'EXORDERNO0000',
  fpx_sellerTxnTime:    '20170817140102',
  fpx_sellerOrderNo:    'ORDERNO000000',
  fpx_txnCurrency:      'MYR',
  fpx_txnAmount:        '1.00',
  fpx_buyerEmail:       'test@example.com',
  fpx_buyerName:        '',
  fpx_buyerBankId:      'TEST0021',
  fpx_buyerBankBranch:  'SBI BANK A',
  fpx_buyerAccNo:       '',
  fpx_buyerId:          '',
  fpx_makerName:        '',
  fpx_buyerIban:        '',
  fpx_productDesc:      '1 goods'
})

Arugments

Key Allow Blank Description
fpx_msgToken N Indicate business model. 01 - B2C / 02 - B2B1 / 03 - B2B2
fpx_sellerExOrderNo N Unique ID generate by Exchange for each transaction originating form an Exchange. Not Supported: Ampersan (&) and Apostrophe (').
fpx_sellerTxnTime N Date and time transaction originated from Merchant. YYYYMMDDHHmmSS (in MYT).
fpx_sellerOrderNo N Order number generated by Merchant. Not Supported: Ampersan (&) and Apostrophe (').
fpx_txnCurrency N Transaction currency. Default value = MYR
fpx_txnAmount N Total amount.
fpx_buyerEmail Y Buyer email address. Allow blank.
fpx_buyerName Y Buyer name. Allow blank.
fpx_buyerBankId N Provided by FPX - ties to Bank that Buyer has an account in.
fpx_buyerBankBranch N Bank's branch code that Buyer opened his account. Not Supported: Slash(/), Ampesand(&) and Apostrophe(').
fpx_buyerAccNo Y Buyer account number
fpx_buyerId Y Buyer identification number. Not Supported: Slash(/), Ampersand(&) and Apostrophe(').
fpx_makerName Y Buyer representative (Maker) who initiate the transaction.
pfx_buyerIban Y Buyer IBAN
fpx_productDesc Y Product Description

Authorization Enquiry

Myclear::Service.authorization_enquiry({ARGUMENTS})

Example

Myclear::Service.authorization_enquiry({
  fpx_msgToken:         '01',
  fpx_sellerExOrderNo:  'EXORDERNO0000',
  fpx_sellerTxnTime:    '20170817140102',
  fpx_sellerOrderNo:    'ORDERNO000000',
  fpx_txnCurrency:      'MYR',
  fpx_txnAmount:        '1.00',
  fpx_buyerEmail:       'test@example.com',
  fpx_buyerName:        '',
  fpx_buyerBankId:      'TEST0021',
  fpx_buyerBankBranch:  'SBI BANK A',
  fpx_buyerAccNo:       '',
  fpx_buyerId:          '',
  fpx_makerName:        '',
  fpx_buyerIban:        '',
  fpx_productDesc:      '1 goods'
})

note : 请求AE接口的参数,保持与AR时一致

Arugments

Key Allow Blank Description
fpx_msgToken N Indicate business model. 01 - B2C / 02 - B2B1 / 03 - B2B2
fpx_sellerExOrderNo N Unique ID generate by Exchange for each transaction originating form an Exchange. Not Supported: Ampersan (&) and Apostrophe (').
fpx_sellerTxnTime N Date and time transaction originated from Merchant. YYYYMMDDHHmmSS (in MYT).
fpx_sellerOrderNo N Order number generated by Merchant. Not Supported: Ampersan (&) and Apostrophe (').
fpx_txnCurrency N Transaction currency. Default value = MYR
fpx_txnAmount N Total amount.
fpx_buyerEmail Y Buyer email address. Allow blank.
fpx_buyerName Y Buyer name. Allow blank.
fpx_buyerBankId N Provided by FPX - ties to Bank that Buyer has an account in.
fpx_buyerBankBranch N Bank's branch code that Buyer opened his account. Not Supported: Slash(/), Ampesand(&) and Apostrophe(').
fpx_buyerAccNo Y Buyer account number
fpx_buyerId Y Buyer identification number. Not Supported: Slash(/), Ampersand(&) and Apostrophe(').
fpx_makerName Y Buyer representative (Maker) who initiate the transaction.
pfx_buyerIban Y Buyer IBAN
fpx_productDesc Y Product Description

Verify callback(验证回调)

Myclear::Service.verify_params(params)

Contributing

Bug reports and pull requests are welcome.

Make a pull request

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Please write unit test with your code if necessary.