@databank.mn/pass_mtx_rtn_module

0.0.11 • Public • Published

Pass Micro Transaction package of React Native

https://developer.pass.mn/

Platform Support

Android iOS
✔️ ✔️

🔨 Installation

$ npm install -g @databank.mn/pass_mtx_rtn_module

⚙ IOS Setup

$ RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

⚙ Android Setup

1. Open the android/gradle.properties file
2. Scroll down to the end of the file and switch the newArchEnabled property from false to true.

🔨 Turbo Native module documentation

Documentation: https://reactnative.dev/docs/next/the-new-architecture/pillars-turbomodules

⚙ Import

import PassMtxRTN from '@databank.mn/pass_mtx_rtn_module/js/NativePassMtx';

⚙ Initialization key config

After import package you need to create keys.json file in same directory in package.json and put below json in it. That fields are used to initialize pass mtx rtn library and used to make purchase through pass gateway safely.

{
    "name": "<your org name>",
    "app_id": "<you app id>",
    "app_user_id": "<your app user id>",
    "client_id": "<client id from databank>",
    "private_key": "<private key from databank>",
    "public_key": "<public key from databank>",
    "pos_ids": [
      "<allowed terminal id list>"
    ]
}

🕹️ Usage/Example

Initialization & Check connection

Development purpose you can use passStageInit function for select environment of PASS Purchase or other methods. When development done, change it to passInit.

  const keys = require('./keys.json')

  // Initialize For Staging ENV using AppID ClientID, PrivateKey, PublicKey,
  passStageInit(String appId, String clientId, String privatePem, String publicPem);

  // Initialize For Production ENV using AppID ClientID, PrivateKey, PublicKey,
  passInit(String appId, String clientId, String privatePem, String publicPem);

  // Get Pass API Status
  getPassPing();

  // Get Pass Version Info
  getPassVersion();

  // Initialization example using release mode
  var passInitResult = await PassMtxRTN?.passInit(keys.app_id, keys.client_id, keys.private_key, keys.public_key) ??
        'Unknown platform version';
  
  // Initialization example using debug mode
  var passStageInitResult =
        await PassMtxRTN?.passStageInit(keys.app_id, keys.client_id, keys.private_key, keys.public_key) ??
            'Unknown platform version';

Card Methods

Included methods of Card registration and Get card lists you added in PASS wallet or delete it.

  // Get card token by UserID
  getCard(String userId);

  // Saving user card info
  saveCard(String userId, String szPan, String cvv, String expDate, String cardHolderName);
  
  // Verify Card
  verifyCard(String userId, String verificationMethod, String verificationValue)

  // Delete User card
  deleteCard(String userId, String cardRef);

  // Set Default card
  setDefaultCard(String userId, String cardRef);

Purchase

Direct Purchase

Pass MTX RTN included micro transaction method makePassPurchase. paymentAmount field need to multiple by 100 for original amount. If user enters 1000 in TextEditor, multiply it 1000 * 100 than send it through paymentAmount field. HEY PASS ME...

  // Make Pass Purchase
  purchase( String userId, String orderId, String paymentToken, String paymentAmount, String expDate, String dbRefNo, String description)

  // Make Purchase Example
  var convertedAmount = (parseInt(amount) * 100).toString();
  var orderId = 'INAPPV1' + Date.now().toString();
  var dbRefNo = 'DTB' + Date.now().toString();
  var description = paymentDescription ?? 'rtn inapp purchase direct test';
  var response = PassMtxRTN?.purchase(
    keys.app_user_id,
    orderId,
    paymentToken,
    convertedAmount,
    expiryDate,
    dbRefNo,
    description,
  );

Customer Presented Mode Purchase

  // Inquiry the presented qr scanned by scanner and get process of payment
  orderEnquery(String userId, String orderId)

  // Optional: When amount above under CVM limit
  orderConfirm(
      String userId,
      String orderId,
      String confirmMethod,
      String confirmResult,
      String payToken,
      String expDate)

  // Cancel order by user
  orderCancel(String userId, String orderId)

📃 License

/*
#################################################################################
#                                                                               #
#                     COPYRIGHT (C) DATABANK LLC since 2017                     #
#                                                                               #
#          ALL RIGHTS RESERVED BY DATABANK LLC.  THIS PROGRAM MUST BE           #
#          USED SOLELY FOR THE PURPOSES OF DATABANK LLC AND ITS USERS.          #
#   NO PART OF THIS PROGRAM MAY BE MODIFIED IN SOURCE OR BINARY FORM BY OTHERS  #
#             WITHOUT THE PRIOR WRITTEN PERMISSION OF DATABANK LLC.             #
#                                                                               #
#     USE OF COPYRIGHT NOTICE DOES NOT EVIDENCE PUBLICATION OF THE PROGRAM.     #
#                                                                               #
#################################################################################
*/

Package Sidebar

Install

npm i @databank.mn/pass_mtx_rtn_module

Weekly Downloads

2

Version

0.0.11

License

SEE LICENSE IN <LICENSE>

Unpacked Size

52.2 MB

Total Files

17

Last publish

Collaborators

  • l.ankhbayar
  • saikhanzaya