Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.

Commit

Permalink
👍 add redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
KeisukeYamashita committed Oct 31, 2018
1 parent 49fe7fd commit 69ed3c5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
13 changes: 6 additions & 7 deletions apib/linepay/v1/api.apib
Expand Up @@ -21,13 +21,18 @@ LinePayに登録していればアプリ、モバイル共に簡単に決済を
+ orderId: u8chcreo5uocc5UQpiueon (string, required) - 決済に対して一意のID
+ amount: 4000 (string, required) - 料金
+ item: ミライザカ駒込 (string, required) - 何に対して決済をするのか。
+ redirectUrl: http://hogeyama.com/v1/thankyou - 決済が終わった時にリダイレクトされるURL
+ imageUrl: http://hogeyama.com/image.png - 決済時に表示される画像。デフォルトはOAISOのロゴです。
+ Default: `https://storage.googleapis.com/jphack2018-219415.appspot.com/logo.JPG`

+ Body

{
"orderId": "u8chcreo5uocc5UQpiueon",
"amount": 4000,
"item": "ミライザカ駒込"
"item": "ミライザカ駒込",
"redirectUrl": "http://hogeyama.com/v1/thankyou",
"imageUrl": "http://hogeyama.com/image.png"
}

+ Responce 200 (application/json)
Expand All @@ -49,9 +54,3 @@ LinePayに登録していればアプリ、モバイル共に簡単に決済を
### 決済を承認する [GET]

LINEからアクセスされる用です。

+ Response 200
+ Body

{
}
3 changes: 2 additions & 1 deletion linepay/src/app/server.js
Expand Up @@ -29,7 +29,8 @@ app.use("/v1/reserve", (req,res) => {
amount: body.amount,
currency: "JPY",
confirmUrl: process.env.LINE_PAY_CONFIRM_URL,
orderId: body.orderId
orderId: body.orderId,
productImageUrl: body.imageUrl || "https://storage.googleapis.com/jphack2018-219415.appspot.com/logo.JPG"
}

logger.info(`reserving payment of item: ${options.productName}, orderId: ${options.orderId}, amount:${options.amount}...`)
Expand Down
15 changes: 5 additions & 10 deletions store/handler/payment.go
Expand Up @@ -45,9 +45,11 @@ type PaymentError struct {
// TODO: these should NOT be here

type linePayReserve struct {
Amount int `json:"amount"`
OrderID string `json:"orderId"`
Item string `json:"item"`
Amount int `json:"amount"`
OrderID string `json:"orderId"`
Item string `json:"item"`
RedirectURL string `json:"redirectUrl"`
ImageURL string `json:"imageUrl"`
}

type LinePayReserveResponse struct {
Expand All @@ -62,13 +64,6 @@ type ReserveMessage struct {
PaymentURL string `json:"paymentURL"`
}

type linePayConfirm struct {
transactionID string
}

type linePayConfirmResponce struct {
}

func createBadRequest(ctx iris.Context, message string) {
golog.Warn(message)

Expand Down

0 comments on commit 69ed3c5

Please sign in to comment.