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

Release v2.3.0 #148

Merged
merged 31 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ac79e56
Merge pull request #136 from alma/chore/backport-main-to-develop
hyahiaoui Sep 5, 2024
e9b8bed
chore(deps): update github actions
alma-renovate-bot[bot] Sep 9, 2024
059c1c9
Merge pull request #134 from alma/renovate/github-actions
hyahiaoui Sep 10, 2024
ccd813b
chore(deps): update dependency ubuntu to v24
alma-renovate-bot[bot] Sep 30, 2024
07e72e8
Merge pull request #138 from alma/renovate/github-actions
remi-zuffinetti Sep 30, 2024
ea76db2
chore(deps): update pre-commit hook pre-commit/pre-commit-hooks to v5…
alma-renovate-bot[bot] Oct 14, 2024
99f8d00
feat: create endpoint and formatter for gather cms data
joyet-simon Oct 16, 2024
54f89fa
fix: sonar lint
joyet-simon Oct 16, 2024
26c6fdf
fix: sonar lint
joyet-simon Oct 16, 2024
ea3f13d
feat: use isset for constructor in CmsInfo and CmsFeaturs
joyet-simon Oct 17, 2024
6cc8714
feat: after reviews
joyet-simon Oct 17, 2024
4b9ab73
feat: remove typping null in CmsInfo
joyet-simon Oct 18, 2024
4fad988
chore(deps): update pre-commit hook returntocorp/semgrep to v1.92.0
alma-renovate-bot[bot] Oct 21, 2024
8ed5363
feat: change return type of formatConfigurationPayload
joyet-simon Oct 21, 2024
6c6ff13
Merge pull request #142 from alma/feature/ecom-2116-php-client-create…
joyet-simon Oct 22, 2024
63614cd
Merge pull request #116 from alma/renovate/pre-commit-repositories
Benjamin-Freoua-Alma Oct 22, 2024
cddd6d8
feat: make nullable for alla attributes in CmsInfo and CmsFeatures
joyet-simon Oct 25, 2024
7436dc3
fix: reduce Cognitive Complexity
joyet-simon Oct 25, 2024
9b6f237
feat: remove excluded_categories_activated from CmsFeatures
joyet-simon Oct 25, 2024
25d7e2b
Merge pull request #143 from alma/feature/ecom-2116-php-client-create…
joyet-simon Oct 28, 2024
7c064e3
feat: add isUrlRefreshRequired function
joyet-simon Oct 28, 2024
c9d53b5
feat: make isUrlRefreshRequired static
joyet-simon Oct 28, 2024
ea9e016
Merge pull request #145 from alma/feature/ecom-2116-php-client-create…
joyet-simon Oct 28, 2024
1a1cbdb
feat: change CmsInfo themes to theme_name and theme_version
joyet-simon Oct 29, 2024
f405699
feat: change indent
joyet-simon Oct 30, 2024
d7cb849
fix: pass theme_name and theme_version to Camelcase
joyet-simon Oct 30, 2024
81569df
Merge pull request #146 from alma/feature/ecom-2116-php-client-create…
joyet-simon Oct 30, 2024
dafd8f5
feat: replace payment validator hmac verification by request hmac val…
Francois-Gomis Oct 30, 2024
7746a5c
Merge pull request #147 from alma/feature/ecom-2116-php-client-create…
joyet-simon Oct 30, 2024
9c267c4
chore: update version
joyet-simon Nov 4, 2024
213741b
Merge branch 'main' into release/v2.3.0
carine-bonnafous Nov 4, 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
4 changes: 2 additions & 2 deletions .github/workflows/backport-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

create-backport-pull-request:
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'release')) }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand All @@ -28,7 +28,7 @@ jobs:
git reset --hard main

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'chore: backport main to develop'
title: Backport main to develop
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
ci:
name: Linting, tests and coverage
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/hotfix-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:

create-hotfix-pull-request:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
./scripts/update-files-with-release-version.sh ${{ steps.release-drafter.outputs.tag_name }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'chore: update version'
title: Release ${{ steps.release-drafter.outputs.tag_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
contents: read
pull-requests: write

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: TimonVS/pr-labeler-action@v5
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

release:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
cc <@france.berut> <@khadija.cherif>

- name: Send changelog to Slack
uses: slackapi/slack-github-action@v1.26.0
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: CR9C57YM6
slack-message: ${{ steps.slack-markdown-release-notes.outputs.text }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:

create-release-pull-request:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
repositories: alma-php-client

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.github-token.outputs.token }}
commit-message: 'chore: update version'
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1024"]
Expand Down Expand Up @@ -35,7 +35,7 @@ repos:
stages: [commit]

- repo: https://github.com/returntocorp/semgrep
rev: v1.27.0
rev: v1.92.0
hooks:
- id: semgrep
args:
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# CHANGELOG

## v2.3.0 - 2024-11-04

### Changes

- chore(deps): update pre-commit hook returntocorp/semgrep to v1.92.0 (#116)

### 🚀 New Features

- feat: replace payment validator hmac verification by request hmac val… (#147)
- Change CmsInfo themes to theme_name and theme_version (#146)
- Add isUrlRefreshRequired function (#145)
- Make nullable for all attributes in CmsInfo and CmsFeatures (#143)
- Create endpoint and formatter for gather cms data (#142)

#### Contributors

@Benjamin-Freoua-Alma, @Francois-Gomis, @alma-renovate-bot, @alma-renovate-bot[bot], @github-actions, @hyahiaoui, @joyet-simon and @remi-zuffinetti

## v2.2.0 - 2024-09-05

### Changes
Expand Down Expand Up @@ -162,6 +180,7 @@
}



```
* Add fields and docs to the Payment entity
* Add a Refund entity and extract refunds data within the Payment entity constructor
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alma/alma-php-client",
"description": "PHP API client for the Alma payments API",
"version": "2.2.0",
"version": "2.3.0",
"type": "library",
"require": {
"php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1 || ~8.2 || ~8.3",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class Client
{
const VERSION = '2.2.0';
const VERSION = '2.3.0';

const LIVE_MODE = 'live';
const TEST_MODE = 'test';
Expand Down
19 changes: 18 additions & 1 deletion src/Endpoints/Merchants.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@

use Alma\API\Entities\FeePlan;
use Alma\API\Entities\Merchant;
use Alma\API\Entities\MerchantData\MerchantData;
use Alma\API\Exceptions\RequestException;
use Alma\API\RequestError;

class Merchants extends Base
{
const MERCHANTS_PATH = '/v1/merchants';
const ME_PATH = '/v1/me';

/**
Expand Down Expand Up @@ -81,4 +82,20 @@ public function feePlans($kind = FeePlan::KIND_GENERAL, $installmentsCounts = "a
return new FeePlan($val);
}, $res->json);
}

/**
* @param string $url The URL to send to Alma for integrations configuration
* @throws RequestException
* @throws RequestError
*/
public function sendIntegrationsConfigurationsUrl($url)
{
$res = $this->request(self::ME_PATH . "/configuration")->setRequestBody(array(
"endpoint_url" => $url
))->post();

if ($res->isError()) {
throw new RequestException($res->errorMessage, null, $res);
}
}
}
113 changes: 113 additions & 0 deletions src/Entities/MerchantData/CmsFeatures.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php

namespace Alma\API\Entities\MerchantData;

class CmsFeatures
{
/**
* @var bool | null
*/
private $almaEnabled;

/**
* @var bool | null
*/
private $widgetCartActivated;

/**
* @var bool | null
*/
private $widgetProductActivated;

/**
* @var array|null
*/
private $usedFeePlans;

/**
* @var int | null
*/
private $paymentMethodPosition;

/**
* @var bool | null
*/
private $inPageActivated;

/**
* @var bool | null
*/
private $logActivated;

/**
* @var string[]|null
*/
private $excludedCategories;

/**
* @var array<array{name: string}>|null
*/
private $specificFeatures;

/**
* @var string[]|null
*/
private $countryRestriction;

/**
* @var bool | null
*/
private $isMultisite;

/**
* @var bool | null
*/
private $customWidgetCss;

/**
* CmsFeatures constructor.
* @param array $cmsFeaturesDataArray
*/
public function __construct($cmsFeaturesDataArray)
{
// Ensure values are properly initialized
$this->almaEnabled = isset($cmsFeaturesDataArray['alma_enabled']) ? $cmsFeaturesDataArray['alma_enabled'] : null;
$this->widgetCartActivated = isset($cmsFeaturesDataArray['widget_cart_activated']) ? $cmsFeaturesDataArray['widget_cart_activated'] : null;
$this->widgetProductActivated = isset($cmsFeaturesDataArray['widget_product_activated']) ? $cmsFeaturesDataArray['widget_product_activated'] : null;
$this->usedFeePlans = isset($cmsFeaturesDataArray['used_fee_plans']) ? $cmsFeaturesDataArray['used_fee_plans'] : null;
$this->inPageActivated = isset($cmsFeaturesDataArray['in_page_activated']) ? $cmsFeaturesDataArray['in_page_activated'] : null;
$this->logActivated = isset($cmsFeaturesDataArray['log_activated']) ? $cmsFeaturesDataArray['log_activated'] : null;
$this->excludedCategories = isset($cmsFeaturesDataArray['excluded_categories']) ? $cmsFeaturesDataArray['excluded_categories'] : null;
$this->paymentMethodPosition = isset($cmsFeaturesDataArray['payment_method_position']) ? $cmsFeaturesDataArray['payment_method_position'] : null;
$this->specificFeatures = isset($cmsFeaturesDataArray['specific_features']) ? $cmsFeaturesDataArray['specific_features'] : null;
$this->countryRestriction = isset($cmsFeaturesDataArray['country_restriction']) ? $cmsFeaturesDataArray['country_restriction'] : null;
$this->isMultisite = isset($cmsFeaturesDataArray['is_multisite']) ? $cmsFeaturesDataArray['is_multisite'] : null;
$this->customWidgetCss = isset($cmsFeaturesDataArray['custom_widget_css']) ? $cmsFeaturesDataArray['custom_widget_css'] : null;
}

/**
* @return array
*/
public function getProperties()
{
// Use array_filter with ARRAY_FILTER_USE_BOTH to remove null or empty values
return array_filter([
'alma_enabled' => $this->almaEnabled,
'widget_cart_activated' => $this->widgetCartActivated,
'widget_product_activated' => $this->widgetProductActivated,
'used_fee_plans' => $this->usedFeePlans,
'in_page_activated' => $this->inPageActivated,
'log_activated' => $this->logActivated,
'excluded_categories' => $this->excludedCategories,
'payment_method_position' => $this->paymentMethodPosition,
'specific_features' => $this->specificFeatures,
'country_restriction' => $this->countryRestriction,
'is_multisite' => $this->isMultisite,
'custom_widget_css' => $this->customWidgetCss,
], function ($value) {
// Keep only values that are not null and not empty
// But keep false or 0 values
return !is_null($value) && $value !== '';
});
}
}
Loading
Loading