diff --git a/app/code/community/Hps/Transit/Block/Form.php b/app/code/community/Hps/Transit/Block/Form.php
index a251012..ffdcf71 100644
--- a/app/code/community/Hps/Transit/Block/Form.php
+++ b/app/code/community/Hps/Transit/Block/Form.php
@@ -20,12 +20,12 @@ protected function _construct()
public function getCredentials()
{
- Mage::helper('hps_transit/data')->configureSDK();
+ Mage::helper('hps_transit/data')->configureSDK(true);
$manifest = ServicesContainer::instance()->getClient()->createManifest();
return json_encode([
- 'deviceId' => $this->getConfig('device_id'),
+ 'deviceId' => $this->getConfig('device_id_tsep'),
'manifest' => $manifest,
'env' => $this->getConfig('is_production') ? 'production' : 'sandbox',
]);
diff --git a/app/code/community/Hps/Transit/Helper/Data.php b/app/code/community/Hps/Transit/Helper/Data.php
index 69a0f39..67bd4e5 100644
--- a/app/code/community/Hps/Transit/Helper/Data.php
+++ b/app/code/community/Hps/Transit/Helper/Data.php
@@ -3,6 +3,7 @@
use GlobalPayments\Api\AcceptorConfig;
use GlobalPayments\Api\ServicesConfig;
use GlobalPayments\Api\ServicesContainer;
+use GlobalPayments\Api\Entities\Enums\CardDataSource;
use GlobalPayments\Api\Entities\Enums\Environment;
use GlobalPayments\Api\Entities\Enums\GatewayProvider;
@@ -18,8 +19,8 @@ class Hps_Transit_Helper_Data extends Mage_Core_Helper_Abstract
const XML_PATH_PAYMENT_HPS_SECURESUBMIT_HTTP_PROXY_HOST = 'payment/hps_transit/http_proxy_host';
const XML_PATH_PAYMENT_HPS_SECURESUBMIT_HTTP_PROXY_PORT = 'payment/hps_transit/http_proxy_port';
const CONFIG_FORMAT = 'payment/hps_transit/%s';
-
- public function configureSDK()
+
+ public function configureSDK($isTsep = false)
{
$config = new ServicesConfig();
@@ -27,7 +28,7 @@ public function configureSDK()
'merchantId' => 'merchant_id',
'username' => 'user_id',
'password' => 'password',
- 'deviceId' => 'device_id',
+ 'deviceId' => $isTsep ? 'device_id_tsep' : 'device_id',
'developerId' => 'developer_id',
'transactionKey' => 'transaction_key',
];
@@ -46,6 +47,10 @@ public function configureSDK()
$config->gatewayProvider = GatewayProvider::TRANSIT;
$config->acceptorConfig = new AcceptorConfig();
+ if ($this->isAdmin()) {
+ $config->acceptorConfig->cardDataSource = CardDataSource::MAIL;
+ }
+
ServicesContainer::configure($config);
}
@@ -96,11 +101,23 @@ public function saveMultiToken($token,$cardData,$cardType, $customerId = null)
$storedCard->save();
return $storedCard;
}catch (Exception $e){
- if($e->getCode() == '23000'){
+ if ($e->getCode() == '23000'){
Mage::throwException($this->__('Customer Not Found : Card could not be saved.'));
}
Mage::throwException($e->getMessage());
}
}
}
+
+ protected function isAdmin() {
+ if (Mage::app()->getStore()->isAdmin()) {
+ return true;
+ }
+
+ if (Mage::getDesign()->getArea() == 'adminhtml') {
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/app/code/community/Hps/Transit/Model/Observer.php b/app/code/community/Hps/Transit/Model/Observer.php
index 0630c55..76fddd0 100644
--- a/app/code/community/Hps/Transit/Model/Observer.php
+++ b/app/code/community/Hps/Transit/Model/Observer.php
@@ -16,6 +16,7 @@ public function requestTransactionKey()
$response = ServicesContainer::instance()->getClient()->getTransactionKey();
+ error_log(print_r($response->transactionKey, true));
Mage::getConfig()->saveConfig(sprintf(self::CONFIG_FORMAT, 'transaction_key'), $response->transactionKey);
Mage::getConfig()->saveConfig(sprintf(self::CONFIG_FORMAT, 'user_id'), null);
Mage::getConfig()->saveConfig(sprintf(self::CONFIG_FORMAT, 'password'), null);
diff --git a/app/code/community/Hps/Transit/Model/Payment.php b/app/code/community/Hps/Transit/Model/Payment.php
index 3031d0d..5e64341 100644
--- a/app/code/community/Hps/Transit/Model/Payment.php
+++ b/app/code/community/Hps/Transit/Model/Payment.php
@@ -1,11 +1,9 @@
getAdditionalData() ? unserialize($payment->getAdditionalData()) : null);
$secureToken = $additionalData->getTransitToken() ? $additionalData->getTransitToken() : null;
$saveCreditCard = (bool) $additionalData->getCcSaveFuture();
+ $useStoredCard = (bool) $additionalData->getCcUseMulti();
$customerId = $additionalData->getCustomerId();
$cardType = $payment->getCcType();
@@ -138,6 +137,7 @@ private function _authorize(Varien_Object $payment, $amount, $capture)
$requestType = $capture ? 'charge' : 'authorize';
$builder = $cardOrToken->{$requestType}($amount)
->withCurrency(strtolower($order->getBaseCurrencyCode()))
+ ->withClientTransactionId(time())
->withAddress($address)
->withRequestMultiUseToken($multiToken)
->withDescription($memo)
@@ -145,12 +145,25 @@ private function _authorize(Varien_Object $payment, $amount, $capture)
->withCustomerId($customerId);
}
+ if ($useStoredCard === true) {
+ $storedCreds = new StoredCredential;
+ $storedCreds->initiator = $this->isAdmin()
+ ? StoredCredentialInitiator::MERCHANT
+ : StoredCredentialInitiator::CARDHOLDER;
+
+ $builder = $builder->withStoredCredential($storedCreds);
+ }
+
$response = $builder->execute();
- if ($response->responseCode !== '00') {
+ if ($response->responseCode !== '00' || $response->responseMessage === 'Partially Approved') {
// TODO: move this
// $this->updateVelocity($e);
+ if ($response->responseCode === '10' || $response->responseMessage === 'Partially Approved') {
+ try { $response->void()->execute(); } catch (\Exception $e) {}
+ }
+
if (!$this->_allow_fraud || $response->responseCode !== 'FR') {
throw new ApiException($this->mapResponseCodeToFriendlyMessage($response->responseCode));
}
@@ -542,6 +555,10 @@ public function assignData($data)
$details['cc_save_future'] = 1;
}
+ if ($data->getData('cc_use_multi')) {
+ $details['cc_use_multi'] = 1;
+ }
+
if ($data->getData('transit_token')) {
$details['transit_token'] = $data->getData('transit_token');
}
@@ -772,4 +789,16 @@ protected function mapResponseCodeToFriendlyMessage($responseCode) {
return $result;
}
+
+ protected function isAdmin() {
+ if (Mage::app()->getStore()->isAdmin()) {
+ return true;
+ }
+
+ if (Mage::getDesign()->getArea() == 'adminhtml') {
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/app/code/community/Hps/Transit/etc/config.xml b/app/code/community/Hps/Transit/etc/config.xml
index 903313e..cf1971f 100644
--- a/app/code/community/Hps/Transit/etc/config.xml
+++ b/app/code/community/Hps/Transit/etc/config.xml
@@ -69,6 +69,7 @@
+
003226G003
no
diff --git a/app/code/community/Hps/Transit/etc/system.xml b/app/code/community/Hps/Transit/etc/system.xml
index 4dacd4f..459b03a 100644
--- a/app/code/community/Hps/Transit/etc/system.xml
+++ b/app/code/community/Hps/Transit/etc/system.xml
@@ -74,11 +74,19 @@
1
1
+
+
+ adminhtml/system_config_backend_encrypted
+ 14
+ 1
+ 1
+ 1
+
obscure
adminhtml/system_config_backend_encrypted
- 14
+ 15
1
1
1
@@ -87,7 +95,7 @@
select
adminhtml/system_config_source_yesno
- 15
+ 16
1
1
1
diff --git a/app/design/frontend/base/default/template/transit/form.phtml b/app/design/frontend/base/default/template/transit/form.phtml
index 5e712c7..98282af 100755
--- a/app/design/frontend/base/default/template/transit/form.phtml
+++ b/app/design/frontend/base/default/template/transit/form.phtml
@@ -32,6 +32,10 @@ if ($_loggedIn && $allow_card_saving) {
+
+
+
+
diff --git a/cypress.json b/cypress.json
index 28dc60f..a93748f 100644
--- a/cypress.json
+++ b/cypress.json
@@ -1,5 +1,6 @@
{
- "defaultCommandTimeout": 15000,
+ "pageLoadTimeout": 60000,
+ "defaultCommandTimeout": 30000,
"fixturesFolder": "test/fixtures",
"integrationFolder": "test/integration",
"pluginsFile": "test/plugins",
diff --git a/js/transit/admin-checkout.js b/js/transit/admin-checkout.js
index c9f0175..9f2d2e7 100644
--- a/js/transit/admin-checkout.js
+++ b/js/transit/admin-checkout.js
@@ -11,6 +11,10 @@
}
};
window.TransITMagentoAdmin.setupFields = function () {
+ if (!window.TransITMagentoAdmin.options) {
+ return;
+ }
+
GlobalPayments.configure(window.TransITMagentoAdmin.options.credentials);
window.TransITMagentoAdmin.cardForm = GlobalPayments.ui.form({
diff --git a/js/transit/checkout-form.js b/js/transit/checkout-form.js
index cd7befc..3ccf6b1 100644
--- a/js/transit/checkout-form.js
+++ b/js/transit/checkout-form.js
@@ -708,6 +708,7 @@ document.observe('dom:loaded', function() {
$('hps_transit_cc_exp_year').value =
data.token.cc_exp_year;
}
+ $('hps_transit_use_stored_card').value = "1";
this.transitResponseHandler.call(this, {
card_type: storedcardType,
token_value: data.token.token_value,
@@ -923,6 +924,7 @@ document.observe('dom:loaded', function() {
var radio = $$(
'[name="hps_transit_stored_card_select"]:checked'
)[0];
+ $('hps_transit_use_stored_card').value = "1";
var storedcardId = radio.value;
var storedcardType = $(radio.id + '_card_type').value;
new Ajax.Request(window.payment.transitGetTokenDataUrlOSC, {
@@ -1018,6 +1020,7 @@ document.observe('dom:loaded', function() {
var radio = $$(
'[name="hps_transit_stored_card_select"]:checked'
)[0];
+ $('hps_transit_use_stored_card').value = "1";
var storedcardId = radio.value;
var storedcardType = $(radio.id + '_card_type').value;
new Ajax.Request(window.payment.transitGetTokenDataUrlOSC, {
@@ -1285,6 +1288,7 @@ document.observe('dom:loaded', function() {
var radio = $$(
'[name="hps_transit_stored_card_select"]:checked'
)[0];
+ $('hps_transit_use_stored_card').value = "1";
var storedcardId = radio.value;
var storedcardType = $(radio.id + '_card_type').value;
new Ajax.Request(PaymentMethod.prototype.transitGetTokenDataUrl, {
diff --git a/test/integration/admin/checkout.spec.js b/test/integration/admin/checkout.spec.js
new file mode 100644
index 0000000..0d079ab
--- /dev/null
+++ b/test/integration/admin/checkout.spec.js
@@ -0,0 +1,62 @@
+///
+
+import {
+ getStorefrontUrl,
+ adminLogin,
+ enterInIframe
+} from '../../support/helpers';
+
+context('Admin - Checkout', () => {
+ beforeEach(() => {
+ cy.visit(getStorefrontUrl().trim('/') + '/admin');
+ });
+
+ it('can create a customer order', () => {
+ adminLogin();
+
+ // goto orders
+ cy.get('#nav > li:nth-of-type(2) > ul li.level1:nth-of-type(1) a').click({ force: true });
+
+ // new order
+ cy.get('button[title="Create New Order"]:first').click();
+
+ // select a customer
+ cy.get('#sales_order_create_customer_grid_table tbody tr:first').click();
+
+ // add a product
+ // cy.get('#order-items button.add').click();
+ // cy.get('#sales_order_create_search_grid_table tbody tr:first').click();
+
+ // cy.wait(500);
+
+ // cy.get('button[title="Add Selected Product(s) to Order"]').click();
+ cy.get('#sidebar_data_reorder input[type="checkbox"]:first').click();
+ // cy.window().then((win) => win.order.sidebarApplyChanges());
+ cy.wait(2000);
+ cy.get('.create-order-sidebar-container button[title="Update Changes"]:first').click();
+
+ cy.wait(2000);
+
+ // select shipping method
+ cy.window().then((win) => win.order.loadShippingRates());
+ cy.get('#s_method_flatrate_flatrate').check();
+
+ // enter payment details
+ cy.window().then((win) => win.payment.switchMethod('hps_transit'));
+ cy.get('#p_method_hps_transit').click({force: true});
+
+ cy.wait(2000);
+
+ cy.get("#hps_transit_cc_number_iframe > iframe").then(enterInIframe('4242424242424242'));
+ cy.get("#hps_transit_cc_exp_iframe > iframe").then(enterInIframe('12 / 2025'));
+ cy.get("#hps_transit_cc_cvv_iframe > iframe").then(enterInIframe('999'));
+
+ cy.wait(1000);
+
+ // submit order
+ cy.window().then((win) => win.order.submit());
+
+ // confirm success
+ cy.get('#messages .success-msg').should('have.text', 'The order has been created.');
+ });
+});
diff --git a/test/integration/certification/direct-marketing.spec.js b/test/integration/certification/direct-marketing.spec.js
new file mode 100644
index 0000000..0edeb77
--- /dev/null
+++ b/test/integration/certification/direct-marketing.spec.js
@@ -0,0 +1,11 @@
+// moto order - internet - sale visa
+// 32.49 (25.49 + 7*1.00)
+// moto order - internet - sale visa
+// 11.12
+
+// close batch
+
+// return with reference - visa
+// 11.12 (from order #2 above)
+// return with reference - visa
+// 7.00 (from order #1 above)
diff --git a/test/integration/certification/ecommerce.spec.js b/test/integration/certification/ecommerce.spec.js
new file mode 100644
index 0000000..6104279
--- /dev/null
+++ b/test/integration/certification/ecommerce.spec.js
@@ -0,0 +1,204 @@
+///
+
+import {
+ amex,
+ diners,
+ discover,
+ discoverCup1,
+ jcb,
+ mastercard2bin,
+ mastercardKeyed,
+ visa1,
+ visa2,
+} from '../../support/test-data';
+import {
+ getStorefrontUrl,
+ confirmSuccessfulCheckout,
+ placeOrder,
+ enterPaymentInformation,
+ confirmShippingMethod,
+ enterBillingInformation,
+ checkoutAsGuest,
+ checkoutAsCustomer,
+ goToCheckout,
+ addAProductToCart,
+ setPaymentAction,
+ adminLogin,
+} from '../../support/helpers';
+
+context('Frontend - Checkout', () => {
+ beforeEach(() => {
+ cy.visit(getStorefrontUrl());
+ });
+
+ it('card not present - internet - sale mastercard 2 bin', () => {
+ // 11.10
+ addAProductToCart('test-1110');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(mastercard2bin);
+ placeOrder();
+
+ cy.get('#payment_form_hps_transit').should('be.visible');
+ });
+
+ it('card not present - internet - sale discover', () => {
+ // 12.00
+ addAProductToCart('test-1200');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(discover);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - auth diners', () => {
+ // 6.00
+ cy.visit(getStorefrontUrl() + '/admin');
+ adminLogin();
+ setPaymentAction('authorize');
+ cy.visit(getStorefrontUrl());
+
+ addAProductToCart('test-600');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(diners);
+ placeOrder();
+ confirmSuccessfulCheckout();
+
+ cy.visit(getStorefrontUrl() + '/admin');
+ setPaymentAction('authorize_capture');
+ });
+
+ it('card not present - internet - sale mastercard', () => {
+ // 15.00
+ addAProductToCart('test-1500');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(mastercardKeyed);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale mastercard', () => {
+ // 34.13
+ addAProductToCart('test-3413');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(mastercardKeyed);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale jcb', () => {
+ // 13.00
+ addAProductToCart('test-1300');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(jcb);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale amex', () => {
+ // 13.50
+ addAProductToCart('test-1350');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ const amexNoCvv = Object.assign({}, amex);
+ amexNoCvv.cvv = false;
+ enterPaymentInformation(amexNoCvv);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale visa', () => {
+ // 32.49
+ addAProductToCart('test-3249');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(visa1);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale discover cup', () => {
+ // 10.00
+ addAProductToCart('test-1000');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(discoverCup1);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale visa', () => {
+ // 11.12
+ addAProductToCart('test-1112');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(visa2);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - sale amex', () => {
+ // 4.00
+ addAProductToCart('test-400');
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(amex);
+ placeOrder();
+ confirmSuccessfulCheckout();
+
+ // todo void in admin
+ });
+
+ // it('card on file - customer initiatied - sale visa', () => {
+ // // 14.00
+ // addAProductToCart('test-1400');
+ // goToCheckout();
+ // checkoutAsCustomer();
+ // enterBillingInformation({ isCustomer: true });
+ // confirmShippingMethod();
+ // // todo select card
+ // enterPaymentInformation(visa2);
+ // placeOrder();
+ // confirmSuccessfulCheckout();
+ // });
+
+ // it('card on file - customer initiatied - sale mastercard', () => {
+ // // 15.00
+ // addAProductToCart('test-1500');
+ // goToCheckout();
+ // checkoutAsCustomer();
+ // enterBillingInformation({ isCustomer: true });
+ // confirmShippingMethod();
+ // // todo select card
+ // enterPaymentInformation(mastercardKeyed);
+ // placeOrder();
+ // confirmSuccessfulCheckout();
+ // });
+});
diff --git a/test/integration/certification/tsep.spec.js b/test/integration/certification/tsep.spec.js
new file mode 100644
index 0000000..dd520bc
--- /dev/null
+++ b/test/integration/certification/tsep.spec.js
@@ -0,0 +1,100 @@
+///
+
+import {
+ amex,
+ diners,
+ discover,
+ mastercard2bin,
+ mastercardKeyed,
+ visa1,
+} from '../../support/test-data';
+import {
+ getStorefrontUrl,
+ confirmSuccessfulCheckout,
+ placeOrder,
+ enterPaymentInformation,
+ confirmShippingMethod,
+ enterBillingInformation,
+ checkoutAsGuest,
+ goToCheckout,
+ addAProductToCart,
+ findACategory,
+} from '../../support/helpers';
+
+context('Frontend - Checkout', () => {
+ beforeEach(() => {
+ cy.visit(getStorefrontUrl());
+ });
+
+ it('card not present - internet - tsep visa', () => {
+ findACategory();
+ addAProductToCart();
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(visa1);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - tsep mastercard', () => {
+ findACategory();
+ addAProductToCart();
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(mastercardKeyed);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - tsep mastercard 2 bin', () => {
+ findACategory();
+ addAProductToCart();
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(mastercard2bin);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - tsep discover', () => {
+ findACategory();
+ addAProductToCart();
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(discover);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - tsep amex', () => {
+ findACategory();
+ addAProductToCart();
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(amex);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+
+ it('card not present - internet - tsep diners', () => {
+ findACategory();
+ addAProductToCart();
+ goToCheckout();
+ checkoutAsGuest();
+ enterBillingInformation();
+ confirmShippingMethod();
+ enterPaymentInformation(diners);
+ placeOrder();
+ confirmSuccessfulCheckout();
+ });
+});
\ No newline at end of file
diff --git a/test/support/helpers.js b/test/support/helpers.js
index df798de..44ecc3f 100644
--- a/test/support/helpers.js
+++ b/test/support/helpers.js
@@ -31,7 +31,9 @@ export function enterPaymentInformation(data) {
cy.get("#hps_transit_cc_number_iframe > iframe").then(enterInIframe(data.number || '4242424242424242'));
cy.get("#hps_transit_cc_exp_iframe > iframe").then(enterInIframe(data.expDate || '12 / 2025'));
- cy.get("#hps_transit_cc_cvv_iframe > iframe").then(enterInIframe(data.cvv || '123'));
+ if (data.cvv !== false) {
+ cy.get("#hps_transit_cc_cvv_iframe > iframe").then(enterInIframe(data.cvv || '123'));
+ }
if (data.save) {
cy.get('#hps_transit_cc_save_future').check();
@@ -89,8 +91,14 @@ export function goToCheckout() {
cy.get('.btn-checkout:first').click();
}
-export function addAProductToCart() {
- cy.get('.products-grid .item .actions .btn-cart').click();
+export function addAProductToCart(productUrlKey) {
+ if (!productUrlKey) {
+ cy.get('.products-grid .item:first .actions .btn-cart').click();
+ return;
+ }
+
+ cy.visit(getStorefrontUrl() + '/index.php/' + productUrlKey + '.html');
+ cy.get('#product_addtocart_form .btn-cart').click();
}
export function findACategory() {
@@ -113,3 +121,20 @@ export function enterInIframe(content, selector) {
.type(content, { force: true });
};
}
+
+export function adminLogin() {
+ typeInputValue('#username', 'admin');
+ typeInputValue('#login', '69fLgKZUefbBMPn');
+ cy.get('#loginForm input[type="submit"]').click();
+}
+
+export function setPaymentAction(action) {
+ // goto system config
+ cy.get('#nav > li:last-child > ul > li:last-child a').should('have.text', 'Configuration').click({ force: true });
+
+ cy.get('#system_config_tabs dd:nth-of-type(9) a').click();
+
+ cy.get('#payment_hps_transit_payment_action').select(action);
+
+ cy.get('#content .form-buttons button[title="Save Config"]:first').click();
+}
diff --git a/test/support/test-data.js b/test/support/test-data.js
new file mode 100644
index 0000000..80ebd85
--- /dev/null
+++ b/test/support/test-data.js
@@ -0,0 +1,76 @@
+export const address = {
+ street: '8320',
+ zip: '85284'
+};
+
+export const visa1 = {
+ number: '4012000098765439',
+ expDate: '12 / 2020',
+ cvv: '999',
+};
+
+export const visa2 = {
+ number: '4012881888818888',
+ expDate: '12 / 2020',
+ cvv: '999',
+};
+
+export const mastercardUnclassified = {
+ number: '5146315000000055',
+ expDate: '12 / 2020',
+ cvv: '998',
+};
+
+export const mastercardSwipe = {
+ number: '5146312200000035',
+ expDate: '12 / 2020',
+ cvv: '998',
+};
+
+export const mastercardKeyed = {
+ number: '5146312620000045',
+ expDate: '12 / 2020',
+ cvv: '998',
+};
+
+export const mastercard2bin = {
+ number: '2223000048400011',
+ expDate: '12 / 2025',
+ cvv: '998',
+};
+
+export const amex = {
+ number: '371449635392376',
+ expDate: '12 / 2020',
+ cvv: '9997',
+};
+
+export const discover = {
+ number: '6011000993026909',
+ expDate: '12 / 2020',
+ cvv: '996',
+};
+
+export const discoverCup1 = {
+ number: '6282000123842342',
+ expDate: '12 / 2020',
+ cvv: '996',
+};
+
+export const discoverCup2 = {
+ number: '6221261111112650',
+ expDate: '12 / 2020',
+ cvv: '996',
+};
+
+export const diners = {
+ number: '3055155515160018',
+ expDate: '12 / 2020',
+ cvv: '996',
+};
+
+export const jcb = {
+ number: '3530142019945859',
+ expDate: '12 / 2020',
+ cvv: '996',
+};