Skip to content

Appcelerator native Titanium module wrapping MastercardGateway SDK for both iOS and Android

License

Notifications You must be signed in to change notification settings

devloopsnet/Ti.MastercardGateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Appcelerator Titanium Mobile Ti.MastercardGateway

gitTio Abdullah Al-Faqeir

A proxy for Mastercard-Gateway iOS and Android sdk.

Quick Start

Get it gitTio

Download this repository and consult the Alloy Documentation on how to install it, or simply use the gitTio CLI:

$ gittio install net.devloops.mastercard.gateway

Example

The example directory contains code snippets on how to use the module.

Building

Simply run appc run -p [ios|android] --build-only which will compile and package your module.

Project Usage

Register your module with your application by editing tiapp.xml and adding your module. Example:

<modules>
  <module version="1.0.0">net.devloops.mastercard.gateway</module>
</modules>

When you run your project, the compiler will combine your module along with its dependencies and assets into the application.

Example Usage

To use your module in code, you will need to require it.

ES6+ (recommended)

import Mastercard from 'net.devloops.mastercard.gateway';
Mastercard.updateSession('{sessionId}','{apiVersion}',{});

ES5

var Mastercard = require('net.devloops.mastercard.gateway');
Mastercard.updateSession('{sessionId}','{apiVersion}',{})

Examples

  • Update Session with Card
//Please reference mastercard api documentation for other params names.
 let data = {    
   'sourceOfFunds.provided.card.nameOnCard': card.name,
   'sourceOfFunds.provided.card.number': card.number,
   'sourceOfFunds.provided.card.securityCode': card.cvv,
   'sourceOfFunds.provided.card.expiry.month': card.expiry.month,
   'sourceOfFunds.provided.card.expiry.year': card.expiry.year,
 };
 MasterCard.updateSessionWithCard(SessionId, ApiVersion, data res => {
   callback(res.success, SessionId, res);
 });
  • Update Session with Card
 let data = {
   'sessionId': SessionId,
   'apiVersion': ApiVersion,
   'nameOnCard': card.name,
   'number': card.number,
   'securityCode': card.cvv,
   'expiryMonth': card.expiry.month,
   'expiryYear': card.expiry.year,
 };
 MasterCard.updateSessionWithCard(data, res => {
   callback(res.success, SessionId, res);
 });
  • Update Session with Token
 let data = {
   'sessionId': SessionId,
   'apiVersion': ApiVersion,
   'token': '{token}',    
 };
 MasterCard.updateSessionWithToken(data, res => {
   callback(res.success, SessionId, res);
 });
  • Start 3DSecure process
MasterCard.start3DSecure({
   'html': '{html string}'
 });

Events

Name Usage
threeds_success When 3DSecure process is successful.
threeds_error When 3DSecure process fails.

Methods

Function Parameters Usage
updateSession string, string, object, callack To update session the same way the native sdk works
updateSessionWithCard object, callback To update session with the card details in a simple way
updateSessionWithToken object, callback To update session with a card token in a simple way
start3DSecure object To start 3DSecure process

Changelog

  • 1.0: Initial version

License

Copyright 2020 Devloops LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.