Skip to content

Commit

Permalink
Fixes + API consustency with Android lib
Browse files Browse the repository at this point in the history
  • Loading branch information
manustays committed Apr 15, 2020
1 parent ea90b4e commit b2ff193
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ aeps.config({
"secret_key": "y4aNr2cuSuaX2fCsfXMVopqvaZtx9MKHCcsF73fHxvc=",
"secret_key_timestamp": "1585999782835",
"user_code": "20810200",
"env": "development"
"environment": "uat"
});
// Configure callback URL for transaction-confirmation and for getting final result...
Expand Down
2 changes: 1 addition & 1 deletion build/aeps-gateway-lib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/basic_example.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<script src="../build/aeps-gateway-lib.js"></script>
<script src="../src/aeps-gateway-lib.js"></script>
</head>

<body>
Expand All @@ -21,7 +21,7 @@ <H2>AePS Gateway</H2>
"secret_key": "y4aNr2cuSuaX2fCsfXMVopqvaZtx9MKHCcsF73fHxvc=",
"secret_key_timestamp": "1585999782835",
"user_code": "20810200",
"env": "development"
"environment": "uat"
});

function doAeps() {
Expand Down
22 changes: 12 additions & 10 deletions src/aeps-gateway-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var EkoAEPSGateway = (function (window, document) {
*/
var _GATEWAY_URL_LIST = {
local: 'http://localhost:3004',
development: 'https://stagegateway.eko.in',
uat: 'https://stagegateway.eko.in',
production: 'https://gateway.eko.in'
};

Expand All @@ -34,7 +34,7 @@ var EkoAEPSGateway = (function (window, document) {
* @private
* @ignore
*/
var _DEFAULT_ENV = 'development';
var _DEFAULT_ENV = 'production';

/**
* AePS Gateway URL path
Expand All @@ -59,7 +59,7 @@ var EkoAEPSGateway = (function (window, document) {
// initiator_logo_url: '',
// partner_name: '',
// language: 'en',
env: _DEFAULT_ENV
environment: _DEFAULT_ENV
};


Expand Down Expand Up @@ -95,7 +95,7 @@ var EkoAEPSGateway = (function (window, document) {
var _gatewayMessageListener = function (e) {
var resp = null;
if (e &&
e.origin === _GATEWAY_URL_LIST[_config.env || _DEFAULT_ENV] &&
e.origin === _GATEWAY_URL_LIST[_config.environment || _DEFAULT_ENV] &&
e.data) {

resp = e.data.eko_gateway_response;
Expand Down Expand Up @@ -165,7 +165,7 @@ var EkoAEPSGateway = (function (window, document) {
* @param {string} options.user_code - Unique code of your user/merchant availing AePS.
* This needs to be generated while onboarding users.
* (See: https://developers.eko.in/reference#activate-service)
* @param {string} options.env - Envoirnment = "development" _(default)_ or "production"
* @param {string} options.environment - Envoirnment = "uat" or "production" _(default)_
* @param {string} [options.language="en"] - AePS popup interface language:
* - en: English (default)
* - hi: Hindi
Expand All @@ -183,7 +183,7 @@ var EkoAEPSGateway = (function (window, document) {
* "secret_key": "dCUujUywtuu86CyoHkZZzBjLUAVC365e6PLaa4UYwqM=",
* "secret_key_timestamp": "1532582133692",
* "user_code": "20810200",
* "env": "production"
* "environment": "production"
* });
*/
this.config = function (options) {
Expand Down Expand Up @@ -298,7 +298,7 @@ var EkoAEPSGateway = (function (window, document) {
response_data.action = 'go';
response_data.allow = true;
if (_popupWindow) {
_popupWindow.pm({ eko_gateway_request: response_data }, '*');
_popupWindow.postMessage({ eko_gateway_request: response_data }, '*');
}
};

Expand All @@ -318,7 +318,7 @@ var EkoAEPSGateway = (function (window, document) {
};

if (_popupWindow) {
_popupWindow.pm(data, '*');
_popupWindow.postMessage(data, '*');
}
};

Expand All @@ -328,7 +328,7 @@ var EkoAEPSGateway = (function (window, document) {
*/
this.open = function () {

var url = (_GATEWAY_URL_LIST[_config.env] || _GATEWAY_URL_LIST[_DEFAULT_ENV]) + _GATEWAY_URL_PATH;
var url = (_GATEWAY_URL_LIST[_config.environment] || _GATEWAY_URL_LIST[_DEFAULT_ENV]) + _GATEWAY_URL_PATH;
var form = doc_create('form');
var form_set_attr = form.setAttribute.bind(form);
var prop = null, input = null;
Expand All @@ -339,7 +339,9 @@ var EkoAEPSGateway = (function (window, document) {
form_set_attr('action', url);
form_set_attr('target', TAG);
_popupWindow = window.open('', TAG);
_popupWindow.pm = _popupWindow.postMessage.bind(window); // For smaller build
// if (!_popupWindow.pm) {
// _popupWindow.pm = _popupWindow.postMessage.bind(window); // For smaller build
// }

/* eslint guard-for-in: "off" */
for (prop in _config) {
Expand Down

0 comments on commit b2ff193

Please sign in to comment.