globalpayments / rxp-js

Global Payments Ecommerce JavaScript Library
MIT License
34 stars 70 forks source link

HPP embedded and redirect options + tests #14

Closed slogsdon closed 6 years ago

slogsdon commented 7 years ago

Builds on #11. That should be merged first.

This PR includes the following:

Apologies for lumping all this in one PR, but a lot of them were build on each other. Let me know if you'd prefer this be split into separate PRs.

slogsdon commented 7 years ago

When running npm run grunt test, one should see something like the below as long as no issues occur:

$ npm run grunt test

> rxp-js@1.2.1 grunt /Users/shane.logsdon/Code/javascript/rxp-js
> grunt "test"

Running "jasmine:src" (jasmine) task
Testing Jasmine specs via PhantomJS

 rxp-hpp library
   form input creation (createFormHiddenInput)
     ✓ creates element
     ✓ empty name
     ✓ empty value
     ✓ empty name and value
   device orientation (checkDevicesOrientation)
     ✓ 0
     ✓ 90
     ✓ 180
     ✓ -90
   lightbox overlay (createOverlay)
     ✓ creates an overlay
   lightbox overlay close button (createCloseButton)
     ✓ creates an overlay
   request form(createForm)
     ✓ creates form with no extra data
     ✓ creates redirect form with no extra data
     ✓ creates form with extra data
     ✓ creates redirect form with extra data
   lightbox load indicator (createSpinner)
     ✓ creates an image
   url parsing (getUrlParser)
     ✓ parses url
   url parsing (getHostnameFromUrl)
     ✓ parses hostname
   url parsing (getHostnameFromUrl)
     ✓ same host returns true
     ✓ different hosts return false
 rxp-remote library
   card validation (validateCardNumber)
     ✓ valid card
     ✓ non-numeric card
     ✓ card with spaces
     ✓ empty card
     ✓ undefined card
     ✓ white space only
     ✓ length < 12
     ✓ length > 19
     ✓ length = 12
     ✓ length = 19
     ✓ luhn check
   card holder name validation (validateCardHolderName)
     ✓ valid name
     ✓ empty name
     ✓ undefined name
     ✓ white space only
     ✓ name of 100 characters
     ✓ name over 100 characters
     ✓ ISO/IEC 8859-1 characters 1
     ✓ ISO/IEC 8859-1 characters 2
     ✓ ISO/IEC 8859-1 characters 3
     ✓ ISO/IEC 8859-1 characters 4
     ✓ non-ISO/IEC 8859-1 characters
   CVN Amex validation (validateAmexCvn)
     ✓ valid Amex CVN
     ✓ empty CVN
     ✓ undefined CVN
     ✓ white space only
     ✓ Amex CVN of 5 numbers
     ✓ Amex CVN of 3 numbers
     ✓ non-numeric Amex CVN of 4 characters
   CVN non-Amex validation (validateCvn)
     ✓ valid non-Amex CVN
     ✓ empty CVN
     ✓ undefined CVN
     ✓ white space only
     ✓ non-Amex CVN of 4 numbers
     ✓ non-Amex CVN of 2 numbers
     ✓ non-numeric non-Amex CVN of 3 characters
   Expiry date format validation (validateExpiryDateFormat)
     ✓ valid date 1299
     ✓ valid date 0199
     ✓ non-numeric date
     ✓ date with spaces
     ✓ empty date
     ✓ undefined date
     ✓ white space only
     ✓ length > 4
     ✓ length < 4
     ✓ invalid month 00
     ✓ invalid month 13
   Expiry date not in past validation (validateExpiryDateNotInPast)
     ✓ date in past
     ✓ current month

68 specs in 0.127s.
>> 0 failures
(node:70014) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.

Running "php:test" (php) task

Running "intern:runner" (intern) task
Listening on 0.0.0.0:9000
Tunnel started
‣ Created session chrome on any platform (c9a7d5ad-e2df-4578-ad0e-d33863a97a1e)
✓ chrome on any platform - RealexRemote - HPP Embedded Positive Tests - should process a payment successfully (9.765s)
✓ chrome on any platform - RealexRemote - HPP Lightbox Positive Tests - should process a payment successfully (3.074s)
✓ chrome on any platform - RealexRemote - HPP Redirect Positive Tests - should process a payment successfully (2.718s)
No unit test coverage for chrome on any platform
>> chrome on any platform: 0/3 tests failed

>> TOTAL: tested 1 platforms, 0/3 tests failed

Done.
fabiofalci commented 6 years ago

Hi @slogsdon, I'm trying to find an example for HPP redirect but haven't found one on realex developers website. Then I found this PR. Is the redirect something not yet present in this library and maybe this PR will add it?

slogsdon commented 6 years ago

@fabiofalci Apologies for the delay. This is new functionality that is not yet present in an official build. Once the PR is merged, there will be redirect and embedded options in addition to the existing lightbox option.