-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for paymentPage recurring payments.
- Loading branch information
Showing
13 changed files
with
537 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Omnipay\Mpay24; | ||
|
||
use Omnipay\Mpay24\Messages\Backend\ListProfilesRequest; | ||
use Omnipay\Mpay24\Messages\Backend\DeleteProfileRequest; | ||
use Omnipay\Mpay24\Messages\FetchTransactionRequest; | ||
use Omnipay\Mpay24\Messages\Backend\PurchaseRequest; | ||
use Omnipay\Mpay24\Messages\AcceptNotification; | ||
|
||
class BackendGateway extends PaymentPageGateway | ||
{ | ||
/** | ||
* @param array $parameters | ||
* @return PurchaseRequest | ||
*/ | ||
public function purchase(array $parameters = []) | ||
{ | ||
return $this->createRequest(PurchaseRequest::class, $parameters); | ||
} | ||
|
||
/** | ||
* @param array $parameters | ||
* @return PurchaseRequest | ||
*/ | ||
public function authorize(array $parameters = []) | ||
{ | ||
return $this->purchase($parameters); | ||
} | ||
|
||
/** | ||
* @param array $parameters | ||
* @return ListProfilesRequest | ||
*/ | ||
public function listProfiles(array $parameters = []) | ||
{ | ||
return $this->createRequest(ListProfilesRequest::class, $parameters); | ||
} | ||
|
||
/** | ||
* @param array $parameters | ||
* @return DeleteProfileRequest | ||
*/ | ||
public function deleteProfile(array $parameters = []) | ||
{ | ||
return $this->createRequest(DeleteProfileRequest::class, $parameters); | ||
} | ||
|
||
/** | ||
* @param array $parameters | ||
* @return DeleteProfileRequest | ||
*/ | ||
public function deleteCard(array $parameters = []) | ||
{ | ||
return $this->deletePofile($parameters); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Omnipay\Mpay24\Messages\Backend; | ||
|
||
use Omnipay\Mpay24\Messages\AbstractMpay24Request; | ||
use Mpay24\Mpay24Order; | ||
|
||
class DeleteProfileRequest extends AbstractMpay24Request | ||
{ | ||
/** | ||
* The data key names are from the mPAY24 spec, but lower camelCase. | ||
* | ||
* @return array | ||
* @throws InvalidRequestException | ||
* @throws \Omnipay\Common\Exception\InvalidRequestException | ||
*/ | ||
public function getData() | ||
{ | ||
return [ | ||
'customerId' => $this->getCustomerId() ?? $this->getCardReference(), | ||
'profileId' => $this->getProfileId(), | ||
]; | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @return ResponseInterface|ListProfilesResponse | ||
*/ | ||
public function sendData($data) | ||
{ | ||
$mpay24 = $this->getMpay(); | ||
|
||
$result = $mpay24->deleteProfile( | ||
$data['customerId'], | ||
$data['profileId'] | ||
); | ||
|
||
$resultData = [ | ||
'operationStatus' => $result->getStatus(), | ||
'returnCode' => $result->getReturnCode(), | ||
]; | ||
|
||
return new Response($this, $resultData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Omnipay\Mpay24\Messages\Backend; | ||
|
||
use Omnipay\Mpay24\Messages\AbstractMpay24Request; | ||
use Mpay24\Mpay24Order; | ||
|
||
class ListProfilesRequest extends AbstractMpay24Request | ||
{ | ||
/** | ||
* The data key names are from the mPAY24 spec, but lower camelCase. | ||
* | ||
* @return array | ||
* @throws InvalidRequestException | ||
* @throws \Omnipay\Common\Exception\InvalidRequestException | ||
*/ | ||
public function getData() | ||
{ | ||
return [ | ||
'customerId' => $this->getCustomerId() ?? $this->getCardReference(), | ||
'expiredBy' => $this->getExpiredBy(), | ||
'begin' => $this->getBegin(), | ||
'size' => $this->getSize(), | ||
]; | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @return ResponseInterface|ListProfilesResponse | ||
*/ | ||
public function sendData($data) | ||
{ | ||
$mpay24 = $this->getMpay(); | ||
|
||
$result = $mpay24->listCustomers( | ||
$data['customerId'], | ||
$data['expiredBy'], | ||
$data['begin'], | ||
$data['size'] | ||
); | ||
|
||
$resultData = [ | ||
'operationStatus' => $result->getStatus(), | ||
'returnCode' => $result->getReturnCode(), | ||
'profiles' => $result->getProfiles(), | ||
]; | ||
|
||
return new ListProfilesResponse($this, $resultData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Omnipay\Mpay24\Messages\Backend; | ||
|
||
/** | ||
* Lists matching profiles (customers). | ||
*/ | ||
|
||
use Omnipay\Mpay24\Messages\AbstractMpay24Response; | ||
use Omnipay\Mpay24\Messages\NotificationValuesTrait; | ||
|
||
class ListProfilesResponse extends AbstractMpay24Response | ||
{ | ||
use NotificationValuesTrait; | ||
|
||
/** | ||
* Returns an array of arrays containing "customerID" and "updated" elements. | ||
*/ | ||
public function getProfiles() | ||
{ | ||
return $this->getDataItem('profiles'); | ||
} | ||
} |
Oops, something went wrong.