Skip to content

Commit

Permalink
feat(payment-paytr): Implement payment provider (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p authored Mar 16, 2022
1 parent 040b21c commit cb419ca
Show file tree
Hide file tree
Showing 50 changed files with 2,078 additions and 1,076 deletions.
10 changes: 10 additions & 0 deletions .eslingignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**/node_modules/**
**/dist/**
**/build/**
**/coverage/**

**/.eslintrc.js/**
**/husky.config.js/**
**/jest.config.js/**
**/jest.config.base.js/**
**/lint-staged.config.js/**
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: [
'.eslintrc.js',
'packages/**/*.spec.ts',
'packages/**/*.d.ts',
'packages/**/*.map.js'
],
rules: {
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': "off",
"@typescript-eslint/indent": 'off'
},
};
47 changes: 47 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tests pipeline
on: [push]

jobs:
payment-paytr:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/payments/payment-paytr

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2.3.5
with:
fetch-depth: 0

- name: Setup Node.js environment
uses: actions/setup-node@v2.4.1
with:
node-version: "14"
cache: "npm"

- name: create test env file
run: |
touch .env.test
echo MERCHANT_ID=${{ secrets.PAYTR_MERCHANT_ID }} >> .env.test
echo MERCHANT_KEY=${{ secrets.PAYTR_MERCHANT_KEY }} >> .env.test
echo MERCHANT_SALT=${{ secrets.PAYTR_MERCHANT_SALT }} >> .env.test
echo TOKEN_ENDPOINT=${{ secrets.PAYTR_TOKEN_ENDPOINT }} >> .env.test
echo REFUND_ENDPOINT=${{ secrets.PAYTR_REFUND_ENDPOINT }} >> .env.test
env:
MERCHANT_ID: ${{secrets.PAYTR_MERCHANT_ID}}
MERCHANT_KEY: ${{secrets.PAYTR_MERCHANT_KEY}}
MERCHANT_SALT: ${{secrets.PAYTR_MERCHANT_SALT}}
TOKEN_ENDPOINT: ${{secrets.PAYTR_TOKEN_ENDPOINT}}
REFUND_ENDPOINT: ${{secrets.PAYTR_REFUND_ENDPOINT}}

- name: 'npm install'
run: npm install

- name: 'run unit tests'
run: npm run test
69 changes: 69 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches:
- '*'
- '!main'
schedule:
- cron: '36 15 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ node_modules
**/.DS_Store

**/.env
packages/payments/payment-paytr/dummy/server/.env
**/.env.test
dist
coverage
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
packages/**/*.d.ts
packages/**/*.js

.jest-cache/*
.jest-coverage/*
node_modules/*

**/dist/*
**/node_modules/*
**/tsconfig.tsbuildinfo
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"singleQuote": true,
"trailingComma": "es5",
"useTabs": true,
"printWidth": 120,
"endOfLine": "auto",
"arrowParens": "always",
"bracketSpacing": true,
"tabWidth": 4
}
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Development

## Plugin

Go to the plugin package directory and Build your local plugin

```bash
npm run build
npm pack
```

Then copy the tgz file newly creating by the `pack` command into your project.

## Target project

In your target project past the tgz file previously copied.
then update your `package.json`

```bash
"my-package": "file:my-package-1.0.0.tgz"
```

now run `npm i` and run your project
24 changes: 10 additions & 14 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"npmClient": "npm",
"packages": [
"packages/*",
"packages/payments/*"
"packages/*"
],
"version": "independent",
"command": {
"publish": {
"conventionalCommits": true
"conventionalCommits": true,
"yes": true,
"ignoreChanges": [
"**/*.spec.ts"
],
"message": "chore(release): publish",
"registry": "https://npm.pkg.github.com/"
}
},
"changelog": {
"ignoreCommitters": ["allcontributors"],
"labels": {
"feat": ":rocket: New Feature",
"chore": ":earth: Core",
"fix": ":bug: Bug Fix",
"docs": ":memo: Documentation",
"refactor": ":truck: Refactoring"
}
}
"version": "independent"
}
Loading

0 comments on commit cb419ca

Please sign in to comment.