생성할 파일 구조

commerce-checkout-starter-kit/commerce-backend-ui-1/
├── ext.config.yaml
├── README.md
├── .env.simulation.example
├── actions/
│   ├── utils.js
│   ├── commerce/
│   │   └── index.js           ← IMS-based Commerce REST (order listing)
│   ├── payment-accept/
│   │   ├── commerce-client.js ← OAuth 1.0a (accept/decline)
│   │   └── index.js
│   ├── payment-decline/
│   │   └── index.js
│   └── registration/
│       └── index.js
├── scripts/
│   ├── README.md
│   └── simulate-split-payment.mjs
└── web-src/
    ├── index.html
    ├── package.json
    ├── .parcelrc
    └── src/
        ├── index.jsx
        ├── index.css
        ├── utils.js
        ├── exc-runtime.js
        ├── config.json
        ├── constants/
        │   └── extension.js
        ├── components/
        │   ├── App.jsx
        │   ├── ExtensionRegistration.jsx
        │   ├── MainPage.jsx
        │   ├── SplitPaymentDashboard.jsx
        │   └── SplitPaymentOrderDetail.jsx
        └── hooks/
            └── useSplitPaymentOrders.js

백엔드 작업

actions/commerce/index.js — IMS 인증 Commerce REST

  • 관리자 UI SDK 컨텍스트에서 제공한 IMS 토큰을 사용하여 Commerce REST를 호출합니다
  • split_cash_status 필터를 사용하여 순서 목록을 가져옵니다.
  • 주문 목록을 JSON으로 반환

actions/payment-accept/commerce-client.js — OAuth 1.0a 클라이언트

  • split-payment-orchestrator/actions/payment-orchestrator/commerce-client.js과(와) 동일한 구현
  • COMMERCE_INTEGRATION_* 접두사가 있는 env 변수를 사용합니다(IMS 자격 증명과 구분).

actions/payment-accept/index.js — 동작 수락

  • split-payment-orchestrator/actions/payment-accept/index.js과(와) 동일한 논리
  • OAuth 1.0a를 통해 POST /V1/split-payment/orders/:orderId/cash-received 호출

actions/payment-decline/index.js — 작업 거부

  • POST /V1/split-payment/orders/:orderId/cash-decline 호출

actions/registration/index.js — 관리자 UI SDK 등록

  • Commerce 관리 셸에 확장을 등록합니다.
  • 분할 결제 대시보드의 주문 아래에 메뉴 항목 추가

React 프론트엔드 구성 요소

SplitPaymentDashboard.jsx

  • 스펙트럼 스타일의 테이블에 보류 중인 분할 지급 주문 나열
  • 열: 주문 번호(increment_id), 일자, 고객, 현금 만기, 상점 대변, 상태
  • 행당 수락 및 거절 단추
  • web-src/src/utils.js 가져오기 도우미를 통해 백 엔드 작업을 호출합니다.
  • 로드/오류 상태 표시, 작업 완료 시 새로 고침

SplitPaymentOrderDetail.jsx

  • 단일 주문에 대한 분할 결제 세부 정보 표시
  • 표시: 현금 금액, 상점 대변 금액, 현재 split_cash_status

useSplitPaymentOrders.js — React 후크

  • actions/commerce/index.js에서 분할 결제 주문 가져오기
  • { orders, loading, error, refresh } 반환

시뮬레이션 스크립트

scripts/simulate-split-payment.mjs

App Builder을 거치지 않고 Commerce REST 호출을 직접 테스트하기 위한 Node.js ESM 스크립트. App Builder 작업과 동일한 OAuth 1.0a 서명을 사용합니다.

명령:

  • node simulate-split-payment.mjs help — 사용량 표시
  • node simulate-split-payment.mjs list — 분할 결제 데이터를 사용하여 최근 주문 나열
  • node simulate-split-payment.mjs show <orderId> — 특정 주문에 대한 분할 결제 필드 표시(entity_id)
  • node simulate-split-payment.mjs accept <orderId> — cash-received 끝점 호출
  • node simulate-split-payment.mjs decline <orderId> — cash-decline 끝점 호출

commerce-backend-ui-1/.env.simulation에서 자격 증명을 읽습니다(.env.simulation.example에서 복사).

.env.simulation.example:

COMMERCE_BASE_URL=https://your-store.example.com
COMMERCE_CONSUMER_KEY=
COMMERCE_CONSUMER_SECRET=
COMMERCE_ACCESS_TOKEN=
COMMERCE_ACCESS_TOKEN_SECRET=

ext.config.yaml

확장을 구성할 대상:

  • commerce-backend-ui-1 확장 유형
  • 네 가지 백엔드 작업(commerce, payment-accept, payment-decline, registration)
  • registration을(를) 제외한 모든 작업에 대한 require-adobe-auth: true
  • COMMERCE_INTEGRATION_* 자격 증명에 대한 환경 바인딩 입력

파일 생성 후

cd commerce-checkout-starter-kit
npm install
cp .env.dist .env
# Fill in IMS credentials and COMMERCE_INTEGRATION_* credentials
aio app deploy

프롬프트 끝

이 시리즈의 모든 리소스

참조 리소스

자동으로 번역됨
언어 선택기를 사용하여 이 페이지의 영어 버전을 확인합니다.
번역이 유용했나요?

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.