-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMethod.php
61 lines (59 loc) · 2.69 KB
/
Method.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Dfe\Paymill;
use Magento\Sales\Model\Order\Payment as OP;
use Magento\Sales\Model\Order\Payment\Transaction as T;
use Paymill\Request as API;
# 2017-02-05
/** @method Settings s() */
final class Method extends \Df\StripeClone\Method {
/**
* 2017-02-08
* Класс @see \Paymill\Models\Response\Payment не предоставляет нам доступа
* ко всему ответу целиком, в виде массива:
* https://github.com/paymill/paymill-php/blob/v4.4.1/lib/Paymill/Models/Response/Payment.php#L13
*
* Поэтому, чтобы получить ответ в виде массива, мы используем метод
* @see \Paymill\Request::getLastResponse()
* https://github.com/paymill/paymill-php/blob/v4.4.1/lib/Paymill/Request.php#L139-L146
* А для этого нам нужно хранить объект - менеджеров запросов.
* [Paymill][PHP SDK] How to get the last API response as an array? https://mage2.pro/t/2682
*
* Причём @see \Paymill\Request — это именно менеджер запросов, а не сам запрос.
* Сам запрос имеет класс какого-либо из потомков @see \Paymill\Models\Response\Base:
* например: @see \Paymill\Models\Response\Payment
* Связь между ними показана в моём модульном тесте:
* https://github.com/mage2pro/paymill/blob/0.1.8/T/Charge.php?ts=4#L14-L17
*
* @used-by \Dfe\Paymill\Facade\Charge::api()
* @used-by \Dfe\Paymill\Facade\Customer::api()
* @used-by \Dfe\Paymill\Facade\O::toArray()
*/
function api():API {return dfc($this, function():API {return new API($this->s()->privateKey());});}
/**
* 2017-02-08
* @override
* The result should be in the basic monetary unit (like dollars), not in fractions (like cents).
* I did not find such information on the Paymill website.
* «Does Paymill have minimum and maximum amount limitations on a single payment?»
* https://mage2.pro/t/2690
* https://paymill.zendesk.com/hc/en-us/requests/129737
*
* 2017-02-10
* I have got an answer from the Paymill support:
* «Depending on the acquirer yes.
* But this can be negotiated according your business model and risk possibilities.»
* https://mage2.pro/t/2690/3
*
* @see \Df\Payment\Method::amountLimits()
* @used-by \Df\Payment\Method::isAvailable()
* @return null
*/
protected function amountLimits() {return null;}
/**
* 2017-02-05
* @override
* @see \Df\StripeClone\Method::transUrlBase()
* @used-by \Df\StripeClone\Method::transUrl()
*/
protected function transUrlBase(T $t):string {return 'https://app.paymill.com/transactions';}
}