Skip to content

Commit

Permalink
Merge pull request #148 from alma/release/v2.3.0
Browse files Browse the repository at this point in the history
Release v2.3.0
  • Loading branch information
joyet-simon authored Nov 4, 2024
2 parents 37495b0 + 213741b commit 1404d37
Show file tree
Hide file tree
Showing 23 changed files with 894 additions and 18 deletions.
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

0 comments on commit 1404d37

Please sign in to comment.