@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * @param PaymentInstrumentInterface $card |
| 23 | 23 | * @return bool |
| 24 | 24 | */ |
| 25 | - public function disable(PaymentInstrumentInterface $card):? bool; |
|
| 25 | + public function disable(PaymentInstrumentInterface $card): ? bool; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param CustomerInterface $customer |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @return null|string |
| 15 | 15 | */ |
| 16 | - function getToken():? string; |
|
| 16 | + function getToken(): ? string; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param null|string $token |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @return null|string |
| 37 | 37 | */ |
| 38 | - function getType():? string; |
|
| 38 | + function getType(): ? string; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @param null|string $type |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @return array|null |
| 48 | 48 | */ |
| 49 | - function getCard():? array; |
|
| 49 | + function getCard(): ? array; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @param array|null $data |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @return null|string |
| 59 | 59 | */ |
| 60 | - function getLast4Digits():? string; |
|
| 60 | + function getLast4Digits(): ? string; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @param null|string $digits |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * @return null|string |
| 70 | 70 | */ |
| 71 | - function getCardType():? string; |
|
| 71 | + function getCardType(): ? string; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @param null|string $schema |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | ]; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * Retrieve a paymentInstrument from server and fill the $paymentInstrument Object with response. |
| 40 | - * |
|
| 41 | - */ |
|
| 40 | + * |
|
| 41 | + */ |
|
| 42 | 42 | public function get(): array |
| 43 | 43 | { |
| 44 | 44 | $response = []; |
@@ -50,49 +50,49 @@ discard block |
||
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | 52 | return $response; |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | + /** |
|
| 56 | 56 | * Delete an paymentInstrument from server. |
| 57 | - * |
|
| 57 | + * |
|
| 58 | 58 | * @param PaymentInstrumentInterface $paymentInstrument |
| 59 | 59 | * @return bool |
| 60 | - */ |
|
| 60 | + */ |
|
| 61 | 61 | public function disable(PaymentInstrumentInterface $paymentInstrument):?bool |
| 62 | 62 | { |
| 63 | 63 | $uri = self::getEndPoint().'/'.$paymentInstrument->getToken(); |
| 64 | 64 | |
| 65 | 65 | return $this->request('delete', $paymentInstrument, $uri); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * CheckoutClientInterface constructor. |
|
| 70 | - * @param ContextInterface $context |
|
| 68 | + /** |
|
| 69 | + * CheckoutClientInterface constructor. |
|
| 70 | + * @param ContextInterface $context |
|
| 71 | 71 | * @param array $options |
| 72 | 72 | */ |
| 73 | 73 | public function __construct(ContextInterface $context, ?array $options = []) |
| 74 | - { |
|
| 74 | + { |
|
| 75 | 75 | $this->context = $context; |
| 76 | 76 | $this->options = $options; |
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Return last response of client |
|
| 81 | - * @return ResponseInterface |
|
| 82 | - */ |
|
| 83 | - function getLastResponse(): ResponseInterface |
|
| 84 | - { |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Return last response of client |
|
| 81 | + * @return ResponseInterface |
|
| 82 | + */ |
|
| 83 | + function getLastResponse(): ResponseInterface |
|
| 84 | + { |
|
| 85 | 85 | return $this->lastResponse; |
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * return the context used to created the client. |
|
| 90 | - * @return ContextInterface |
|
| 91 | - */ |
|
| 92 | - function getContext(): ContextInterface |
|
| 93 | - { |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * return the context used to created the client. |
|
| 90 | + * @return ContextInterface |
|
| 91 | + */ |
|
| 92 | + function getContext(): ContextInterface |
|
| 93 | + { |
|
| 94 | 94 | return $this->context; |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @param PaymentInstrumentInterface $object |
@@ -167,5 +167,5 @@ discard block |
||
| 167 | 167 | public function getCustomer(): CustomerInterface |
| 168 | 168 | { |
| 169 | 169 | return $this->customer; |
| 170 | - } |
|
| 170 | + } |
|
| 171 | 171 | } |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * @param PaymentInstrumentInterface $paymentInstrument |
| 59 | 59 | * @return bool |
| 60 | 60 | */ |
| 61 | - public function disable(PaymentInstrumentInterface $paymentInstrument):?bool |
|
| 61 | + public function disable(PaymentInstrumentInterface $paymentInstrument): ?bool |
|
| 62 | 62 | { |
| 63 | - $uri = self::getEndPoint().'/'.$paymentInstrument->getToken(); |
|
| 63 | + $uri = self::getEndPoint() . '/' . $paymentInstrument->getToken(); |
|
| 64 | 64 | |
| 65 | 65 | return $this->request('delete', $paymentInstrument, $uri); |
| 66 | 66 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | function getEndPoint(): string |
| 130 | 130 | { |
| 131 | - return 'customers/'.$this->customer->getCustomerId().'/payment-instruments'; |
|
| 131 | + return 'customers/' . $this->customer->getCustomerId() . '/payment-instruments'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | /** |
| 146 | 146 | * @return AccessToken |
| 147 | 147 | */ |
| 148 | - function getToken():? AccessToken |
|
| 148 | + function getToken(): ? AccessToken |
|
| 149 | 149 | { |
| 150 | 150 | return $this->token; |
| 151 | 151 | } |
@@ -4,132 +4,132 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Customer implements CustomerInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Customer SumUp ID |
|
| 9 | - * |
|
| 10 | - * @var string |
|
| 11 | - */ |
|
| 12 | - protected $customerId; |
|
| 13 | - |
|
| 14 | - /** |
|
| 15 | - * Customer Name |
|
| 16 | - * |
|
| 17 | - * @var string |
|
| 18 | - */ |
|
| 19 | - protected $name; |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * Customer phone |
|
| 23 | - * |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 26 | - protected $phone; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Cusomter address |
|
| 30 | - * |
|
| 31 | - * @var AddressInterface |
|
| 32 | - */ |
|
| 33 | - protected $address; |
|
| 34 | - |
|
| 35 | - function __construct(?array $data = []) |
|
| 36 | - { |
|
| 37 | - $this->setCustomerId($data['customer_id']??null); |
|
| 38 | - $personal_details = $data['personal_details']??$data; |
|
| 39 | - $this->setName($personal_details['name']??null); |
|
| 40 | - $this->setPhone($personal_details['phone']??null); |
|
| 41 | - $this->setAddress(new Address($personal_details['address']??null)); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Get customer SumUp ID |
|
| 46 | - * |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 49 | - public function getCustomerId(): ?string |
|
| 50 | - { |
|
| 51 | - return $this->customerId; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Set customer SumUp ID |
|
| 56 | - * |
|
| 57 | - * @param string $customerId Customer SumUp ID |
|
| 58 | - * @return CustomerInterface |
|
| 59 | - */ |
|
| 60 | - public function setCustomerId(?string $customerId): CustomerInterface |
|
| 61 | - { |
|
| 62 | - $this->customerId = $customerId; |
|
| 63 | - |
|
| 64 | - return $this; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Get customer Name |
|
| 69 | - * |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - public function getName(): ?string |
|
| 73 | - { |
|
| 74 | - return $this->name; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Set customer Name |
|
| 79 | - * |
|
| 7 | + /** |
|
| 8 | + * Customer SumUp ID |
|
| 9 | + * |
|
| 10 | + * @var string |
|
| 11 | + */ |
|
| 12 | + protected $customerId; |
|
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * Customer Name |
|
| 16 | + * |
|
| 17 | + * @var string |
|
| 18 | + */ |
|
| 19 | + protected $name; |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * Customer phone |
|
| 23 | + * |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | + protected $phone; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Cusomter address |
|
| 30 | + * |
|
| 31 | + * @var AddressInterface |
|
| 32 | + */ |
|
| 33 | + protected $address; |
|
| 34 | + |
|
| 35 | + function __construct(?array $data = []) |
|
| 36 | + { |
|
| 37 | + $this->setCustomerId($data['customer_id']??null); |
|
| 38 | + $personal_details = $data['personal_details']??$data; |
|
| 39 | + $this->setName($personal_details['name']??null); |
|
| 40 | + $this->setPhone($personal_details['phone']??null); |
|
| 41 | + $this->setAddress(new Address($personal_details['address']??null)); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Get customer SumUp ID |
|
| 46 | + * |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | + public function getCustomerId(): ?string |
|
| 50 | + { |
|
| 51 | + return $this->customerId; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Set customer SumUp ID |
|
| 56 | + * |
|
| 57 | + * @param string $customerId Customer SumUp ID |
|
| 58 | + * @return CustomerInterface |
|
| 59 | + */ |
|
| 60 | + public function setCustomerId(?string $customerId): CustomerInterface |
|
| 61 | + { |
|
| 62 | + $this->customerId = $customerId; |
|
| 63 | + |
|
| 64 | + return $this; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Get customer Name |
|
| 69 | + * |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + public function getName(): ?string |
|
| 73 | + { |
|
| 74 | + return $this->name; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Set customer Name |
|
| 79 | + * |
|
| 80 | 80 | * @param string $name Customer Name |
| 81 | 81 | * @return Customer|CustomerInterface |
| 82 | - */ |
|
| 83 | - public function setName(?string $name): CustomerInterface |
|
| 84 | - { |
|
| 85 | - $this->name = $name; |
|
| 86 | - |
|
| 87 | - return $this; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Get customer phone |
|
| 92 | - * |
|
| 93 | - * @return string |
|
| 94 | - */ |
|
| 95 | - public function getPhone(): ?string |
|
| 96 | - { |
|
| 97 | - return $this->phone; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Set customer phone |
|
| 102 | - * |
|
| 82 | + */ |
|
| 83 | + public function setName(?string $name): CustomerInterface |
|
| 84 | + { |
|
| 85 | + $this->name = $name; |
|
| 86 | + |
|
| 87 | + return $this; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Get customer phone |
|
| 92 | + * |
|
| 93 | + * @return string |
|
| 94 | + */ |
|
| 95 | + public function getPhone(): ?string |
|
| 96 | + { |
|
| 97 | + return $this->phone; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Set customer phone |
|
| 102 | + * |
|
| 103 | 103 | * @param string $phone Customer phone |
| 104 | 104 | * @return Customer|CustomerInterface |
| 105 | - */ |
|
| 106 | - public function setPhone(?string $phone): CustomerInterface |
|
| 107 | - { |
|
| 108 | - $this->phone = $phone; |
|
| 109 | - |
|
| 110 | - return $this; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Get cusomter address |
|
| 115 | - * |
|
| 116 | - * @return AddressInterface |
|
| 117 | - */ |
|
| 118 | - public function getAddress(): AddressInterface |
|
| 119 | - { |
|
| 120 | - return $this->address; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Set cusomter address |
|
| 125 | - * |
|
| 126 | - * @param AddressInterface $address |
|
| 127 | - * @return Customer|CustomerInterface |
|
| 128 | - */ |
|
| 129 | - public function setAddress(AddressInterface $address): CustomerInterface |
|
| 130 | - { |
|
| 131 | - $this->address = $address; |
|
| 132 | - return $this; |
|
| 133 | - } |
|
| 105 | + */ |
|
| 106 | + public function setPhone(?string $phone): CustomerInterface |
|
| 107 | + { |
|
| 108 | + $this->phone = $phone; |
|
| 109 | + |
|
| 110 | + return $this; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Get cusomter address |
|
| 115 | + * |
|
| 116 | + * @return AddressInterface |
|
| 117 | + */ |
|
| 118 | + public function getAddress(): AddressInterface |
|
| 119 | + { |
|
| 120 | + return $this->address; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Set cusomter address |
|
| 125 | + * |
|
| 126 | + * @param AddressInterface $address |
|
| 127 | + * @return Customer|CustomerInterface |
|
| 128 | + */ |
|
| 129 | + public function setAddress(AddressInterface $address): CustomerInterface |
|
| 130 | + { |
|
| 131 | + $this->address = $address; |
|
| 132 | + return $this; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | } |
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | /** |
| 180 | 180 | * @return AccessToken |
| 181 | 181 | */ |
| 182 | - function getToken():? AccessToken |
|
| 182 | + function getToken(): ? AccessToken |
|
| 183 | 183 | { |
| 184 | 184 | return $this->token; |
| 185 | 185 | } |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | protected $options = []; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * CheckoutClientInterface constructor. |
|
| 27 | - * @param ContextInterface $context |
|
| 26 | + * CheckoutClientInterface constructor. |
|
| 27 | + * @param ContextInterface $context |
|
| 28 | 28 | * @param array $options |
| 29 | 29 | */ |
| 30 | 30 | public function __construct(ContextInterface $context, ?array $options = []) |
| 31 | - { |
|
| 32 | - $this->context = $context; |
|
| 31 | + { |
|
| 32 | + $this->context = $context; |
|
| 33 | 33 | $this->options = $options; |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @inheritDoc |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function setContext(ContextInterface $context): CustomerClientInterface |
| 76 | - { |
|
| 77 | - $this->context = $context; |
|
| 76 | + { |
|
| 77 | + $this->context = $context; |
|
| 78 | 78 | |
| 79 | 79 | return $this; |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * @inheritDoc |
@@ -89,18 +89,18 @@ discard block |
||
| 89 | 89 | ]; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - function getLastResponse(): ResponseInterface |
|
| 93 | - { |
|
| 94 | - return $this->lastResponse; |
|
| 95 | - } |
|
| 92 | + function getLastResponse(): ResponseInterface |
|
| 93 | + { |
|
| 94 | + return $this->lastResponse; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * return the context used to created the client. |
|
| 100 | - * @return ContextInterface |
|
| 101 | - */ |
|
| 102 | - function getContext(): ContextInterface |
|
| 103 | - { |
|
| 98 | + /** |
|
| 99 | + * return the context used to created the client. |
|
| 100 | + * @return ContextInterface |
|
| 101 | + */ |
|
| 102 | + function getContext(): ContextInterface |
|
| 103 | + { |
|
| 104 | 104 | return $this->context; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -183,5 +183,5 @@ discard block |
||
| 183 | 183 | function getToken():? AccessToken |
| 184 | 184 | { |
| 185 | 185 | return $this->token; |
| 186 | - } |
|
| 186 | + } |
|
| 187 | 187 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | * @param CustomerInterface $customer |
| 13 | 13 | * @return CustomerInterface |
| 14 | 14 | */ |
| 15 | - function create(CustomerInterface $customer):? CustomerInterface; |
|
| 15 | + function create(CustomerInterface $customer): ? CustomerInterface; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @param CustomerInterface $customer |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | interface CheckoutClientInterface extends SumUpClientInterface |
| 8 | 8 | { |
| 9 | - /** |
|
| 9 | + /** |
|
| 10 | 10 | * Create a checkout |
| 11 | 11 | * |
| 12 | 12 | * @param CheckoutInterface $checkout |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @param CheckoutInterface $checkout |
| 29 | 29 | * @return string |
| 30 | - */ |
|
| 30 | + */ |
|
| 31 | 31 | static function getCompleteUrl(CheckoutInterface $checkout): string; |
| 32 | 32 | |
| 33 | 33 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @return CheckoutInterface |
| 14 | 14 | * @see http://docs.sumup.com/rest-api/checkouts-api/#checkouts-create-checkout-post |
| 15 | 15 | */ |
| 16 | - public function create(CheckoutInterface $checkout):? CheckoutInterface; |
|
| 16 | + public function create(CheckoutInterface $checkout): ? CheckoutInterface; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Complete a checkout |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @return CheckoutInterface |
| 23 | 23 | * @see http://docs.sumup.com/rest-api/checkouts-api/#checkouts-complete-checkout-put |
| 24 | 24 | */ |
| 25 | - public function complete(CheckoutInterface $checkout):? CheckoutInterface; |
|
| 25 | + public function complete(CheckoutInterface $checkout): ? CheckoutInterface; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param CheckoutInterface $checkout |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @return float |
| 44 | 44 | */ |
| 45 | - function getAmount():? float; |
|
| 45 | + function getAmount(): ? float; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @return float|null |
| 49 | 49 | */ |
| 50 | - function getFeeAmount():? float; |
|
| 50 | + function getFeeAmount(): ? float; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @param float $amount |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /** |
| 147 | 147 | * @return string |
| 148 | 148 | */ |
| 149 | - function getValidUntil():? string; |
|
| 149 | + function getValidUntil(): ? string; |
|
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * @param string $timestamp |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | /** |
| 213 | 213 | * @return null|string |
| 214 | 214 | */ |
| 215 | - function getType():? string; |
|
| 215 | + function getType(): ? string; |
|
| 216 | 216 | |
| 217 | - function setInstallments(?string $installments):? self; |
|
| 218 | - function getInstallments():? string; |
|
| 217 | + function setInstallments(?string $installments): ? self; |
|
| 218 | + function getInstallments(): ? string; |
|
| 219 | 219 | |
| 220 | 220 | } |
@@ -10,211 +10,211 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | interface CheckoutInterface |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @return null|string |
|
| 15 | - */ |
|
| 16 | - function getId(): ?string; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @param string $id |
|
| 20 | - * @return CheckoutInterface |
|
| 21 | - */ |
|
| 22 | - function setId(string $id): self; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @return null|string |
|
| 26 | - */ |
|
| 27 | - function getStatus(): ?string; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @param string $status |
|
| 31 | - * @return CheckoutInterface |
|
| 32 | - */ |
|
| 33 | - function setStatus(string $status): self; |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param float $amount |
|
| 38 | - * @return CheckoutInterface |
|
| 39 | - */ |
|
| 40 | - function setAmount(float $amount): self; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @return float |
|
| 44 | - */ |
|
| 45 | - function getAmount():? float; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @return float|null |
|
| 49 | - */ |
|
| 13 | + /** |
|
| 14 | + * @return null|string |
|
| 15 | + */ |
|
| 16 | + function getId(): ?string; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @param string $id |
|
| 20 | + * @return CheckoutInterface |
|
| 21 | + */ |
|
| 22 | + function setId(string $id): self; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @return null|string |
|
| 26 | + */ |
|
| 27 | + function getStatus(): ?string; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @param string $status |
|
| 31 | + * @return CheckoutInterface |
|
| 32 | + */ |
|
| 33 | + function setStatus(string $status): self; |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param float $amount |
|
| 38 | + * @return CheckoutInterface |
|
| 39 | + */ |
|
| 40 | + function setAmount(float $amount): self; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @return float |
|
| 44 | + */ |
|
| 45 | + function getAmount():? float; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @return float|null |
|
| 49 | + */ |
|
| 50 | 50 | function getFeeAmount():? float; |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param float $amount |
|
| 54 | - * @return CheckoutInterface |
|
| 55 | - */ |
|
| 56 | - function setFeeAmount(float $amount): self; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @return null|string |
|
| 60 | - */ |
|
| 61 | - function getCurrency(): ?string; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * @param string $currency |
|
| 65 | - * @return CheckoutInterface |
|
| 66 | - */ |
|
| 67 | - function setCurrency(string $currency): self; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @return CustomerInterface|null |
|
| 71 | - */ |
|
| 72 | - function getCustomer(): ?CustomerInterface; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @param CustomerInterface $customer |
|
| 76 | - * @return CheckoutInterface |
|
| 77 | - */ |
|
| 78 | - function setCustomer(CustomerInterface $customer): self; |
|
| 79 | - |
|
| 80 | - /** |
|
| 52 | + /** |
|
| 53 | + * @param float $amount |
|
| 54 | + * @return CheckoutInterface |
|
| 55 | + */ |
|
| 56 | + function setFeeAmount(float $amount): self; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @return null|string |
|
| 60 | + */ |
|
| 61 | + function getCurrency(): ?string; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * @param string $currency |
|
| 65 | + * @return CheckoutInterface |
|
| 66 | + */ |
|
| 67 | + function setCurrency(string $currency): self; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @return CustomerInterface|null |
|
| 71 | + */ |
|
| 72 | + function getCustomer(): ?CustomerInterface; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @param CustomerInterface $customer |
|
| 76 | + * @return CheckoutInterface |
|
| 77 | + */ |
|
| 78 | + function setCustomer(CustomerInterface $customer): self; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | 81 | * @return PaymentInstrumentInterface|null |
| 82 | - */ |
|
| 82 | + */ |
|
| 83 | 83 | function getCard(): ?PaymentInstrumentInterface; |
| 84 | 84 | |
| 85 | - /** |
|
| 85 | + /** |
|
| 86 | 86 | * @param PaymentInstrumentInterface $card |
| 87 | - * @return CheckoutInterface |
|
| 88 | - */ |
|
| 87 | + * @return CheckoutInterface |
|
| 88 | + */ |
|
| 89 | 89 | function setCard(PaymentInstrumentInterface $card): self; |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * @return null|string |
|
| 93 | - */ |
|
| 94 | - function getPayToEmail(): ?string; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * @param string $email |
|
| 98 | - * @return CheckoutInterface |
|
| 99 | - */ |
|
| 100 | - function setPayToEmail(string $email): self; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @return null|string |
|
| 104 | - */ |
|
| 105 | - function getPayFromEmail(): ?string; |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @param string $email |
|
| 109 | - * @return CheckoutInterface |
|
| 110 | - */ |
|
| 111 | - function setPayFromEmail(string $email): self; |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * @return null|string |
|
| 115 | - */ |
|
| 116 | - function getReference(): ?string; |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @param string $reference |
|
| 120 | - * @return CheckoutInterface |
|
| 121 | - */ |
|
| 122 | - function setReference(string $reference): self; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * @return null|string |
|
| 126 | - */ |
|
| 127 | - function getDescription(): ?string; |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * @param string $description |
|
| 131 | - * @return CheckoutInterface |
|
| 132 | - */ |
|
| 133 | - function setDescription(string $description): self; |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * @return null|string |
|
| 137 | - */ |
|
| 138 | - function getRedirectUrl(): ?string; |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @param string $url |
|
| 142 | - * @return CheckoutInterface |
|
| 143 | - */ |
|
| 144 | - function setRedirectUrl(string $url): self; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * @return string |
|
| 148 | - */ |
|
| 149 | - function getValidUntil():? string; |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * @param string $timestamp |
|
| 153 | - * @return CheckoutInterface |
|
| 154 | - */ |
|
| 155 | - function setValidUntil(string $timestamp): self; |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * @return null|string |
|
| 159 | - */ |
|
| 160 | - function getTransactionCode(): ?string; |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @param string $code |
|
| 164 | - * @return CheckoutInterface |
|
| 165 | - */ |
|
| 166 | - function setTransactionCode(string $code): self; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * @return null|string |
|
| 170 | - */ |
|
| 171 | - function getTransactionId(): ?string; |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param string $id |
|
| 175 | - * @return CheckoutInterface |
|
| 176 | - */ |
|
| 177 | - function setTransactionId(string $id): self; |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * @return array|null |
|
| 181 | - */ |
|
| 182 | - function getTransactions(): ?array; |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * @param array $transactions |
|
| 186 | - * @return CheckoutInterface |
|
| 187 | - */ |
|
| 188 | - function setTransactions(array $transactions): self; |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * @return null|string |
|
| 192 | - */ |
|
| 193 | - function getToken(): ?string; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * @param string $token |
|
| 197 | - * @return CheckoutInterface |
|
| 198 | - */ |
|
| 199 | - function setToken(string $token): self; |
|
| 200 | - |
|
| 201 | - /** |
|
| 91 | + /** |
|
| 92 | + * @return null|string |
|
| 93 | + */ |
|
| 94 | + function getPayToEmail(): ?string; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * @param string $email |
|
| 98 | + * @return CheckoutInterface |
|
| 99 | + */ |
|
| 100 | + function setPayToEmail(string $email): self; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @return null|string |
|
| 104 | + */ |
|
| 105 | + function getPayFromEmail(): ?string; |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @param string $email |
|
| 109 | + * @return CheckoutInterface |
|
| 110 | + */ |
|
| 111 | + function setPayFromEmail(string $email): self; |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * @return null|string |
|
| 115 | + */ |
|
| 116 | + function getReference(): ?string; |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @param string $reference |
|
| 120 | + * @return CheckoutInterface |
|
| 121 | + */ |
|
| 122 | + function setReference(string $reference): self; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @return null|string |
|
| 126 | + */ |
|
| 127 | + function getDescription(): ?string; |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @param string $description |
|
| 131 | + * @return CheckoutInterface |
|
| 132 | + */ |
|
| 133 | + function setDescription(string $description): self; |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * @return null|string |
|
| 137 | + */ |
|
| 138 | + function getRedirectUrl(): ?string; |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @param string $url |
|
| 142 | + * @return CheckoutInterface |
|
| 143 | + */ |
|
| 144 | + function setRedirectUrl(string $url): self; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * @return string |
|
| 148 | + */ |
|
| 149 | + function getValidUntil():? string; |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * @param string $timestamp |
|
| 153 | + * @return CheckoutInterface |
|
| 154 | + */ |
|
| 155 | + function setValidUntil(string $timestamp): self; |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * @return null|string |
|
| 159 | + */ |
|
| 160 | + function getTransactionCode(): ?string; |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param string $code |
|
| 164 | + * @return CheckoutInterface |
|
| 165 | + */ |
|
| 166 | + function setTransactionCode(string $code): self; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * @return null|string |
|
| 170 | + */ |
|
| 171 | + function getTransactionId(): ?string; |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param string $id |
|
| 175 | + * @return CheckoutInterface |
|
| 176 | + */ |
|
| 177 | + function setTransactionId(string $id): self; |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * @return array|null |
|
| 181 | + */ |
|
| 182 | + function getTransactions(): ?array; |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * @param array $transactions |
|
| 186 | + * @return CheckoutInterface |
|
| 187 | + */ |
|
| 188 | + function setTransactions(array $transactions): self; |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * @return null|string |
|
| 192 | + */ |
|
| 193 | + function getToken(): ?string; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * @param string $token |
|
| 197 | + * @return CheckoutInterface |
|
| 198 | + */ |
|
| 199 | + function setToken(string $token): self; |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | 202 | * @return bool |
| 203 | - */ |
|
| 203 | + */ |
|
| 204 | 204 | function isValid(): bool; |
| 205 | 205 | |
| 206 | - /** |
|
| 207 | - * @param string|null $type |
|
| 208 | - * @return CheckoutInterface |
|
| 209 | - */ |
|
| 210 | - function setType(string $type = null): self; |
|
| 206 | + /** |
|
| 207 | + * @param string|null $type |
|
| 208 | + * @return CheckoutInterface |
|
| 209 | + */ |
|
| 210 | + function setType(string $type = null): self; |
|
| 211 | 211 | |
| 212 | - /** |
|
| 213 | - * @return null|string |
|
| 214 | - */ |
|
| 215 | - function getType():? string; |
|
| 212 | + /** |
|
| 213 | + * @return null|string |
|
| 214 | + */ |
|
| 215 | + function getType():? string; |
|
| 216 | 216 | |
| 217 | - function setInstallments(?string $installments):? self; |
|
| 218 | - function getInstallments():? string; |
|
| 217 | + function setInstallments(?string $installments):? self; |
|
| 218 | + function getInstallments():? string; |
|
| 219 | 219 | |
| 220 | 220 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @throws BadResponseException |
| 39 | 39 | * @throws ConnectException |
| 40 | 40 | */ |
| 41 | - function create(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface |
|
| 41 | + function create(CheckoutInterface $checkout, AccessToken $accessToken = null): ? CheckoutInterface |
|
| 42 | 42 | { |
| 43 | 43 | return $this->request('post', $checkout) ? $checkout : null; |
| 44 | 44 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @throws BadResponseException |
| 49 | 49 | * @throws ConnectException |
| 50 | 50 | */ |
| 51 | - function complete(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface |
|
| 51 | + function complete(CheckoutInterface $checkout, AccessToken $accessToken = null): ? CheckoutInterface |
|
| 52 | 52 | { |
| 53 | 53 | return $this->request('put', $checkout) ? $checkout : null; |
| 54 | 54 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string|null $endpoint |
| 60 | 60 | * @return bool|null |
| 61 | 61 | */ |
| 62 | - function request(string $action, $checkout, string $endpoint = null):? bool |
|
| 62 | + function request(string $action, $checkout, string $endpoint = null): ? bool |
|
| 63 | 63 | { |
| 64 | 64 | if (!$checkout->isValid()) { |
| 65 | 65 | throw new InvalidCheckoutException($checkout); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | /** |
| 202 | 202 | * @return AccessToken |
| 203 | 203 | */ |
| 204 | - function getToken():? AccessToken |
|
| 204 | + function getToken(): ? AccessToken |
|
| 205 | 205 | { |
| 206 | 206 | return $this->currentToken; |
| 207 | 207 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | static function getCompleteUrl(CheckoutInterface $checkout): string |
| 214 | 214 | { |
| 215 | 215 | if ($checkout->getId()) { |
| 216 | - return SumUp::getEntrypoint().$checkout->getId(); |
|
| 216 | + return SumUp::getEntrypoint() . $checkout->getId(); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | return ''; |
@@ -22,71 +22,71 @@ discard block |
||
| 22 | 22 | request as protected traitRequest; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - protected $context; |
|
| 26 | - protected $lastResponse; |
|
| 25 | + protected $context; |
|
| 26 | + protected $lastResponse; |
|
| 27 | 27 | protected $options = []; |
| 28 | 28 | protected $currentToken; |
| 29 | 29 | |
| 30 | 30 | function __construct(ContextInterface $context, ?array $options = []) |
| 31 | - { |
|
| 32 | - $this->context = $context; |
|
| 31 | + { |
|
| 32 | + $this->context = $context; |
|
| 33 | 33 | $this->options = $options; |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @inheritDoc |
|
| 38 | - * @throws BadResponseException |
|
| 39 | - * @throws ConnectException |
|
| 40 | - */ |
|
| 36 | + /** |
|
| 37 | + * @inheritDoc |
|
| 38 | + * @throws BadResponseException |
|
| 39 | + * @throws ConnectException |
|
| 40 | + */ |
|
| 41 | 41 | function create(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface |
| 42 | - { |
|
| 42 | + { |
|
| 43 | 43 | return $this->request('post', $checkout) ? $checkout : null; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @inheritDoc |
|
| 48 | - * @throws BadResponseException |
|
| 49 | - * @throws ConnectException |
|
| 50 | - */ |
|
| 46 | + /** |
|
| 47 | + * @inheritDoc |
|
| 48 | + * @throws BadResponseException |
|
| 49 | + * @throws ConnectException |
|
| 50 | + */ |
|
| 51 | 51 | function complete(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface |
| 52 | - { |
|
| 52 | + { |
|
| 53 | 53 | return $this->request('put', $checkout) ? $checkout : null; |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @param string $action |
|
| 58 | - * @param CheckoutInterface $checkout |
|
| 56 | + /** |
|
| 57 | + * @param string $action |
|
| 58 | + * @param CheckoutInterface $checkout |
|
| 59 | 59 | * @param string|null $endpoint |
| 60 | - * @return bool|null |
|
| 61 | - */ |
|
| 60 | + * @return bool|null |
|
| 61 | + */ |
|
| 62 | 62 | function request(string $action, $checkout, string $endpoint = null):? bool |
| 63 | - { |
|
| 63 | + { |
|
| 64 | 64 | if (!$checkout->isValid()) { |
| 65 | 65 | throw new InvalidCheckoutException($checkout); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | return $this->traitRequest($action, $checkout); |
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Generate a body to create a new checkout |
|
| 73 | - * |
|
| 74 | - * @param CheckoutInterface $checkout |
|
| 75 | - * @return array |
|
| 76 | - */ |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Generate a body to create a new checkout |
|
| 73 | + * |
|
| 74 | + * @param CheckoutInterface $checkout |
|
| 75 | + * @return array |
|
| 76 | + */ |
|
| 77 | 77 | protected static function getCheckoutBody(CheckoutInterface $checkout): array |
| 78 | - { |
|
| 79 | - return [ |
|
| 80 | - "checkout_reference" => $checkout->getReference(), |
|
| 81 | - "amount" => $checkout->getAmount(), |
|
| 82 | - "currency" => $checkout->getCurrency(), |
|
| 83 | - "fee_amount" => $checkout->getFeeAmount(), |
|
| 84 | - "pay_to_email" => $checkout->getPayToEmail(), |
|
| 85 | - "pay_from_email" => $checkout->getPayFromEmail(), |
|
| 86 | - "description" => $checkout->getDescription(), |
|
| 87 | - "return_url" => $checkout->getRedirectUrl(), |
|
| 88 | - ]; |
|
| 89 | - } |
|
| 78 | + { |
|
| 79 | + return [ |
|
| 80 | + "checkout_reference" => $checkout->getReference(), |
|
| 81 | + "amount" => $checkout->getAmount(), |
|
| 82 | + "currency" => $checkout->getCurrency(), |
|
| 83 | + "fee_amount" => $checkout->getFeeAmount(), |
|
| 84 | + "pay_to_email" => $checkout->getPayToEmail(), |
|
| 85 | + "pay_from_email" => $checkout->getPayFromEmail(), |
|
| 86 | + "description" => $checkout->getDescription(), |
|
| 87 | + "return_url" => $checkout->getRedirectUrl(), |
|
| 88 | + ]; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @param CheckoutInterface $checkout |
@@ -94,74 +94,74 @@ discard block |
||
| 94 | 94 | * @return array |
| 95 | 95 | */ |
| 96 | 96 | static function getBody($checkout, string $type = null): array |
| 97 | - { |
|
| 98 | - $defaultBody = self::getCheckoutBody($checkout); |
|
| 99 | - switch ($checkout->getType()) { |
|
| 100 | - case 'card': |
|
| 101 | - $completeBody = self::getCardBody($checkout); |
|
| 102 | - break; |
|
| 103 | - |
|
| 104 | - case 'boleto': |
|
| 105 | - $completeBody = self::getBoletoBody($checkout); |
|
| 106 | - break; |
|
| 107 | - |
|
| 108 | - default: |
|
| 109 | - $completeBody = []; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - return array_merge($defaultBody, $completeBody); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - private static function getCardBody(CheckoutInterface $checkout): array |
|
| 116 | - { |
|
| 117 | - return [ |
|
| 118 | - 'payment_type' => $checkout->getType(), |
|
| 119 | - 'token' => $checkout->getCard()->getToken(), |
|
| 120 | - 'customer_id' => $checkout->getCustomer()->getCustomerId() |
|
| 121 | - ]; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - private static function getBoletoBody(CheckoutInterface $checkout): array |
|
| 125 | - { |
|
| 126 | - $customer = $checkout->getCustomer(); |
|
| 127 | - return [ |
|
| 128 | - 'payment_type' => $checkout->getType(), |
|
| 129 | - 'description' => $checkout->getDescription(), |
|
| 130 | - 'boleto_details' => [ |
|
| 97 | + { |
|
| 98 | + $defaultBody = self::getCheckoutBody($checkout); |
|
| 99 | + switch ($checkout->getType()) { |
|
| 100 | + case 'card': |
|
| 101 | + $completeBody = self::getCardBody($checkout); |
|
| 102 | + break; |
|
| 103 | + |
|
| 104 | + case 'boleto': |
|
| 105 | + $completeBody = self::getBoletoBody($checkout); |
|
| 106 | + break; |
|
| 107 | + |
|
| 108 | + default: |
|
| 109 | + $completeBody = []; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + return array_merge($defaultBody, $completeBody); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + private static function getCardBody(CheckoutInterface $checkout): array |
|
| 116 | + { |
|
| 117 | + return [ |
|
| 118 | + 'payment_type' => $checkout->getType(), |
|
| 119 | + 'token' => $checkout->getCard()->getToken(), |
|
| 120 | + 'customer_id' => $checkout->getCustomer()->getCustomerId() |
|
| 121 | + ]; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + private static function getBoletoBody(CheckoutInterface $checkout): array |
|
| 125 | + { |
|
| 126 | + $customer = $checkout->getCustomer(); |
|
| 127 | + return [ |
|
| 128 | + 'payment_type' => $checkout->getType(), |
|
| 129 | + 'description' => $checkout->getDescription(), |
|
| 130 | + 'boleto_details' => [ |
|
| 131 | 131 | // 'cpf_cnpj' => $customer->getCpfCnpj(), |
| 132 | - 'payer_name' => $customer->getName(), |
|
| 133 | - 'payer_address' => $customer->getAddress(), |
|
| 134 | - 'payer_city' => $customer->getAddress()->getCity(), |
|
| 135 | - 'payer_state_code' => $customer->getAddress()->getState(), |
|
| 136 | - 'payer_post_code' => $customer->getAddress()->getPostalCode() |
|
| 137 | - ], |
|
| 138 | - ]; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * @inheritDoc |
|
| 143 | - */ |
|
| 132 | + 'payer_name' => $customer->getName(), |
|
| 133 | + 'payer_address' => $customer->getAddress(), |
|
| 134 | + 'payer_city' => $customer->getAddress()->getCity(), |
|
| 135 | + 'payer_state_code' => $customer->getAddress()->getState(), |
|
| 136 | + 'payer_post_code' => $customer->getAddress()->getPostalCode() |
|
| 137 | + ], |
|
| 138 | + ]; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * @inheritDoc |
|
| 143 | + */ |
|
| 144 | 144 | static function getScopes(): array |
| 145 | - { |
|
| 146 | - return [ |
|
| 147 | - 'payments', |
|
| 148 | - 'boleto' |
|
| 149 | - ]; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - function getLastResponse(): ResponseInterface |
|
| 153 | - { |
|
| 154 | - return $this->lastResponse; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * return the context used to created the client. |
|
| 159 | - * @return ContextInterface |
|
| 160 | - */ |
|
| 161 | - function getContext(): ContextInterface |
|
| 162 | - { |
|
| 163 | - return $this->context; |
|
| 164 | - } |
|
| 145 | + { |
|
| 146 | + return [ |
|
| 147 | + 'payments', |
|
| 148 | + 'boleto' |
|
| 149 | + ]; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + function getLastResponse(): ResponseInterface |
|
| 153 | + { |
|
| 154 | + return $this->lastResponse; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * return the context used to created the client. |
|
| 159 | + * @return ContextInterface |
|
| 160 | + */ |
|
| 161 | + function getContext(): ContextInterface |
|
| 162 | + { |
|
| 163 | + return $this->context; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | function getOptions(): array |
| 167 | 167 | { |