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

NextOffet Value is Handled for Retrieve Subscriptions API #80

Merged
merged 11 commits into from
Aug 14, 2023

Conversation

cb-gadagoju
Copy link
Contributor

@cb-gadagoju cb-gadagoju commented Aug 11, 2023

Overview:
Next Offset value is not handled for retrieveSubscriptions Method
in this Pr we handled it and added a new public method retrieveSubscriptionsList since the return handler is different from previous one could not able to mark it as deprecated on the existing method name retrieveSubscriptions so added new method name.
Changes made in files CBSubscriptionManager and Chargebee and updated example App with the latest method.

if data.list.isEmpty {
onError(CBError.defaultSytemError(statusCode: 404, message: "Subscription Not found"))
}else {
onSuccess(CBSubscriptionWrapper.init(list: data.list, nextOffset: data.nextOffset))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to create a new CBSubscriptionWrapper here? Can we not just pass data or am I missing anything?

Copy link
Contributor Author

@cb-gadagoju cb-gadagoju Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier we have only SubscriptionList in the handler but now offset value also we have to pass ,so i created a struct CBSubscriptionWrapper and the handler ((CBResult<CBSubscriptionWrapper>))is expecting CBSubscriptionWrapper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify again. the type of data is already CBSubscriptionWrapper

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify again. the type of data is already CBSubscriptionWrapper

yes update data is same type!


public func retrieveSubscriptionsList(queryParams: [String: String]? = nil, handler: @escaping RetrieveSubscriptionHandler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can we not use retrieveSubscriptions?

Copy link
Contributor Author

@cb-gadagoju cb-gadagoju Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the return handler is different from previous one could not able to mark it as deprecated with the same existing method name retrieveSubscriptions so added new method name retrieveSubscriptionsList.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please verify this again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to some problem in Xcode it didn't reflected in my machine but now its working as expected refactored the name and reverted back with existing name retrieveSubscriptions Thanks !


public func retrieveSubscriptionsList(queryParams: [String: String]? = nil, handler: @escaping RetrieveSubscriptionHandler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please verify this again?

if data.list.isEmpty {
onError(CBError.defaultSytemError(statusCode: 404, message: "Subscription Not found"))
}else {
onSuccess(CBSubscriptionWrapper.init(list: data.list, nextOffset: data.nextOffset))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify again. the type of data is already CBSubscriptionWrapper

public func retrieveSubscriptions(queryParams: [String: String]? = nil, handler: @escaping RetrieveSubscriptionHandler) {
let logger = CBLogger(name: "Subscription", action: "Fetch Subscription using customerId")
logger.info()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update the README as well?

@sonarcloud
Copy link

sonarcloud bot commented Aug 14, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
20.7% 20.7% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@cb-haripriyan cb-haripriyan merged commit cc8711d into chargebee:master Aug 14, 2023
1 of 2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants