Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
575fb4a
Support Guzzle 7
mglaman Mar 23, 2021
72b0bb2
Merge pull request #36 from bluehorndigital/guzzle7
jsacksick Mar 2, 2023
c276d05
Fix the tests, require PHP 7.3+ and run tests via Github workflows.
jsacksick Mar 2, 2023
20bb107
Commit the Github workflows.
jsacksick Mar 2, 2023
c9fad58
Changes to test.
jsacksick Mar 2, 2023
4ed7c10
Attempt fixing the builds.
jsacksick Mar 2, 2023
36e415d
Attempt fixing the builds.
jsacksick Mar 2, 2023
c3f5877
Attempt fixing the builds.
jsacksick Mar 2, 2023
399b24d
Attempt to configure scrutinizer.
jsacksick Mar 2, 2023
63f05aa
Fix phpcs violations.
jsacksick Mar 2, 2023
94f1bde
Add a phpcs.xml.
jsacksick Mar 2, 2023
3747ce0
Fix the phpcs file extension.
jsacksick Mar 2, 2023
a016726
Add support for Accept Hosted payment form and customer profile creat…
adrian-tech-enthusiast Jul 8, 2025
97af9f8
Fix ARB subscription test failure due to past startDate:
adrian-tech-enthusiast Jul 8, 2025
9a41157
Add AuthenticateTestRequest to validate API credentials
adrian-tech-enthusiast Jul 8, 2025
1c8fd45
Add method to remove settings from HostedPaymentSettings
adrian-tech-enthusiast Oct 22, 2025
7c5ce9c
Stop testing PHP 7.3 and test newer PHP versions.
jsacksick Oct 23, 2025
e819096
Update .scrutinizer.yml
jsacksick Oct 23, 2025
59f1fd1
Change PHP version from 8.3 to 8.2
jsacksick Oct 23, 2025
bebf981
Merge pull request #43 from adrian-tech-enthusiast-c/master
jsacksick Oct 23, 2025
d0aa608
Implicitly marking parameter as nullable is deprecated.
jsacksick Oct 23, 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
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build
on: [push, pull_request]

jobs:
run-test-php81:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: "8.1"

- name: PHPUnit Tests PHP 78.1
uses: php-actions/phpunit@master
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml.dist
args: --coverage-text
php_extensions: xdebug
php_version: 8.1
memory_limit: "192M"
version: 9
env:
XDEBUG_MODE: coverage

run-test-php82:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: "8.2"

- name: PHPUnit Tests PHP 78.1
uses: php-actions/phpunit@master
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml.dist
args: --coverage-text
php_extensions: xdebug
php_version: 8.2
memory_limit: "192M"
version: 9
env:
XDEBUG_MODE: coverage

run-test-php83:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: "8.3"

- name: PHPUnit Tests PHP 78.1
uses: php-actions/phpunit@master
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml.dist
args: --coverage-text
php_extensions: xdebug
php_version: 8.3
memory_limit: "192M"
version: 9
env:
XDEBUG_MODE: coverage

run-test-php84:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: "8.4"

- name: PHPUnit Tests PHP 78.1
uses: php-actions/phpunit@master
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml.dist
args: --coverage-text
php_extensions: xdebug
php_version: 8.4
memory_limit: "192M"
version: 9
env:
XDEBUG_MODE: coverage
16 changes: 9 additions & 7 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ filter:
paths:
- src/*
build:
tests:
override:
-
command: phpunit --coverage-clover=my-coverage-file
coverage:
file: my-coverage-file
format: php-clover
nodes:
analysis:
environment:
php:
version: 8.2
tests:
override:
- php-scrutinizer-run
- phpcs-run
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Authorize.net PHP SDK
=====================

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/commerceguys/authnet/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/commerceguys/authnet/?branch=master) [![Build Status](https://travis-ci.org/commerceguys/authnet.svg?branch=master)](https://travis-ci.org/commerceguys/authnet) [![Code Coverage](https://scrutinizer-ci.com/g/commerceguys/authnet/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/commerceguys/authnet/?branch=master) [![Packagist](https://img.shields.io/packagist/dm/commerceguys/authnet.svg)](https://packagist.org/packages/commerceguys/authnet)[![Packagist](https://img.shields.io/packagist/v/commerceguys/authnet.svg)](https://packagist.org/packages/commerceguys/authnet)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/commerceguys/authnet/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/commerceguys/authnet/?branch=master) [![Build Status](https://github.com/commerceguys/authnet/actions/workflows/build.yml/badge.svg)](https://github.com/commerceguys/authnet/actions/workflows/build.yml) [![Code Coverage](https://scrutinizer-ci.com/g/commerceguys/authnet/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/commerceguys/authnet/?branch=master) [![Packagist](https://img.shields.io/packagist/dm/commerceguys/authnet.svg)](https://packagist.org/packages/commerceguys/authnet)[![Packagist](https://img.shields.io/packagist/v/commerceguys/authnet.svg)](https://packagist.org/packages/commerceguys/authnet)

An SDK for Authorize.net, using Guzzle.

Expand All @@ -13,14 +13,14 @@ An SDK for Authorize.net, using Guzzle.

## Dependencies

PHP version >= 5.5.0 is required.
PHP version >= 7.3 is required.

The following PHP extensions are required:
* json
* simplexml
* xmlwrite

This library also uses Guzzle 6.
This library uses Guzzle, v6 minimum.

## Testing

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"type": "library",
"keywords": ["authorizenet", "authorize.net", "payment", "ecommerce"],
"require": {
"php": ">=5.5",
"php": ">=7.3",
"ext-json": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"guzzlehttp/guzzle": "~6.2"
"guzzlehttp/guzzle": "^6.2 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"squizlabs/php_codesniffer": "~2"
"phpunit/phpunit": "^9.5.23",
"squizlabs/php_codesniffer": "~3"
},
"license": "MIT",
"authors": [
Expand Down
6 changes: 6 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<file>./</file>
<exclude-pattern>./vendor/*</exclude-pattern>
<rule ref="PSR2" />
</ruleset>
64 changes: 30 additions & 34 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/bootstrap.php" verbose="true" colors="true">

<testsuites>
<testsuite name="AutheNet Tests">
<directory>./tests</directory>
</testsuite>
</testsuites>

<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false" lowUpperBound="50" highLowerBound="80" />
<log type="coverage-clover" target="./clover.xml" />
</logging>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory>./vendor</directory>
<directory>./tests</directory>
<directory>./build</directory>
</exclude>
</whitelist>
</filter>

<php>
<const name="PHPUNIT_TESTSUITE" value="true" />
<!-- Enter your test account credentials to run tests against sandbox. -->
<const name="AUTHORIZENET_API_LOGIN_ID" value="5KP3u95bQpv" />
<const name="AUTHORIZENET_TRANSACTION_KEY" value="346HZ32z3fP4hTG2" />
<const name="AUTHORIZENET_MD5_SETTING" value="" />
<!-- Path to certificate, or `true` to use system certificates. -->
<const name="TESTS_CERTIFICATE_VERIFY" value="resources/cert.pem" />
</php>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/bootstrap.php" verbose="true" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory>./vendor</directory>
<directory>./tests</directory>
<directory>./build</directory>
</exclude>
<report>
<clover outputFile="./clover.xml"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>
<testsuites>
<testsuite name="AutheNet Tests">
<directory>./tests</directory>
</testsuite>
</testsuites>
<logging/>
<php>
<const name="PHPUNIT_TESTSUITE" value="true"/>
<!-- Enter your test account credentials to run tests against sandbox. -->
<const name="AUTHORIZENET_API_LOGIN_ID" value="5KP3u95bQpv"/>
<const name="AUTHORIZENET_TRANSACTION_KEY" value="346HZ32z3fP4hTG2"/>
<const name="AUTHORIZENET_MD5_SETTING" value=""/>
<!-- Path to certificate, or `true` to use system certificates. -->
<const name="TESTS_CERTIFICATE_VERIFY" value="resources/cert.pem"/>
</php>
</phpunit>
2 changes: 0 additions & 2 deletions src/ARBCancelSubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace CommerceGuys\AuthNet;

use GuzzleHttp\Client;
use CommerceGuys\AuthNet\DataTypes\Paging;
use CommerceGuys\AuthNet\DataTypes\Sorting;
use CommerceGuys\AuthNet\Request\RequestInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ARBCreateSubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ARBCreateSubscriptionRequest extends ARBSubscriptionRequest
public function __construct(
Configuration $configuration,
Client $client,
Subscription $subscription = null
?Subscription $subscription = null
) {
parent::__construct($configuration, $client);
$this->subscription = $subscription;
Expand Down
2 changes: 0 additions & 2 deletions src/ARBGetSubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace CommerceGuys\AuthNet;

use GuzzleHttp\Client;
use CommerceGuys\AuthNet\DataTypes\Paging;
use CommerceGuys\AuthNet\DataTypes\Sorting;
use CommerceGuys\AuthNet\Request\RequestInterface;

/**
Expand Down
2 changes: 0 additions & 2 deletions src/ARBGetSubscriptionStatusRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace CommerceGuys\AuthNet;

use GuzzleHttp\Client;
use CommerceGuys\AuthNet\DataTypes\Paging;
use CommerceGuys\AuthNet\DataTypes\Sorting;
use CommerceGuys\AuthNet\Request\RequestInterface;

/**
Expand Down
5 changes: 0 additions & 5 deletions src/ARBSubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace CommerceGuys\AuthNet;

use GuzzleHttp\Client;
use CommerceGuys\AuthNet\DataTypes\Paging;
use CommerceGuys\AuthNet\DataTypes\Sorting;
use CommerceGuys\AuthNet\Request\RequestInterface;

/**
* Use this method to create subscriptions using Automated Recurring Billing.
*
Expand Down
3 changes: 1 addition & 2 deletions src/ARBUpdateSubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace CommerceGuys\AuthNet;

use GuzzleHttp\Client;
use CommerceGuys\AuthNet\DataTypes\Subscription;
use CommerceGuys\AuthNet\Request\RequestInterface;

/**
Expand All @@ -19,7 +18,7 @@ public function __construct(
$subscriptionId
) {
parent::__construct($configuration, $client);
$this->subscriptionId = $subscription;
$this->subscriptionId = $subscriptionId;
}

protected function attachData(RequestInterface $request)
Expand Down
54 changes: 54 additions & 0 deletions src/AuthenticateTestRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace CommerceGuys\AuthNet;

use CommerceGuys\AuthNet\DataTypes\MerchantAuthentication;
use CommerceGuys\AuthNet\Request\RequestInterface;

/**
* Represents the authenticateTestRequest endpoint for testing API credentials.
*
* This request verifies that the provided API Login ID and Transaction Key
* are valid and that the merchant is authorized to submit transactions.
*
* Commonly used to validate configuration forms or connectivity.
*
* @link https://developer.authorize.net/api/reference/index.html#gettingstarted-section-section-header
*/
class AuthenticateTestRequest extends BaseApiRequest
{

/**
* Sets the merchant authentication credentials.
*
* @param \CommerceGuys\AuthNet\DataTypes\MerchantAuthentication $merchantAuthentication
*
* @return $this
*/
public function setMerchantAuthentication(MerchantAuthentication $merchantAuthentication): self
{
$this->merchantAuthentication = $merchantAuthentication;
return $this;
}

/**
* Gets the merchant authentication credentials.
*
* @return \CommerceGuys\AuthNet\DataTypes\MerchantAuthentication|null
*/
public function getMerchantAuthentication(): ?MerchantAuthentication
{
return $this->merchantAuthentication;
}

/**
* {@inheritdoc}
*/
protected function attachData(RequestInterface $request): void
{
// Only attach merchant authentication if available.
if ($this->merchantAuthentication) {
$request->addDataType($this->merchantAuthentication);
}
}
}
1 change: 0 additions & 1 deletion src/BaseApiRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use CommerceGuys\AuthNet\Request\JsonRequest;
use CommerceGuys\AuthNet\Request\RequestInterface;
use CommerceGuys\AuthNet\Request\XmlRequest;
use CommerceGuys\AuthNet\Response\JsonResponse;

abstract class BaseApiRequest implements ApiRequestInterface
{
Expand Down
Loading