Skip to content

Commit 38fcf7e

Browse files
committed
first commit
0 parents  commit 38fcf7e

17 files changed

+768
-0
lines changed

.github/ISSUE_TEMPLATE/config.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question
4+
url: https://github.com/getsolaris/laravel-aws-secretsmanager/discussions/new?category=q-a
5+
about: Ask the community for help
6+
- name: Request a feature
7+
url: https://github.com/getsolaris/laravel-aws-secretsmanager/discussions/new?category=ideas
8+
about: Share ideas for new features
9+
- name: Report a security issue
10+
url: https://github.com/getsolaris/laravel-aws-secretsmanager/security/policy
11+
about: Learn how to notify us for sensitive bugs
12+
- name: Report a bug
13+
url: https://github.com/getsolaris/laravel-aws-secretsmanager/issues/new
14+
about: Report a reproducible bug

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
labels:
12+
- "dependencies"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Fix PHP code style issues
2+
3+
on: [push]
4+
5+
jobs:
6+
php-code-styling:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Fix PHP code style issues
16+
uses: aglipanci/[email protected]
17+
18+
- name: Commit changes
19+
uses: stefanzweifel/git-auto-commit-action@v4
20+
with:
21+
commit_message: "style: fix psr-12 code style issues"

.github/workflows/run-tests.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: run-tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: 8.0
17+
coverage: none
18+
19+
- name: Install Composer dependencies
20+
run: composer install --prefer-dist --no-interaction
21+
22+
- name: Execute tests
23+
run: vendor/bin/phpunit tests
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Update Changelog"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
ref: main
16+
17+
- name: Update Changelog
18+
uses: stefanzweifel/changelog-updater-action@v1
19+
with:
20+
latest-version: ${{ github.event.release.name }}
21+
release-notes: ${{ github.event.release.body }}
22+
23+
- name: Commit updated CHANGELOG
24+
uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
branch: main
27+
commit_message: Update CHANGELOG
28+
file_pattern: CHANGELOG.md

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea
2+
.phpunit.result.cache
3+
build
4+
composer.lock
5+
coverage
6+
docs
7+
phpunit.xml
8+
phpstan.neon
9+
testbench.yaml
10+
vendor
11+
node_modules

README.md

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# A Laravel package to Toss Payments
2+
3+
4+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/getsolaris/laravel-tosspayments.svg?style=flat-square)](https://packagist.org/packages/getsolaris/laravel-tosspayments)
5+
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/getsolaris/laravel-tosspayments/run-tests?label=tests)](https://github.com/getsolaris/laravel-tosspayments/actions?query=workflow%3Arun-tests+branch%3Amain)
6+
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/getsolaris/laravel-tosspayments/Fix%20PHP%20code%20style%20issues?label=code%20style)](https://github.com/getsolaris/laravel-tosspayments/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/getsolaris/laravel-tosspayments.svg?style=flat-square)](https://packagist.org/packages/getsolaris/laravel-tosspayments)
8+
9+
10+
토스페이먼츠 (Toss Payments) 라라벨 API 입니다.
11+
12+
# 설치
13+
```bash
14+
composer require getsolaris/laravel-tosspayments
15+
```
16+
17+
`.env` 에 아래의 환경변수가 추가되어야 합니다.
18+
Toss Payments 개발자센터에서 발급받은 클라이언트 키와 시크릿 키를 환경변수에 추가합니다.
19+
20+
```bash
21+
TOSS_PAYMENTS_CLIENT_KEY=
22+
TOSS_PAYMENTS_SECRET_KEY=
23+
```
24+
25+
`config` 파일을 생성하기 위해서 아래 명령어를 수행합니다.
26+
27+
```bash
28+
php artisan vendor:publish --provider="Getsolaris\LaravelTossPayments\TossPaymentsServiceProvider" --tag="config"
29+
```
30+
31+
# 사용
32+
33+
Toss Payments 개발자센터의 [코어 API](https://docs.tosspayments.com/reference) 를 참고합니다.
34+
35+
API 를 사용하기 앞서 인증을 위한 API 키 준비와 인증 관련된 문서는 [해당 페이지](https://docs.tosspayments.com/guides/using-api)에서 확인 가능합니다.
36+
37+
Basic 인증 방식은 `{SECRET_KEY}:` 를 Base64 인코딩 한 값을 사용합니다.
38+
39+
40+
41+
## [결제 (Payment)](https://docs.tosspayments.com/reference#%EA%B2%B0%EC%A0%9C)
42+
43+
### [결제승인](https://docs.tosspayments.com/reference#%EA%B2%B0%EC%A0%9C-%EC%8A%B9%EC%9D%B8)
44+
45+
POST /v1/payments/confirm
46+
47+
```php
48+
use Getsolaris\LaravelTossPayments\TossPayments;
49+
use Getsolaris\LaravelTossPayments\Attributes\Payment;
50+
51+
$payment = TossPayments::for(Payment::class)
52+
->paymentKey($paymentKey)
53+
->orderId($orderId)
54+
->amount($amount)
55+
->confirm();
56+
57+
return $payment->json();
58+
```
59+
60+
61+
62+
## [거래 (Transaction)](https://docs.tosspayments.com/reference#%EA%B1%B0%EB%9E%98)
63+
64+
### [거래 조회](https://docs.tosspayments.com/reference#%EA%B1%B0%EB%9E%98-%EC%A1%B0%ED%9A%8C)
65+
66+
GET /v1/transactions
67+
68+
```php
69+
use Getsolaris\LaravelTossPayments\TossPayments;
70+
use Getsolaris\LaravelTossPayments\Attributes\Transaction;
71+
72+
$transactions = TossPayments::for(Transaction::class)
73+
->startDate('2022-01-01')
74+
->endDate('2022-12-31')
75+
->get();
76+
77+
return $transactions->json();
78+
```
79+
80+
81+
82+
## [테스트 코드 사용하기](https://docs.tosspayments.com/reference/error-codes#%EC%97%90%EB%9F%AC-%EC%BD%94%EB%93%9C)
83+
84+
[에러코드](https://docs.tosspayments.com/reference/error-codes#%EC%97%90%EB%9F%AC-%EC%BD%94%EB%93%9C)를 확인하여
85+
특정 에러가 발생했을 때와 같이 예상된 시나리오를 직접 발생시켜 처리해 볼 수 있습니다.
86+
87+
```php
88+
use Getsolaris\LaravelTossPayments\TossPayments;
89+
use Getsolaris\LaravelTossPayments\Attributes\Transaction;
90+
91+
$transactions = TossPayments::for(Transaction::class)
92+
->startDate('2022-01-01T00:00:00')
93+
->endDate('2022-12-31T00:00:00')
94+
->testCode('INVALID_CARD_EXPIRATION')
95+
->get();
96+
```
97+
98+
99+
## Resource
100+
- [Toss Payments 개발자센터](https://developers.tosspayments.com/)
101+
- [Toss Payments 코어 API](https://docs.tosspayments.com/reference)
102+
103+
## Changelog
104+
105+
Please see [CHANGELOG](../CHANGELOG.md) for more information on what has changed recently.
106+
107+
## License
108+
109+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "getsolaris/laravel-tosspayments",
3+
"description": "A Laravel package to Toss Payments",
4+
"keywords": [
5+
"getsolaris",
6+
"laravel",
7+
"toss",
8+
"tosspayments"
9+
],
10+
"homepage": "https://github.com/getsolaris/laravel-toss-payments",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "getsolaris",
15+
"email": "[email protected]"
16+
}
17+
],
18+
"support": {
19+
"issues": "https://github.com/getsolaris/laravel-toss-payments/issues",
20+
"source": "https://github.com/getsolaris/laravel-toss-payments"
21+
},
22+
"require": {
23+
"php": "^8.0",
24+
"ext-json": "*",
25+
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0"
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit": "^9.5"
29+
},
30+
"autoload": {
31+
"psr-4": {
32+
"Getsolaris\\LaravelTossPayments\\": "src"
33+
}
34+
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"Getsolaris\\LaravelTossPayments\\Tests\\": "tests"
38+
}
39+
},
40+
"config": {
41+
"sort-packages": true
42+
},
43+
"extra": {
44+
"laravel": {
45+
"providers": [
46+
"Getsolaris\\LaravelTossPayments\\TossPaymentsServiceProvider"
47+
],
48+
"aliases": {
49+
"AwsSecretsManager": "Getsolaris\\LaravelTossPayments\\TossPayments"
50+
}
51+
}
52+
},
53+
"minimum-stability": "dev",
54+
"prefer-stable": true
55+
}

config/toss-payments.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
return [
4+
'endpoint' => 'https://api.tosspayments.com',
5+
'version' => 'v1',
6+
'client_key' => env('TOSS_PAYMENTS_CLIENT_KEY'),
7+
'secret_key' => env('TOSS_PAYMENTS_SECRET_KEY'),
8+
'content_type' => 'application/json',
9+
'accept' => 'application/json',
10+
];

phpunit.xml.dist

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
beStrictAboutTestsThatDoNotTestAnything="true"
6+
bootstrap="vendor/autoload.php"
7+
colors="true"
8+
convertErrorsToExceptions="true"
9+
convertNoticesToExceptions="true"
10+
convertWarningsToExceptions="true"
11+
processIsolation="false"
12+
stopOnError="false"
13+
stopOnFailure="false"
14+
verbose="true"
15+
>
16+
<testsuites>
17+
<testsuite name="Toss Payments Test">
18+
<directory suffix="Test.php">./tests</directory>
19+
</testsuite>
20+
</testsuites>
21+
<filter>
22+
<whitelist processUncoveredFilesFromWhitelist="true">
23+
<directory suffix=".php">./src</directory>
24+
</whitelist>
25+
</filter>
26+
</phpunit>

0 commit comments

Comments
 (0)