Skip to content

Commit

Permalink
style ci
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Jan 18, 2023
1 parent db09422 commit 627a85c
Show file tree
Hide file tree
Showing 26 changed files with 196 additions and 162 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,54 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ '7.1','7.2', '7.3', '7.4', '8.0', '8.1' ]
stability: [ prefer-stable ]
php: [ '7.1','7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
name: PHP ${{ matrix.php }}

env:
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, fileinfo
key: cache-v1 # can be any string, change to clear the extension cache.

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, memcached
extensions: ${{ env.extensions }}
tools: composer:v2
coverage: none
coverage: xdebug

- name: Install dependencies
uses: nick-invision/retry@v1
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Execute tests
continue-on-error: ${{ matrix.php > 8 }}
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit --testdox --verbose
11 changes: 6 additions & 5 deletions src/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class Encryption

/**
* Encryption constructor.
* @param null $key
*
* @param null $key
*/
public function __construct($key = null)
{
Expand All @@ -23,7 +24,7 @@ public function __construct($key = null)
}

/**
* @param string $key
* @param string $key
* @return $this
*/
public function setKey($key)
Expand All @@ -34,7 +35,7 @@ public function setKey($key)
}

/**
* @param array $data
* @param array $data
* @return string
*/
public function encrypt(array $data)
Expand All @@ -45,7 +46,7 @@ public function encrypt(array $data)
}

/**
* @param string $plainText
* @param string $plainText
* @return mixed
*/
public function decrypt($plainText)
Expand All @@ -57,7 +58,7 @@ public function decrypt($plainText)
}

/**
* @param string $iv
* @param string $iv
* @return AES
*/
private function updateIV($iv)
Expand Down
11 changes: 6 additions & 5 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* MyPay Gateway.
*
* @method RequestInterface authorize(array $options = [])
* @method RequestInterface completeAuthorize(array $options = [])
* @method RequestInterface capture(array $options = [])
Expand Down Expand Up @@ -42,7 +43,7 @@ public function getDefaultParameters()
}

/**
* @param array $options
* @param array $options
* @return RequestInterface
*/
public function purchase(array $options = [])
Expand All @@ -51,7 +52,7 @@ public function purchase(array $options = [])
}

/**
* @param array $options
* @param array $options
* @return RequestInterface
*/
public function completePurchase(array $options = [])
Expand All @@ -60,7 +61,7 @@ public function completePurchase(array $options = [])
}

/**
* @param array $options
* @param array $options
* @return RequestInterface
*/
public function acceptNotification(array $options = [])
Expand All @@ -69,7 +70,7 @@ public function acceptNotification(array $options = [])
}

/**
* @param array $options
* @param array $options
* @return RequestInterface
*/
public function fetchTransaction(array $options = [])
Expand All @@ -78,7 +79,7 @@ public function fetchTransaction(array $options = [])
}

/**
* @param array $options
* @param array $options
* @return RequestInterface
*/
public function refund(array $options = [])
Expand Down
2 changes: 1 addition & 1 deletion src/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Item extends BaseItem
{
/**
* @param string $value
* @param string $value
* @return Item
*/
public function setId($value)
Expand Down
7 changes: 4 additions & 3 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ abstract class AbstractRequest extends BaseAbstractRequest
use HasStore;

protected $liveEndpoint = 'https://pay.usecase.cc/api/init';

protected $testEndpoint = 'https://mypay.tw/api/init';

public function sendData($data)
Expand All @@ -33,14 +34,14 @@ protected function getEndpoint()
}

/**
* @param Encryption $encryption
* @param array $data
* @param Encryption $encryption
* @param array $data
* @return array
*/
abstract protected function createBody(Encryption $encryption, array $data);

/**
* @param array $data
* @param array $data
* @return ResponseInterface
*/
abstract protected function createResponse($data);
Expand Down
3 changes: 1 addition & 2 deletions src/Message/AcceptNotificationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
namespace Omnipay\MyPay\Message;

use Omnipay\Common\Message\NotificationInterface;
use Omnipay\Common\Message\ResponseInterface;

class AcceptNotificationRequest extends CompletePurchaseRequest implements NotificationInterface
{
/**
* @param array $data
* @param array $data
* @return AcceptNotificationResponse
*/
public function sendData($data)
Expand Down
26 changes: 13 additions & 13 deletions src/Message/CompletePurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CompletePurchaseRequest extends BaseAbstractRequest
/**
* 交易回傳碼(參閱附錄二).
*
* @param string $value
* @param string $value
* @return $this
*/
public function setPrc($value)
Expand All @@ -41,7 +41,7 @@ public function getPrc()
/**
* 卡號/VA/超商代碼
*
* @param string $value
* @param string $value
* @return $this
*/
public function setCardno($value)
Expand All @@ -60,7 +60,7 @@ public function getCardno()
/**
* 銀行交易授權碼
*
* @param string $value
* @param string $value
* @return $this
*/
public function setAcode($value)
Expand All @@ -79,7 +79,7 @@ public function getAcode()
/**
* 實際交易金額.
*
* @param string $value
* @param string $value
* @return $this
*/
public function setActualCost($value)
Expand All @@ -98,7 +98,7 @@ public function getActualCost()
/**
* 實際交易幣別.
*
* @param string $value
* @param string $value
* @return $this
*/
public function setActualCurrency($value)
Expand All @@ -117,7 +117,7 @@ public function getActualCurrency()
/**
* 愛心捐款金額(幣別同實際交易幣別).
*
* @param string $value
* @param string $value
* @return $this
*/
public function setLoveCost($value)
Expand All @@ -136,7 +136,7 @@ public function getLoveCost()
/**
* 回傳訊息.
*
* @param string $value
* @param string $value
* @return $this
*/
public function setRetmsg($value)
Expand All @@ -155,7 +155,7 @@ public function getRetmsg()
/**
* 交易完成時間(YYYYMMDDHHmmss).
*
* @param string $value
* @param string $value
* @return $this
*/
public function setFinishtime($value)
Expand All @@ -174,7 +174,7 @@ public function getFinishtime()
/**
* 扣款名稱(定期定額/定期分期交易專用).
*
* @param string $value
* @param string $value
* @return $this
*/
public function setPaymentName($value)
Expand All @@ -193,7 +193,7 @@ public function getPaymentName()
/**
* 期數 (定期定額/定期分期交易專用).
*
* @param int $value
* @param int $value
* @return $this
*/
public function setNois($value)
Expand All @@ -212,7 +212,7 @@ public function getNois()
/**
* 銀行代碼 虛擬帳號資訊.
*
* @param string $value
* @param string $value
* @return $this
*/
public function setBankId($value)
Expand All @@ -231,7 +231,7 @@ public function getBankId()
/**
* 有效日期虛擬帳號、超商代碼、無卡分期資訊.
*
* @param string $value
* @param string $value
* @return $this
*/
public function setExpiredDate($value)
Expand Down Expand Up @@ -285,7 +285,7 @@ public function getData()
}

/**
* @param array $data
* @param array $data
* @return CompletePurchaseResponse
*/
public function sendData($data)
Expand Down
Loading

0 comments on commit 627a85c

Please sign in to comment.