Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
runs-on: macos-14
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install HomeBrew
run: |
brew bundle || true
cat Brewfile.lock.json || true
- run: xcodebuild -version
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ env.CACHE_NUMBER }}-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -32,7 +32,7 @@ jobs:
bundle config set deployment 'true'
bundle config set clean 'true'
bundle install --jobs 4 --retry 3
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ env.CACHE_NUMBER }}-${{ hashFiles('Cartfile.resolved') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: macos-14
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Gems
run: |
bundle config set deployment 'true'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: macos-14
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Install HomeBrew
run: |
brew bundle || true
cat Brewfile.lock.json || true
- run: xcodebuild -version
- uses: actions/cache@v2
- uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ docs/docsets/*.tgz
Brewfile.lock.json

# Claude Code
.claude
.claude
.serena
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct CardFormViewControllerExampleView: View {

class CardFormDelegate: ObservableObject, CardFormViewControllerDelegate {
@Published var isPresented: Bool = false

func cardFormViewController(_: CardFormViewController, didCompleteWith result: CardFormResult) {
switch result {
case .cancel:
Expand All @@ -34,7 +34,7 @@ class CardFormDelegate: ObservableObject, CardFormViewControllerDelegate {
}
}
}

func cardFormViewController(_: CardFormViewController,
didProduced token: Token,
completionHandler: @escaping (Error?) -> Void) {
Expand All @@ -48,17 +48,17 @@ class CardFormDelegate: ObservableObject, CardFormViewControllerDelegate {

struct CardFormViewControllerWrapper: UIViewControllerRepresentable {
weak var delegate: CardFormViewControllerDelegate!

func makeUIViewController(context: Context) -> UINavigationController {
let cardFormVc = CardFormViewController.createCardFormViewController(delegate: delegate,
viewType: .displayStyled)
let naviVc = UINavigationController(rootViewController: cardFormVc)
naviVc.presentationController?.delegate = cardFormVc
return naviVc
}

func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {
}

typealias UIViewControllerType = UINavigationController
}
1 change: 0 additions & 1 deletion example-swift/example-swift-ui/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct ContentView: View {
}
}


// MARK: - Preview

struct ContentView_Previews: PreviewProvider {
Expand Down
4 changes: 2 additions & 2 deletions example-swift/example-swift-ui/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window.makeKeyAndVisible()
}
}

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let urlContext = URLContexts.first else { return }
let url = urlContext.url
ThreeDSecureProcessHandler.shared.completeThreeDSecureProcess(url: url)
}

func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ThreeDSecureViewModel: ObservableObject, ThreeDSecureProcessHandlerDelegat
@Published var resultMessage: String = ""
@Published var showResult: Bool = false
@Published var isError: Bool = false

func startThreeDSecureProcess() {
guard !pendingResourceId.isEmpty,
let rootViewController = UIApplication.shared.windows.first?.rootViewController else {
Expand All @@ -24,7 +24,7 @@ class ThreeDSecureViewModel: ObservableObject, ThreeDSecureProcessHandlerDelegat
resourceId: pendingResourceId
)
}

// MARK: - ThreeDSecureProcessHandlerDelegate
func threeDSecureProcessHandlerDidFinish(_ handler: ThreeDSecureProcessHandler, status: ThreeDSecureProcessStatus) {
switch status {
Expand All @@ -50,7 +50,7 @@ class ThreeDSecureViewModel: ObservableObject, ThreeDSecureProcessHandlerDelegat

struct ThreeDSecureProcessHandlerExampleView: View {
@ObservedObject private var viewModel = ThreeDSecureViewModel()

var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 20) {
Expand All @@ -60,13 +60,13 @@ struct ThreeDSecureProcessHandlerExampleView: View {
.padding()
.border(Color.gray, width: 1)
.padding(.horizontal)

if viewModel.showResult {
Text(viewModel.resultMessage)
.foregroundColor(viewModel.isError ? .red : .black)
.padding(.horizontal)
}

Button(action: {
// 3) Call the view model's start function
viewModel.startThreeDSecureProcess()
Expand All @@ -76,10 +76,10 @@ struct ThreeDSecureProcessHandlerExampleView: View {
.frame(maxWidth: .infinity, alignment: .center)
}
.padding(.horizontal)

VStack(alignment: .leading, spacing: 12) {
Text("1.下記を参考に、先にサーバーサイドで支払い、または3Dセキュアリクエストを作成してください。")

Text("支払い作成時の3Dセキュア:")
if let url = URL(string: "https://pay.jp/docs/charge-tds") {
Button(action: {
Expand All @@ -89,7 +89,7 @@ struct ThreeDSecureProcessHandlerExampleView: View {
.foregroundColor(.blue)
}
}

Text("顧客カードに対する3Dセキュア:")
if let url = URL(string: "https://pay.jp/docs/customer-card-tds") {
Button(action: {
Expand All @@ -101,10 +101,10 @@ struct ThreeDSecureProcessHandlerExampleView: View {
}
}
.padding(.horizontal)

VStack(alignment: .leading, spacing: 12) {
Text("2. 作成したリソースのIDを上記に入力して3Dセキュアを開始してください。")

Text("3.立ち上がった画面が閉じ、認証が終了したら、ドキュメントを参考にサーバーサイドにて結果を確認してください。")
}
.padding(.horizontal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class CardFormViewWith3DSViewController: UIViewController {
self.formContentView.addSubview(cardFormView)

NotificationCenter.default.addObserver(self,
selector: #selector(handleTokenOperationStatusChange(notification:)),
name: .payjpTokenOperationStatusChanged,
object: nil)
selector: #selector(handleTokenOperationStatusChange(notification:)),
name: .payjpTokenOperationStatusChanged,
object: nil)

}

@objc private func handleTokenOperationStatusChange(notification: Notification) {
if let value = notification.userInfo?[PAYNotificationKey.newTokenOperationStatus] as? Int,
let newStatus = TokenOperationStatus.init(rawValue: value) {
let newStatus = TokenOperationStatus.init(rawValue: value) {
self.tokenOperationStatus = newStatus
self.updateButtonEnabled()
}
Expand All @@ -66,9 +66,9 @@ class CardFormViewWith3DSViewController: UIViewController {
case .success(let token):
DispatchQueue.main.async {
if let tdsStatus = token.card.threeDSecureStatus, tdsStatus == .unverified {
self.pendingToken = token
ThreeDSecureProcessHandler.shared.startThreeDSecureProcess(viewController: self, delegate: self, resourceId: token.identifer)
return
self.pendingToken = token
ThreeDSecureProcessHandler.shared.startThreeDSecureProcess(viewController: self, delegate: self, resourceId: token.identifer)
return
}
self.tokenIdLabel.text = token.identifer
self.showToken(token: token)
Expand Down Expand Up @@ -112,7 +112,7 @@ class CardFormViewWith3DSViewController: UIViewController {
}
}
}
}
}

// MARK: - CardFormViewDelegate

Expand Down Expand Up @@ -142,4 +142,3 @@ extension CardFormViewWith3DSViewController: ThreeDSecureProcessHandlerDelegate
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,20 @@ import PAYJP

class ThreeDSecureExampleViewController: UIViewController {
@IBOutlet private var startButton: UIButton!

@IBOutlet private var textField: UITextField!

@IBOutlet private var resultLabel: UILabel!

private var pendingResourceId: String?

override func viewDidLoad() {
super.viewDidLoad()
}


@IBAction private func startThreeDSecure(_ sender: Any) {
guard let resourceId = textField.text, !resourceId.isEmpty else {
self.resultLabel.text = ""
self.resultLabel.isHidden = true
return
}

pendingResourceId = resourceId
ThreeDSecureProcessHandler.shared.startThreeDSecureProcess(viewController: self, delegate: self, resourceId: resourceId)
}
Expand Down
4 changes: 0 additions & 4 deletions example-swift/example-swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ class ViewController: UITableViewController {
case TokenId = 2
}

override func viewDidLoad() {
super.viewDidLoad()
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch CellSection(rawValue: indexPath.section) {
case .CreateToken?:
Expand Down