Skip to content

The createSource method has no return value #323

@Zyf893549897

Description

@Zyf893549897

Expected behavior

// 示例结构CreateTokenPayload
let sourcePayload = CreateSourcePayload(
amount: 5000,
currency: "THB",
details: Source.Payment.sourceType(.promptPay)
)
//let client = OmiseSDK(publicKey: LocalConfig.default.publicKey)
omiseSDK.client.createSource(payload: sourcePayload) { result in
print("result====(result)")
switch result {
case .success(let source):
print("🎉 Source 创建成功: (source.id)")
case .failure(let error):
print("❌ 创建失败: (error)")
}
}

result : ❌ 创建失败: unexpected(error: OmiseSDK.OmiseError.UnexpectedError.httpErrorResponseWithInvalidData, underlying: Optional(Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unable to parse empty data." UserInfo={NSDebugDescription=Unable to parse empty data.})))))

Actual behavior

1

Steps to reproduce the issue

1

Logs

result : ❌ 创建失败: unexpected(error: OmiseSDK.OmiseError.UnexpectedError.httpErrorResponseWithInvalidData, underlying: Optional(Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unable to parse empty data." UserInfo={NSDebugDescription=Unable to parse empty data.})))))

Screenshots

1

Name and version information

1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions