Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
13a280d
Add methods for DataExports endpoints
martinfobian Sep 23, 2024
8faeaf3
Remove ping to France in Slack release messages
carine-bonnafous Jan 30, 2025
160dbb3
Merge pull request #163 from alma/chore/backport-main-to-develop
Francois-Gomis Jan 30, 2025
b16c004
Merge pull request #164 from alma/devx/remove-cc-france-in-release-sl…
carine-bonnafous Jan 30, 2025
617d64e
Merge branch 'chore/review-external-pr' into main
joyet-simon Feb 21, 2025
5df947c
Merge pull request #137 from martinfobian/main
joyet-simon Feb 21, 2025
1c3f322
feat: add doc block and unit tests for DataExports endpoint
joyet-simon Feb 26, 2025
37f3519
feat: add doc block and unit tests for DataExports endpoint
joyet-simon Feb 26, 2025
cb9ec88
fix: add newline at end of file where it's missing
joyet-simon Feb 26, 2025
8d92bc3
fix: rename data to responseFile
joyet-simon Feb 28, 2025
d8f9d39
Merge pull request #166 from alma/chore/review-external-pr
joyet-simon Mar 4, 2025
bc7b290
chore(deps): pin dependencies (#167)
alma-renovate-bot[bot] Mar 18, 2025
6610e52
chore(deps): update github actions (#168)
alma-renovate-bot[bot] Mar 24, 2025
db08182
chore(deps): update actions/create-github-app-token action to v1.12.0
alma-renovate-bot[bot] Apr 7, 2025
636f9a0
chore(deps): update actions/create-github-app-token action to v2
alma-renovate-bot[bot] Apr 7, 2025
5d6d230
Merge pull request #171 from alma/renovate/github-actions
remi-zuffinetti Apr 7, 2025
91ea1ad
Merge branch 'develop' into renovate/major-github-actions
remi-zuffinetti Apr 7, 2025
523aca6
Merge pull request #172 from alma/renovate/major-github-actions
carine-bonnafous Apr 8, 2025
d49b917
chore(deps): update shivammathur/setup-php action to v2.33.0
alma-renovate-bot[bot] Apr 21, 2025
d68f73b
Merge pull request #174 from alma/renovate/github-actions
remi-zuffinetti Apr 22, 2025
f6e8e96
chore(deps): update google-github-actions/auth action to v2.1.10 (#175)
alma-renovate-bot[bot] Apr 28, 2025
c65adc3
chore(deps): update actions/create-github-app-token action to v2.0.6 …
alma-renovate-bot[bot] May 5, 2025
f2973a2
chore(deps): update slackapi/slack-github-action action to v2.1.0 (#178)
alma-renovate-bot[bot] May 12, 2025
6c0af68
chore(deps): update shivammathur/setup-php action to v2.34.1 (#180)
alma-renovate-bot[bot] Jul 1, 2025
62ed538
chore(deps): update github actions (#184)
alma-renovate-bot[bot] Sep 1, 2025
fc4227f
chore(deps): update github actions
alma-renovate-bot[bot] Sep 1, 2025
c933e32
Merge pull request #183 from alma/renovate/github-actions
remi-zuffinetti Sep 1, 2025
3335bd0
chore: update version
joyet-simon Sep 1, 2025
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
6 changes: 3 additions & 3 deletions .github/workflows/aqua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
show-progress: false

- name: Authenticate to Google Cloud
id: gcloud-auth
uses: google-github-actions/auth@v2
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
token_format: access_token
workload_identity_provider: projects/699052769907/locations/global/workloadIdentityPools/github-identity-pool-shared/providers/github-identity-provider-shared # yamllint disable-line
service_account: github-gar-alma-php-client@lyrical-carver-335213.iam.gserviceaccount.com

- name: Authenticate to Artifact Registry
uses: docker/login-action@v3
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: europe-docker.pkg.dev
username: oauth2accesstoken
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backport-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:

- uses: actions/checkout@v4
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: develop

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

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
commit-message: 'chore: backport main to develop'
title: Backport main to develop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # 2.35.4
with:
php-version: ${{ matrix.php }}
tools: composer:v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/hotfix-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:

steps:

- uses: actions/checkout@v4
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: main

- name: Release drafter
uses: release-drafter/release-drafter@v6
uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update release draft
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const { owner, repo } = context.repo;
Expand All @@ -39,7 +39,7 @@ jobs:
});

- name: Update CHANGELOG.md file
uses: stefanzweifel/changelog-updater-action@v1
uses: stefanzweifel/changelog-updater-action@a938690fad7edf25368f37e43a1ed1b34303eb36 # v1.12.0
with:
latest-version: ${{ steps.release-drafter.outputs.tag_name }}
release-notes: "### 🐛 Bug Fixes\n ${{ inputs.changelog-message }}\n"
Expand All @@ -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@v7
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
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 @@ -11,6 +11,6 @@ jobs:

runs-on: ubuntu-24.04
steps:
- uses: TimonVS/pr-labeler-action@v5
- uses: TimonVS/pr-labeler-action@f9c084306ce8b3f488a8f3ee1ccedc6da131d1af # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 5 additions & 5 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:

- uses: actions/checkout@v4
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Install taskfile.dev
uses: arduino/setup-task@v2
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.fetch-release-draft.outputs.id }}/assets?name=alma-php-client.zip

- name: Publish Github release
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
# target_commitish is set to refs/heads/develop by release-drafter as we need to retrieve pull requests merged into develop
# We need to override it to refs/heads/main to point to the last commit of main branch instead of develop branch
Expand All @@ -102,18 +102,18 @@ jobs:
});

- name: Format release notes for Slack
uses: LoveToKnow/slackify-markdown-action@v1.1.1
uses: LoveToKnow/slackify-markdown-action@698a1d4d0ff1794152a93c03ee8ca5e03a310d4e # v1.1.1
id: slack-markdown-release-notes
with:
text: |
New release of ${{ github.repository }}, **[${{ steps.fetch-release-draft.outputs.name }}](https://github.com/${{ github.repository }}/releases/tag/${{ steps.fetch-release-draft.outputs.name }})**:

${{ steps.fetch-release-draft.outputs.body }}

cc <@france.berut> <@khadija.cherif>
cc <@khadija.cherif>

- name: Send changelog to Slack
uses: slackapi/slack-github-action@v2.0.0
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_RELEASE_CHANGELOG_BOT_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:

- uses: actions/checkout@v4
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: main
persist-credentials: false
Expand All @@ -24,7 +24,7 @@ jobs:
git reset --hard develop

- name: Create release draft
uses: release-drafter/release-drafter@v6
uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
id: release-drafter
with:
# release-drafter should be based on develop to get the correct content as pull requests are merged into develop
Expand All @@ -35,7 +35,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update CHANGELOG.md
uses: stefanzweifel/changelog-updater-action@v1
uses: stefanzweifel/changelog-updater-action@a938690fad7edf25368f37e43a1ed1b34303eb36 # v1.12.0
with:
latest-version: ${{ steps.release-drafter.outputs.tag_name }}
release-notes: ${{ steps.release-drafter.outputs.body }}
Expand All @@ -47,15 +47,15 @@ jobs:
# If using default Github token, the created pull request won't trigger workflows with pull_request event
# See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
- name: Generate Github token to create PR
uses: actions/create-github-app-token@v1
uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: github-token
with:
app-id: ${{ secrets.ALMA_CREATE_TEAM_PRS_APP_ID }}
private-key: ${{ secrets.ALMA_CREATE_TEAM_PRS_APP_PEM }}
repositories: alma-php-client

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
token: ${{ steps.github-token.outputs.token }}
commit-message: 'chore: update version'
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## v2.5.1 - 2025-09-01

### Changes

- Add DataExports endpoints (#137)

#### Contributors

@Francois-Gomis, @alma-renovate-bot[bot], @carine-bonnafous, @joyet-simon, @martinfobian, @remi-zuffinetti, [alma-renovate-bot[bot]](https://github.com/apps/alma-renovate-bot) and [github-actions[bot]](https://github.com/apps/github-actions)

## v2.5.0 - 2025-01-30

### Changes
Expand Down Expand Up @@ -220,6 +230,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.5.0",
"version": "2.5.1",
"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
8 changes: 7 additions & 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.5.0';
const VERSION = '2.5.1';

const LIVE_MODE = 'live';
const TEST_MODE = 'test';
Expand Down Expand Up @@ -70,6 +70,11 @@ class Client
* @var Endpoints\Insurance
*/
public $insurance;

/**
* @var Endpoints\DataExports
*/
public $dataExports;
/*************************/
/**
* @var Endpoints\Configuration
Expand Down Expand Up @@ -155,6 +160,7 @@ private function initEndpoints()
$this->shareOfCheckout = new Endpoints\ShareOfCheckout($this->context);
$this->webhooks = new Endpoints\Webhooks($this->context);
$this->insurance = new Endpoints\Insurance($this->context);
$this->dataExports = new Endpoints\DataExports($this->context);
$this->configuration = new Endpoints\Configuration($this->context);
}

Expand Down
100 changes: 100 additions & 0 deletions src/Endpoints/DataExports.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
/**
* Copyright (c) 2018 Alma / Nabla SAS
*
* THE MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* @author Alma / Nabla SAS <contact@getalma.eu>
* @copyright Copyright (c) 2018 Alma / Nabla SAS
* @license https://opensource.org/licenses/MIT The MIT License
*
*/

namespace Alma\API\Endpoints;

use Alma\API\Entities\DataExport;
use Alma\API\Exceptions\ParametersException;
use Alma\API\Exceptions\RequestException;
use Alma\API\ParamsError;
use Alma\API\RequestError;

class DataExports extends Base
{
const DATA_EXPORTS_PATH = '/v1/data-exports';
const ACCEPTED_FORMAT = ['csv', 'xlsx'];

/**
* @param $data
*
* @return DataExport
*
* @throws RequestException|RequestError
*/
public function create($data)
{
$res = $this->request(self::DATA_EXPORTS_PATH)->setRequestBody($data)->post();

if ($res->isError()) {
throw new RequestException($res->errorMessage, null, $res);
}

return new DataExport($res->json);
}

/**
* @param $reportId
*
* @return DataExport
*
* @throws RequestException|RequestError
*/
public function fetch($reportId)
{
$res = $this->request(self::DATA_EXPORTS_PATH . '/' . $reportId)->get();

if ($res->isError()) {
throw new RequestException($res->errorMessage, null, $res);
}

return new DataExport($res->json);
}

/**
* @param $reportId
*
* @param string $format only csv or xlsx
*
* @return mixed
*
* @throws RequestException|RequestError|ParametersException
*/
public function download($reportId, $format)
{
if (!in_array($format, self::ACCEPTED_FORMAT)) {
throw new ParametersException("Invalid format: $format. Accepted format are: " . implode(', ', self::ACCEPTED_FORMAT));
}

$res = $this->request(self::DATA_EXPORTS_PATH . '/' . $reportId)
->setQueryParams(['format' => $format])
->get();

if ($res->isError()) {
throw new RequestException($res->errorMessage, null, $res);
}

return $res->responseFile;
}
}
Loading