Skip to content

Commit c8b108c

Browse files
Merge pull request #75 from globalpayments/20210105-deployment
20210105 deployment
2 parents 5cf1b51 + ea39c07 commit c8b108c

32 files changed

+12585
-12626
lines changed

phpunit.xml.dist

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="./test/setup.php"
5-
colors="true"
6-
processIsolation="false"
7-
stopOnFailure="true"
8-
>
9-
<php>
10-
<ini name="zend.enable_gc" value="0"/>
11-
<ini name="memory_limit" value="-1"/>
12-
<!-- error_reporting(E_ALL); -->
13-
<ini name="error_reporting" value="32767"/>
14-
</php>
15-
16-
<testsuites>
17-
<testsuite name="all">
18-
<directory>./test/</directory>
19-
</testsuite>
20-
<testsuite name="unit">
21-
<directory>./test/Unit/</directory>
22-
</testsuite>
23-
<testsuite name="integration">
24-
<directory>./test/Integration/</directory>
25-
</testsuite>
26-
<testsuite name="certification">
27-
<directory>./test/Integration/Gateways/PorticoConnector/Certifications/</directory>
28-
<directory>./test/Integration/Gateways/RealexConnector/Certifications/</directory>
29-
</testsuite>
30-
<testsuite name="portico">
31-
<directory>./test/Integration/Gateways/PorticoConnector/</directory>
32-
</testsuite>
33-
<testsuite name="realex">
34-
<directory>./test/Integration/Gateways/RealexConnector/</directory>
35-
</testsuite>
36-
37-
</testsuites>
38-
39-
<filter>
40-
<whitelist>
41-
<directory>./src/</directory>
42-
<exclude>
43-
<directory>./test/</directory>
44-
</exclude>
45-
</whitelist>
46-
</filter>
47-
</phpunit>
48-
<!-- vim: set ft=xml -->
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="./test/setup.php"
5+
colors="true"
6+
processIsolation="false"
7+
stopOnFailure="false"
8+
>
9+
<php>
10+
<ini name="zend.enable_gc" value="0"/>
11+
<ini name="memory_limit" value="-1"/>
12+
<!-- error_reporting(E_ALL); -->
13+
<ini name="error_reporting" value="32767"/>
14+
</php>
15+
16+
<testsuites>
17+
<testsuite name="all">
18+
<directory>./test/</directory>
19+
</testsuite>
20+
<testsuite name="unit">
21+
<directory>./test/Unit/</directory>
22+
</testsuite>
23+
<testsuite name="integration">
24+
<directory>./test/Integration/</directory>
25+
</testsuite>
26+
<testsuite name="certification">
27+
<directory>./test/Integration/Gateways/PorticoConnector/Certifications/</directory>
28+
<directory>./test/Integration/Gateways/RealexConnector/Certifications/</directory>
29+
</testsuite>
30+
<testsuite name="portico">
31+
<directory>./test/Integration/Gateways/PorticoConnector/</directory>
32+
</testsuite>
33+
<testsuite name="realex">
34+
<directory>./test/Integration/Gateways/RealexConnector/</directory>
35+
</testsuite>
36+
37+
</testsuites>
38+
39+
<filter>
40+
<whitelist>
41+
<directory>./src/</directory>
42+
<exclude>
43+
<directory>./test/</directory>
44+
</exclude>
45+
</whitelist>
46+
</filter>
47+
</phpunit>
48+
<!-- vim: set ft=xml -->

sami.phar

-2.35 MB
Binary file not shown.

src/Entities/RecurringEntity.php

Lines changed: 111 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,111 @@
1-
<?php
2-
3-
namespace GlobalPayments\Api\Entities;
4-
5-
use GlobalPayments\Api\ServicesContainer;
6-
use GlobalPayments\Api\Entities\Exceptions\ApiException;
7-
use GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException;
8-
use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod;
9-
use GlobalPayments\Api\Services\RecurringService;
10-
11-
/**
12-
* Base implementation for recurring resource types.
13-
* </summary>
14-
*/
15-
abstract class RecurringEntity implements IRecurringEntity
16-
{
17-
/**
18-
* All resource should be supplied a merchant-/application-defined ID.
19-
*
20-
* @var string
21-
*/
22-
public $id;
23-
24-
/**
25-
* All resources should be supplied a gateway-defined ID.
26-
*
27-
* @var string
28-
*/
29-
public $key;
30-
31-
/**
32-
* {@inheritDoc}
33-
*/
34-
public function create()
35-
{
36-
return RecurringService::create($this);
37-
}
38-
39-
/**
40-
* {@inheritDoc}
41-
*/
42-
public function delete($force = false)
43-
{
44-
try {
45-
return RecurringService::delete($this, $force);
46-
} catch (ApiException $exc) {
47-
throw new ApiException('Failed to delete record, see inner exception for more details', $exc);
48-
}
49-
}
50-
51-
/**
52-
* {@inheritDoc}
53-
*/
54-
public static function find($id, $configName = 'default')
55-
{
56-
$client = ServicesContainer::instance()->getRecurringClient($configName);
57-
if (!$client->supportsRetrieval) {
58-
throw new UnsupportedTransactionException();
59-
}
60-
61-
$identifier = static::getIdentifierName();
62-
$response = RecurringService::search(static::class)
63-
->addSearchCriteria($identifier, $id)
64-
->execute();
65-
$entity = isset($response[0]) ? $response[0] : null;
66-
67-
if ($entity !== null) {
68-
return RecurringService::get($entity);
69-
}
70-
71-
return null;
72-
}
73-
74-
/**
75-
* {@inheritDoc}
76-
*/
77-
public static function findAll($configName = 'default')
78-
{
79-
$client = ServicesContainer::instance()->getRecurringClient($configName);
80-
if (!$client->supportsRetrieval) {
81-
throw new UnsupportedTransactionException();
82-
}
83-
84-
return RecurringService::search(static::class)->execute();
85-
}
86-
87-
/**
88-
* {@inheritDoc}
89-
*/
90-
public function saveChanges($configName = 'default')
91-
{
92-
try {
93-
return RecurringService::edit($this);
94-
} catch (ApiException $exc) {
95-
throw new ApiException('Update failed, see inner exception for more details', $exc);
96-
}
97-
}
98-
99-
protected static function getIdentifierName()
100-
{
101-
if (static::class === Customer::class) {
102-
return 'customerIdentifier';
103-
} elseif (static::class === RecurringPaymentMethod::class) {
104-
return 'paymentMethodIdentifier';
105-
} elseif (static::class === Schedule::class) {
106-
return 'scheduleIdentifier';
107-
}
108-
return '';
109-
}
110-
}
1+
<?php
2+
3+
namespace GlobalPayments\Api\Entities;
4+
5+
use GlobalPayments\Api\ServicesContainer;
6+
use GlobalPayments\Api\Entities\Exceptions\ApiException;
7+
use GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException;
8+
use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod;
9+
use GlobalPayments\Api\Services\RecurringService;
10+
11+
/**
12+
* Base implementation for recurring resource types.
13+
* </summary>
14+
*/
15+
abstract class RecurringEntity implements IRecurringEntity
16+
{
17+
/**
18+
* All resource should be supplied a merchant-/application-defined ID.
19+
*
20+
* @var string
21+
*/
22+
public $id;
23+
24+
/**
25+
* All resources should be supplied a gateway-defined ID.
26+
*
27+
* @var string
28+
*/
29+
public $key;
30+
31+
/**
32+
* {@inheritDoc}
33+
*/
34+
public function create()
35+
{
36+
return RecurringService::create($this);
37+
}
38+
39+
/**
40+
* {@inheritDoc}
41+
*/
42+
public function delete($force = false)
43+
{
44+
try {
45+
return RecurringService::delete($this, $force);
46+
} catch (ApiException $exc) {
47+
throw new ApiException('Failed to delete record, see inner exception for more details', $exc);
48+
}
49+
}
50+
51+
/**
52+
* {@inheritDoc}
53+
*/
54+
public static function find($id, $configName = 'default')
55+
{
56+
$client = ServicesContainer::instance()->getRecurringClient($configName);
57+
if (!$client->supportsRetrieval) {
58+
throw new UnsupportedTransactionException();
59+
}
60+
61+
$identifier = static::getIdentifierName();
62+
$response = RecurringService::search(static::class)
63+
->addSearchCriteria($identifier, $id)
64+
->execute();
65+
66+
foreach ($response as $entity) {
67+
if ($entity->id === $id) {
68+
return RecurringService::get($entity);
69+
}
70+
}
71+
72+
return null;
73+
}
74+
75+
/**
76+
* {@inheritDoc}
77+
*/
78+
public static function findAll($configName = 'default')
79+
{
80+
$client = ServicesContainer::instance()->getRecurringClient($configName);
81+
if (!$client->supportsRetrieval) {
82+
throw new UnsupportedTransactionException();
83+
}
84+
85+
return RecurringService::search(static::class)->execute();
86+
}
87+
88+
/**
89+
* {@inheritDoc}
90+
*/
91+
public function saveChanges($configName = 'default')
92+
{
93+
try {
94+
return RecurringService::edit($this);
95+
} catch (ApiException $exc) {
96+
throw new ApiException('Update failed, see inner exception for more details', $exc);
97+
}
98+
}
99+
100+
protected static function getIdentifierName()
101+
{
102+
if (static::class === Customer::class) {
103+
return 'customerIdentifier';
104+
} elseif (static::class === RecurringPaymentMethod::class) {
105+
return 'paymentMethodIdentifier';
106+
} elseif (static::class === Schedule::class) {
107+
return 'scheduleIdentifier';
108+
}
109+
return '';
110+
}
111+
}

0 commit comments

Comments
 (0)