Skip to content

Commit 193c752

Browse files
authored
Merge pull request #66 from SK-Rookies5-Auction/feat/payment-ui-fix
feat: simplify payment amount and fix image display
2 parents a34ec50 + 6873adf commit 193c752

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/api/auction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export const auctionApi = {
7171
* 4.3 결제하기
7272
* POST /payments
7373
*/
74-
processPayment: async (auctionId: number): Promise<ApiResponse<void>> => {
75-
const { data } = await api.post<ApiResponse<void>>('/payments', { auctionId });
74+
processPayment: async (auctionId: number, amount: number): Promise<ApiResponse<void>> => {
75+
const { data } = await api.post<ApiResponse<void>>('/payments', { auctionId, amount });
7676
return data;
7777
},
7878

src/api/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export interface UserAuctionItem {
8787
currentPrice: number;
8888
status: UserItemStatus;
8989
viewCount: number;
90+
finalPrice?: number;
9091
createdAt: string;
9192
previewUrl: string;
9293
mainPictureUrl?: string;
@@ -137,6 +138,7 @@ export interface AuctionDetail extends AuctionSummary {
137138
startTime: string;
138139
viewCount: number;
139140
likeCount: number;
141+
mainPictureUrl: string;
140142
winnerId?: number | string;
141143
winnerNickname?: string;
142144
pictures: { url: string; main: boolean }[];

src/pages/CheckoutPage.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function CheckoutPage() {
4545

4646
setIsProcessing(true);
4747
try {
48-
const res = await auctionApi.processPayment(item.id);
48+
const res = await auctionApi.processPayment(item.id, item.currentPrice);
4949
if (res.success) {
5050
showToast('Payment successful! Your item will be shipped soon.', 'success');
5151
navigate('/my-page?tab=auctions');
@@ -79,9 +79,7 @@ export function CheckoutPage() {
7979
);
8080
}
8181

82-
const serviceFee = Math.floor(item.currentPrice * 0.05);
83-
const shippingFee = 0; // Free shipping
84-
const totalAmount = item.currentPrice + serviceFee + shippingFee;
82+
const totalAmount = item.currentPrice;
8583

8684
return (
8785
<Layout>
@@ -112,14 +110,6 @@ export function CheckoutPage() {
112110
<span className="text-gray-400">Winning Bid</span>
113111
<span className="text-white font-medium">{formatPrice(item.currentPrice)}</span>
114112
</div>
115-
<div className="flex justify-between text-sm">
116-
<span className="text-gray-400">Shipping</span>
117-
<span className="text-white font-medium">{formatPrice(shippingFee)}</span>
118-
</div>
119-
<div className="flex justify-between text-sm">
120-
<span className="text-gray-400">Service Fee (5%)</span>
121-
<span className="text-white font-medium">{formatPrice(serviceFee)}</span>
122-
</div>
123113
<div className="border-t border-[#1e3a5f] pt-3 flex justify-between items-center">
124114
<span className="text-white font-bold text-lg">Total</span>
125115
<span className="text-blue-400 font-black text-xl">{formatPrice(totalAmount)}</span>

0 commit comments

Comments
 (0)