Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2010c33
Add reference ID customer parameter
mikeybeck May 29, 2019
b0db8f2
Merge pull request #7 from blasttech/blasttech-master
mikeybeck May 29, 2019
3475de9
Fix error message not being returned as part of response detail
mikeybeck Jun 10, 2019
4891675
Merge pull request #8 from blasttech/blasttech-master
mikeybeck Jun 10, 2019
cea33a4
wip - migrating to new endpoints
mikeybeck Aug 27, 2019
4975804
wip - still migrating to new endpoints
mikeybeck Aug 27, 2019
0bf2439
wip
mikeybeck Aug 28, 2019
e0b91e5
wip
mikeybeck Aug 28, 2019
5118710
Finish updating ChargeRequest class
mikeybeck Aug 28, 2019
2587712
Remove unused variable, rearrange function order
mikeybeck Aug 28, 2019
5b09b94
Update CreateCustomerRequest file
mikeybeck Aug 28, 2019
6a35211
wip - updating CreateCardRequest file
mikeybeck Aug 28, 2019
df28cb3
Finish updating CreateCardRequest file
mikeybeck Aug 28, 2019
5f33520
Update FetchCustomerRequest file
mikeybeck Aug 28, 2019
f1817fe
Update RefundRequest
mikeybeck Aug 29, 2019
83b642f
Update RefundResponse
mikeybeck Aug 29, 2019
7bb320a
Merge pull request #9 from blasttech/update-deprecated-endpoints
mikeybeck Aug 29, 2019
e0d3908
Added address bag into create customer request
ivanhennig Sep 27, 2019
40198f6
Merge pull request #10 from blasttech/create-customer-address
ivanhennig Oct 3, 2019
8f221e4
Update UpdateCustomerRequest class to work with updated Square API
mikeybeck Oct 14, 2019
638f058
Merge pull request #11 from blasttech/fix-update-customer-request
mikeybeck Oct 14, 2019
a443b8b
Add note data to charge request
mikeybeck Apr 8, 2020
55a7da6
Use Square PHP SDK
millnut Jun 28, 2021
5a84ffc
Update ChargeRequest to new Square API
millnut Jun 28, 2021
6dea045
Update ChargeRequest to support Verification Token
millnut Jun 28, 2021
3b84557
Change case of verification token
millnut Jun 28, 2021
7b08873
Update all requests to use Square PHP SDK
millnut Jun 28, 2021
3b368d1
fix: Get correct ID in getTransactionReference function
mikeybeck Aug 13, 2021
c277a53
fix: Update ListTransactionsRequest class to match other request classes
mikeybeck Aug 13, 2021
f93f21a
Merge branch 'master' into feature/square-php-sdk
mikeybeck Aug 19, 2021
338407f
Remove $liveEndpoint and $testEndpoint variables as these are not nee…
millnut Aug 22, 2021
397026f
Merge pull request #13 from deckbooks/feature/square-php-sdk
mikeybeck Aug 22, 2021
8c134c0
fix: Update listTransactions endpoint to no longer use deprecated API
mikeybeck Aug 22, 2021
a7fd9db
fix: Update new card endpoints to be compatible with Square SDK
mikeybeck Aug 23, 2021
55106f9
fix: Fix undefined index exception when handling error
mikeybeck Aug 23, 2021
58d0040
Merge pull request #1 from blasttech/deckbooks-square-php-sdk
millnut Oct 6, 2021
3d9bdb9
Updated to latest square sdk
millnut Oct 6, 2021
6b44515
Updated DeleteCardRequest.php to use new DisableCard API
millnut Oct 6, 2021
580316a
Updated ListRefundsRequest.php.php to use new Refunds API
millnut Oct 6, 2021
338ffdb
Merge pull request #18 from deckbooks/feature/square-php-sdk
mikeybeck Oct 18, 2021
6890700
merge Deckbooks / blasttech upgrades
Alofoxx Dec 5, 2022
130273a
Merge branch 'blasttech-deckbooks-square-php-sdk' into dev-3.x
Alofoxx Dec 5, 2022
2595465
Move purchase to /v2/payments API and implement create payment
Alofoxx Dec 6, 2022
927ff05
add complete payment for completePurchase method
Alofoxx Dec 7, 2022
9f6a624
Merge pull request #3 from Alofoxx/payments-api-messages
Alofoxx Jan 10, 2023
4fae96d
update branch-alias for 3.0.x
Alofoxx Jan 11, 2023
158e369
Merge pull request #4 from Alofoxx/3.x
Alofoxx Jan 11, 2023
3aa0e56
fix: correctly form response message for getMessage()
Alofoxx Jan 11, 2023
78604eb
feat: Add ability to get receipt number
Alofoxx Mar 9, 2023
684200c
Merge pull request #5 from Alofoxx/3.x
Alofoxx Mar 9, 2023
24f6332
Release 3.0.3 as stable (#6)
Alofoxx Mar 3, 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
25 changes: 20 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 8.1
- 8.2

before_script:
- composer install -n --dev --prefer-source
dist: focal

addons:
apt:
packages:
- libonig5

# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

# Cache composer
cache:
directories:
- $HOME/.composer/cache

install:
- travis_retry composer install --prefer-dist --no-interaction

script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

**Square driver for the Omnipay PHP payment processing library**

[![Build Status](https://travis-ci.org/Transportersio/omnipay-square.png?branch=master)](https://travis-ci.org/Transportersio/omnipay-square)
[![Latest Stable Version](https://poser.pugx.org/transportersio/omnipay-square/version.png)](https://packagist.org/packages/transportersio/omnipay-square)
[![Total Downloads](https://poser.pugx.org/transportersio/omnipay-square/d/total.png)](https://packagist.org/packages/transportersio/omnipay-square)
[![License](https://poser.pugx.org/transportersio/omnipay-square/license)](https://packagist.org/packages/transportersio/omnipay-square)
[![Build Status](https://app.travis-ci.com/Alofoxx/omnipay-square.svg?branch=master)](https://app.travis-ci.com/Alofoxx/omnipay-square)
[![Latest Stable Version](https://poser.pugx.org/alofoxx/omnipay-square/version.png)](https://packagist.org/packages/alofoxx/omnipay-square)
[![Total Downloads](https://poser.pugx.org/alofoxx/omnipay-square/d/total.png)](https://packagist.org/packages/alofoxx/omnipay-square)
[![License](https://poser.pugx.org/alofoxx/omnipay-square/license)](https://packagist.org/packages/alofoxx/omnipay-square)

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
processing library for PHP 5.3+. This package implements Square support for Omnipay.
processing library for PHP 7.2+. This package implements Square support for Omnipay.

_Note that this package is only tested with PHP 8.0 and above._
## Installation

Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
Expand All @@ -18,13 +19,11 @@ to your `composer.json` file:
```json
{
"require": {
"transportersio/omnipay-square": "~2.1"
"alofoxx/omnipay-square": "~3.0"
}
}
```

For omnipay v2 use tag 1.0.5 instead.

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php
Expand All @@ -49,5 +48,13 @@ If you want to keep up to date with release anouncements, discuss ideas for the
or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which
you can subscribe to.

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/Transportersio/omnipay-square/issues),
If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/alofoxx/omnipay-square/issues),
or better yet, fork the library and submit a pull request.

## Older Versions
This package is a fork of the original [omnipay-square](https://github.com/transportersio/omnipay-square) package.
The original package is no longer maintained and this repo has merged in the [community made](https://github.com/alofoxx/omnipay-square/graphs/contributors) PRs and updates.
This package is a continuation of the original package with the following changes:
- Updated to work with the latest version of Omnipay
- Updated to work with the latest version of Square
- Updated to work with the latest version of PHP
26 changes: 18 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "blasttech/omnipay-square",
"name": "alofoxx/omnipay-square",
"type": "library",
"description": "Square driver for the Omnipay payment processing library",
"keywords": [
Expand All @@ -10,31 +10,41 @@
"payment",
"square"
],
"homepage": "https://github.com/transportersio/omnipay-square",
"homepage": "https://github.com/alofoxx/omnipay-square",
"license": "MIT",
"authors": [
{
"name": "Siriphan Boonmee",
"email": "[email protected]"
"name": "Alofoxx",
"email": "[email protected]"
},
{
"name": "Omnipay Contributors",
"homepage": "https://github.com/transportersio/omnipay-square/contributors"
"homepage": "https://github.com/alofoxx/omnipay-square/graphs/contributors"
}
],
"autoload": {
"psr-4": { "Omnipay\\Square\\" : "src/" }
},
"require": {
"omnipay/common": "~3.0",
"square/connect": "*"
"square/square": "*"
},
"require-dev": {
"omnipay/tests": "~3.0"
"omnipay/tests": "4.1.2",
"symfony/http-client": "^6.2",
"php-http/message-factory": "^1.1",
"http-interop/http-factory-guzzle": "^1.2",
"vlucas/phpdotenv": "^5.6",
"squizlabs/php_codesniffer": "*"
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "3.0.x-dev"
}
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
37 changes: 14 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Omnipay Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
</listeners>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Omnipay Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php"/>
</listeners>
</phpunit>
3 changes: 3 additions & 0 deletions src/.env.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SQUARE_APP_ID=sandbox-xxxxxx-xxxx-xxxxxxxxxxxxxxxxx
SQUARE_ACCESS_TOKEN=xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SQUARE_LOCATION_ID=xxxxxxxxxxxxx
4 changes: 2 additions & 2 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ public function setIdempotencyKey($value)

public function purchase(array $parameters = [])
{
return $this->createRequest('\Omnipay\Square\Message\ChargeRequest', $parameters);
return $this->createRequest('\Omnipay\Square\Message\CreatePaymentRequest', $parameters);
}

public function completePurchase(array $parameters = [])
{
return $this->createRequest('\Omnipay\Square\Message\TransactionRequest', $parameters);
return $this->createRequest('\Omnipay\Square\Message\CompletePaymentRequest', $parameters);
}

/**
Expand Down
19 changes: 9 additions & 10 deletions src/Message/CardResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RedirectResponseInterface;
use Square\Models\Card;

/**
* Square Purchase Response
Expand All @@ -26,23 +27,21 @@ public function getErrorCode()
return $this->data['code'];
}

public function getCard()
public function getCard(): ?Card
{
if(isset($this->data['card'])){
if(!empty($this->data['card'])){
return $this->data['card'];
}
if (!empty($this->data['card'])) {
return $this->data['card'];
}

return null;
}

public function getCardReference()
public function getCardReference(): ?string
{
if(isset($this->data['card'])){
if(!empty($this->data['card'])){
return $this->data['card']['id'];
}
if (!empty($this->data['card'])) {
return $this->data['card']->getId();
}

return null;
}
}
Loading