Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-000000] DO NOT MERGE IT - TESTING #29

Draft
wants to merge 61 commits into
base: DEV
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
12323a3
Create sonar-project file
marcosrivereto Dec 16, 2024
2d82de3
Create script to create coverage report
marcosrivereto Dec 17, 2024
941e70f
Add to test
gabrielnedersantos Dec 18, 2024
1ba9803
Add to test
gabrielnedersantos Dec 18, 2024
e74abcc
Add to test
gabrielnedersantos Dec 18, 2024
166b236
Add to test
gabrielnedersantos Dec 18, 2024
0800d48
Add to test
gabrielnedersantos Dec 18, 2024
bdc96c1
Add to test
gabrielnedersantos Dec 18, 2024
45a7b13
Add to test
gabrielnedersantos Dec 18, 2024
8185f29
Add to test
gabrielnedersantos Dec 18, 2024
6d3c58e
Add to test
gabrielnedersantos Dec 18, 2024
e0c2260
Add to test
gabrielnedersantos Dec 18, 2024
95c78fb
Add to test
gabrielnedersantos Dec 18, 2024
ad1b5c4
Add to test
gabrielnedersantos Dec 18, 2024
4f28c0b
Add to test
gabrielnedersantos Dec 18, 2024
c4b50ba
Add to test
gabrielnedersantos Dec 18, 2024
28ce4e2
Add to test
gabrielnedersantos Dec 18, 2024
5bfee67
Add to test
gabrielnedersantos Dec 18, 2024
ee46f1c
Add to test
gabrielnedersantos Dec 18, 2024
aae8f9a
Add to test
gabrielnedersantos Dec 18, 2024
b942331
Add to test
gabrielnedersantos Dec 18, 2024
17a3fd2
Add to test
gabrielnedersantos Dec 18, 2024
ae0fd1b
Add to test
gabrielnedersantos Dec 18, 2024
5948548
Add to test
gabrielnedersantos Dec 18, 2024
c542071
Add to test
gabrielnedersantos Dec 18, 2024
46aee94
Add to test
gabrielnedersantos Dec 18, 2024
0f95ce9
Add to test
gabrielnedersantos Dec 18, 2024
25bec83
Add to test
gabrielnedersantos Dec 18, 2024
26c2706
Add to test
gabrielnedersantos Dec 18, 2024
9d43407
Add to test
gabrielnedersantos Dec 18, 2024
9893c18
Add to test
gabrielnedersantos Dec 18, 2024
adfc3ab
Add to test
gabrielnedersantos Dec 18, 2024
021040a
Add to test
gabrielnedersantos Dec 18, 2024
218b537
Add to test
gabrielnedersantos Dec 18, 2024
7c17797
Add to test
gabrielnedersantos Dec 18, 2024
db9675f
Add to test
gabrielnedersantos Dec 18, 2024
7172347
Add to test
gabrielnedersantos Dec 18, 2024
680cadd
Add to test
gabrielnedersantos Dec 18, 2024
7636316
Add to test
gabrielnedersantos Dec 18, 2024
a160767
Add to test
gabrielnedersantos Dec 18, 2024
de73c3e
Add to test
gabrielnedersantos Dec 18, 2024
e3c491c
Add to test
gabrielnedersantos Dec 18, 2024
c6e45d0
Add to test
gabrielnedersantos Dec 18, 2024
6df6eb3
Add to test
gabrielnedersantos Dec 18, 2024
496784d
Add to test
gabrielnedersantos Dec 18, 2024
63fedba
Add to test
gabrielnedersantos Dec 18, 2024
8a1fbfd
Add to test
gabrielnedersantos Dec 18, 2024
e355d7c
Add to test
gabrielnedersantos Dec 18, 2024
de71189
Add to test
gabrielnedersantos Dec 18, 2024
2ec8a41
Add to test
gabrielnedersantos Dec 18, 2024
38d5382
Add to test
gabrielnedersantos Dec 18, 2024
c061e3f
Add to test
gabrielnedersantos Dec 18, 2024
37465a7
Add to test
gabrielnedersantos Dec 18, 2024
8d8fa6b
Add to test
gabrielnedersantos Dec 18, 2024
e5e811b
Add to test
gabrielnedersantos Dec 18, 2024
2900a52
Add to test
gabrielnedersantos Dec 18, 2024
9ed7d6f
Add to test
gabrielnedersantos Dec 19, 2024
4e91072
Add to test
gabrielnedersantos Dec 19, 2024
b99ac03
Add to test
gabrielnedersantos Dec 19, 2024
f02241e
Add to test
gabrielnedersantos Dec 19, 2024
3de4460
Add to test
gabrielnedersantos Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/check_sonar_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI - iOS Quality Check

on:
pull_request:
types: [opened, edited, reopened, synchronize]
workflow_dispatch:

env:
PR_NUMBER: ${{ github.event.number }}
BRANCH_ORIGIN: ${{ github.head_ref }}
BASE_BRANCH: ${{ github.base_ref }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_SECRET }}
SONAR_HOST_URL: "https://sonarqube.trustly.one"
SONAR_PROJECT_KEY: "trustly-ios"
SONAR_PROJECT_NAME: "trustly-ios"

jobs:
SonarQube:
runs-on: macOS-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get Git Revision (Commit SHA)
id: git_revision
run: |
git fetch origin "${BRANCH_ORIGIN}"
GIT_REVISION=$(git rev-parse origin/${BRANCH_ORIGIN})
echo "Git Revision: $GIT_REVISION"
echo "GIT_REVISION=$GIT_REVISION" >> $GITHUB_ENV

- name: Install dependencies
run: |
# Update Homebrew
brew update
# Install SwiftLint
brew install swiftlint
# Install Tailor
brew install tailor
# Install xcpretty
sudo gem install -n /usr/local/bin xcpretty
# Install Lizard
brew install lizard

- name: Install CocoaPods
run: |
gem install cocoapods
pod install --project-directory=Example

- name: Install sonnar-scanner
run: |
brew install sonar-scanner

- name: Run SonarQube Analysis
run: |
# Create sonar-project.properties or update it dynamically
echo "sonar.host.url=${{ env.SONAR_HOST_URL }}" >> sonar-project.properties
echo "sonar.projectKey=${{ env.SONAR_PROJECT_KEY }}" >> sonar-project.properties
echo "sonar.projectName=${{ env.SONAR_PROJECT_NAME }}" >> sonar-project.properties
echo "sonar.login=${{ secrets.SONAR_TOKEN_SECRET }}" >> sonar-project.properties
echo "sonar.pullrequest.key=${{ github.event.number }}" >> sonar-project.properties
echo "sonar.pullrequest.branch=${{ github.head_ref }}" >> sonar-project.properties
echo "sonar.pullrequest.base=${{ github.base_ref }}" >> sonar-project.properties
echo "sonar.scm.revision=${{ env.GIT_REVISION }}" >> sonar-project.properties

- name: Run Sonar-Swift Script
run: |
chmod +x ./run-sonar-swift.sh
./run-sonar-swift.sh -v

- name: Verify Coverage Report
run: |
if [ -f "sonar-reports/generic-coverage.xml" ]; then
echo "Coverage report generated successfully: sonar-reports/generic-coverage.xml"
cat sonar-reports/generic-coverage.xml
else
echo "Coverage report not found!" && exit 1
fi
42 changes: 0 additions & 42 deletions .github/workflows/trigger_sonar.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ Carthage/Build
#
*/Podfile.lock
*/Pods/

# Sonar
sonar-reports/*
.scannerwork
compile_commands.json
Coverage.xml
*.log
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM sonarqube:community
COPY sonar-custom-plugin-*.jar /opt/sonarqube/extensions/
31 changes: 16 additions & 15 deletions Example/TrustlySDK/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

self.establishData = ["accessId": "<ACCESS_ID>",
"merchantId" : "<MERCHANT_ID>",
"currency" : "USD",
"amount" : "1.00",
"merchantReference" : "<MERCHANT_REFERENCE>",
"paymentType" : "Retrieval",
"returnUrl": "/returnUrl",
"cancelUrl": "/cancelUrl",
"requestSignature": "<REQUEST_SIGNATURE>",
"customer.name": "John",
"customer.address.country": "US",
"metadata.urlScheme": "demoapp://",
"description": "First Data Mobile Test",
"env": "<[int, sandbox, local]>",
"envHost": "<YOUR LOCAL URL WHEN `ENV` PROPERTY IS `LOCAL` (ex: 192.168.0.30:8000)>"]
self.establishData = [
"accessId": "A48B73F694C4C8EE6306",
"merchantId" : "110005514",
"currency" : "USD",
"amount" : "1.00",
"merchantReference" : "cac73df7-52b4-47d7-89d3-9628d2cfb65e",
"paymentType" : "Retrieval",
"returnUrl": "/returnUrl",
"cancelUrl": "/cancelUrl",
"requestSignature": "HT5mVOqBXa8ZlvgX2USmPeLns5o=",
"customer.name": "John",
"customer.address.country": "US",
"metadata.urlScheme": "demoapp://",
"description": "First Data Mobile Test",
"env": "int",
"localUrl": "192.168.0.13"]


self.trustlyView.onChangeListener { (eventName, attributes) in
Expand Down
2 changes: 2 additions & 0 deletions Sources/TrustlySDK/Session/SessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ struct SessionCid: Codable {
func isValid(expirationTimeLimit: Int) -> Bool {
let dateNow = Date()


let diffs = Calendar.current.dateComponents([.hour], from: expirationTime, to: dateNow)


if let hours = diffs.hour {
return hours < expirationTimeLimit
}
Expand Down
Loading