Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IamportResponseStruct decode 에러 #41

Open
funct7 opened this issue Feb 16, 2024 · 0 comments
Open

IamportResponseStruct decode 에러 #41

funct7 opened this issue Feb 16, 2024 · 0 comments

Comments

@funct7
Copy link

funct7 commented Feb 16, 2024

응답

{
  "success": false,
  "imp_uid": "imp_594738060424",
  "merchant_uid": "180",
  "pay_method": "payco",
  "pg_provider": "payco",
  "pg_type": "payment",
  "error_msg": "사용자가 결제를 취소하셨습니다"
}

변환 결과

(iamport_ios.IamportResponseStruct) $R1 = {
  success = true
  imp_uid = "imp_594738060424"
  merchant_uid = "180"
  error_msg = "사용자가 결제를 취소하셨습니다"
  error_code = nil
}

guard let decodedSuccess = (try? values.decode(String.self, forKey: .imp_success)) ?? (try? values.decode(String.self, forKey: .success)) else {
success = (error_code == nil)
return
}

해당 코드에서 String으로 변환 실패 후 error_msg를 안 봐서 true 처리 되고 있는 것 같네요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant