Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Release 4.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
IngenicoEPayments committed Aug 11, 2023
1 parent 8e33d5e commit 5558bea
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 38 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: API docs

on:
push:
tags: ['[0-9]+.[0-9]+*']

permissions:
contents: write

jobs:
api-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: code
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '12.x'
cache: 'npm'
cache-dependency-path: code/package-lock.json
- name: Build API docs
run: npm ci && npm run build && npm run typedoc
working-directory: code
- name: Checkout pages
uses: actions/checkout@v3
with:
ref: gh-pages
path: pages
- name: Deploy pages
run: |
SDK_VERSION_FOLDER=`echo "$SDK_VERSION" | awk --field-separator '.' '{print $1".x";}'`
# Create .nojekyll if it doesn't exist yet
touch .nojekyll
mkdir -p "$SDK_VERSION_FOLDER"
rsync --quiet --archive --checksum --delete --exclude .git ../code/docs/ "$SDK_VERSION_FOLDER/"
# Remove .nojekyll generated by TypeDoc
if [ -f "$SDK_VERSION_FOLDER/.nojekyll" ]; then rm "$SDK_VERSION_FOLDER/.nojekyll"; fi
if [ -e latest ]; then rm -r latest; fi
ln -s "$SDK_VERSION_FOLDER" latest
git config user.email "$USER_EMAIL"
git config user.name "$USER_NAME"
git add --all .
# Only commit when there are changes
git diff --quiet && git diff --staged --quiet || git commit --message "Generated API docs for version ${SDK_VERSION}"
git push
shell: bash
working-directory: pages
env:
SDK_VERSION: ${{ github.ref_name }}
USER_EMAIL: ${{ github.event.pusher.email }}
USER_NAME: ${{ github.event.pusher.name }}
13 changes: 5 additions & 8 deletions __tests__/Validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import dateformat = require("dateformat");
import duration = require("duration-fns");
import { PaymentProductFieldJSON, PaymentProductJSON } from "../src/apimodel";
import PaymentProduct = require("../src/PaymentProduct");
import PaymentRequest = require("../src/PaymentRequest");
Expand Down Expand Up @@ -201,23 +202,19 @@ describe("validation", () => {
expect(rule.validate(value)).toBe(false);
});

test("valid", () => {
test.each(["mmyy", "mmyyyy"])("valid (format: %s)", (format) => {
const paymentRequest = createPaymentRequest();
const date = new Date();
const value = dateformat(date, "mmyy");
const value = dateformat(date, format);
paymentRequest.setValue(paymentProductField.id, value);
expect(rule.validateValue(paymentRequest, paymentProductField.id)).toBe(true);
expect(rule.validate(value)).toBe(true);
});

test("expired", () => {
const paymentRequest = createPaymentRequest();
const date = new Date();
date.setMonth(date.getMonth() - 1);
// DST can cause October 31st minus 1 month to be October 1st; subtract another day if that occurs
if (date.getMonth() === new Date().getMonth()) {
date.setDate(date.getDate() - 1);
}
const period = duration.parse("P-1M");
const date = duration.apply(new Date(), period);
const value = dateformat(date, "mmyy");
paymentRequest.setValue(paymentProductField.id, value);
expect(rule.validateValue(paymentRequest, paymentProductField.id)).toBe(false);
Expand Down
93 changes: 65 additions & 28 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "connect-sdk-client-js",
"version": "4.1.0",
"version": "4.1.1",
"description": "The JavaScript based client SDK that can be used for client to server communication between you and the Ingenico ePayments platform",
"homepage": "https://github.com/Ingenico-ePayments/connect-sdk-client-js#readme",
"bugs": {
Expand Down Expand Up @@ -41,6 +41,7 @@
"@typescript-eslint/parser": "^5.10.0",
"dateformat": "^4.5.1",
"del": "^6.0.0",
"duration-fns": "^3.0.2",
"eslint": "^8.7.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function createInstance(): Util {
return {
screenSize: window.innerWidth + "x" + window.innerHeight,
platformIdentifier: window.navigator.userAgent,
sdkIdentifier: (document["GC"] && document["GC"].rppEnabledPage ? "rpp-" : "") + "JavaScriptClientSDK/v4.1.0",
sdkIdentifier: (document["GC"] && document["GC"].rppEnabledPage ? "rpp-" : "") + "JavaScriptClientSDK/v4.1.1",
sdkCreator: "Ingenico",
};
},
Expand Down

0 comments on commit 5558bea

Please sign in to comment.