-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from ThePay/v1.x-autumn
Release - 1.x autumn
- Loading branch information
Showing
11 changed files
with
343 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Get pay URLs for existing payments | ||
|
||
Returns an array of available payment methods with pay URLs for certain payment. | ||
|
||
```php | ||
/** @var \ThePay\ApiClient\TheClient $client */ | ||
$paymentMethod = $client->getPaymentUrlsForPayment('uid-454548', 'cs'); | ||
``` | ||
|
||
### Preformatted buttons | ||
|
||
Method **getPaymentButtonsForPayment** returns HTML code. | ||
|
||
```php | ||
// used default rendering | ||
$paymentButtons = $client->getPaymentButtonsForPayment($paymentUid); | ||
``` | ||
|
||
Payment method buttons should look like this, second image is with hover. | ||
|
||
![default](img/payment_method_button.png) | ||
![hover](img/payment_method_button_hover.png) |
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,28 @@ | ||
<?php | ||
|
||
namespace ThePay\ApiClient\Model; | ||
|
||
use ThePay\ApiClient\ValueObject\Url; | ||
|
||
interface IPaymentMethod | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getCode(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getTitle(); | ||
|
||
/** | ||
* @return Url | ||
*/ | ||
public function getImageUrl(); | ||
|
||
/** | ||
* @return array<string> | ||
*/ | ||
public function getTags(); | ||
} |
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,84 @@ | ||
<?php | ||
|
||
namespace ThePay\ApiClient\Model; | ||
|
||
use ThePay\ApiClient\Utils\Json; | ||
use ThePay\ApiClient\ValueObject\Url; | ||
|
||
class PaymentMethodWithPayUrl implements IPaymentMethod | ||
{ | ||
/** @var string */ | ||
private $code; | ||
|
||
/** @var string */ | ||
private $title; | ||
|
||
/** @var array<string> */ | ||
private $tags; | ||
|
||
/** @var Url|null */ | ||
private $imageUrl; | ||
|
||
/** @var Url */ | ||
private $payUrl; | ||
|
||
/** | ||
* @param string|array<string, mixed> $values Json in string or associative array | ||
*/ | ||
public function __construct($values) | ||
{ | ||
$data = is_array($values) ? $values : Json::decode($values, true); | ||
|
||
$this->code = $data['code']; | ||
$this->title = $data['title']; | ||
$this->imageUrl = new Url($data['image']['src']); | ||
$this->tags = $data['tags']; | ||
$this->payUrl = new Url($data['url']); | ||
} | ||
|
||
/** @return string */ | ||
public function getCode() | ||
{ | ||
return $this->code; | ||
} | ||
|
||
/** @return string */ | ||
public function getTitle() | ||
{ | ||
return $this->title; | ||
} | ||
|
||
/** @return Url */ | ||
public function getImageUrl() | ||
{ | ||
return $this->imageUrl; | ||
} | ||
|
||
/** @return Url */ | ||
public function getPayUrl() | ||
{ | ||
return $this->payUrl; | ||
} | ||
|
||
/** | ||
* @return array<string> | ||
*/ | ||
public function getTags() | ||
{ | ||
return $this->tags; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function toArray() | ||
{ | ||
return array( | ||
'code' => $this->code, | ||
'title' => $this->title, | ||
'tags' => $this->tags, | ||
'imageUrl' => (string) $this->imageUrl, | ||
'payUrl' => (string) $this->payUrl, | ||
); | ||
} | ||
} |
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
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
Oops, something went wrong.