Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 573fa73

Browse files
Added base concerns
1 parent 6272166 commit 573fa73

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

‎src/Concerns/Parameters.php‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
/**
3+
* @link https://github.com/phpviet/omnipay-vtcpay
4+
*
5+
* @copyright (c) PHP Viet
6+
* @license [MIT](https://opensource.org/licenses/MIT)
7+
*/
8+
9+
namespace Omnipay\VTCPay\Concerns;
10+
11+
/**
12+
* @author Vuong Minh <vuongxuongminh@gmail.com>
13+
* @since 1.0.0
14+
*/
15+
trait Parameters
16+
{
17+
/**
18+
* Trả về tài khoản nhận tiền.
19+
*
20+
* @return null|string
21+
*/
22+
public function getReceiverAccount(): ?string
23+
{
24+
return $this->getParameter('receiver_account');
25+
}
26+
27+
/**
28+
* Thiết lập tài khoản nhận tiền.
29+
*
30+
* @param null|string $account
31+
*
32+
* @return $this
33+
*/
34+
public function setReceiverAccount(?string $account)
35+
{
36+
return $this->setParameter('receiver_account', $account);
37+
}
38+
39+
/**
40+
* Trả về mã website.
41+
*
42+
* @return null|string
43+
*/
44+
public function getWebsiteId(): ?string
45+
{
46+
return $this->getParameter('website_id');
47+
}
48+
49+
/**
50+
* Thiết lập mã website.
51+
*
52+
* @param null|string $id
53+
*
54+
* @return $this
55+
*/
56+
public function setWebsiteId(?string $id)
57+
{
58+
return $this->setParameter('website_id', $id);
59+
}
60+
61+
/**
62+
* Trả về mã bảo mật.
63+
*
64+
* @return null|string
65+
*/
66+
public function getSecurityCode(): ?string
67+
{
68+
return $this->getParameter('security_code');
69+
}
70+
71+
/**
72+
* Thiết lập mã bảo mật dùng để tạo chữ ký dữ liệu.
73+
*
74+
* @param string $code
75+
*
76+
* @return $this
77+
*/
78+
public function setSecurityCode(?string $code)
79+
{
80+
return $this->setParameter('security_code', $code);
81+
}
82+
}

‎src/Concerns/ParametersNormalize.php‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* @link https://github.com/phpviet/omnipay-vtcpay
4+
*
5+
* @copyright (c) PHP Viet
6+
* @license [MIT](https://opensource.org/licenses/MIT)
7+
*/
8+
9+
namespace Omnipay\VTCPay\Concerns;
10+
11+
/**
12+
* @author Vuong Minh <vuongxuongminh@gmail.com>
13+
* @since 1.0.0
14+
*/
15+
trait ParametersNormalize
16+
{
17+
/**
18+
* Phương thức hổ trợ xóa bỏ các ký tự `_` khi thiết lập các parameters.
19+
*
20+
* @param array $parameters
21+
* @return array
22+
*/
23+
protected function normalizeParameters(array $parameters): array
24+
{
25+
$normalizedParameters = [];
26+
27+
foreach ($parameters as $parameter => $value) {
28+
$parameter = str_replace('_', '', $parameter);
29+
$normalizedParameters[$parameter] = $value;
30+
}
31+
32+
return $normalizedParameters;
33+
}
34+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /