Skip to content

Commit

Permalink
Add named args support to getAvailableServices method
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Sep 23, 2019
1 parent 07bffbd commit 71e1951
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,15 @@ trait Subscription {
return prepareParams(data)
}

List getAvailableServices(def customerId, Map input) {
List getAvailableServices(def customerId, Map input = [:]) {
LinkedHashMap params = getPaginationDefaultParams() + getAvailableServicesParams(input)
return getEntities(getAvailableServicesEntityType(customerId), params)
}

List getAvailableServices(Map input, def customerId) {
return getAvailableServices(customerId, input)
}

Map getAvailableService(def customerId, Map input) {
def serviceId = input.serviceId ?: input.goodId
List availableServices = getAvailableServices(customerId, input)
Expand All @@ -134,6 +138,10 @@ trait Subscription {
}
}

Map getAvailableService(Map input, def customerId) {
return getAvailableService(customerId, input)
}

Map getAvailableServiceByName(def customerId, Map input) {
def serviceName = input.serviceName ?: input.goodName
List availableServices = getAvailableServices(customerId, input)
Expand All @@ -145,6 +153,10 @@ trait Subscription {
return null
}

Map getAvailableServiceByName(Map input, def customerId) {
return getAvailableServiceByName(customerId, input)
}

Map getAvailableServiceByCode(def customerId, Map input) {
def serviceCode = input.serviceCode ?: input.goodCode
List availableServices = getAvailableServices(customer, input)
Expand All @@ -156,11 +168,19 @@ trait Subscription {
return null
}

Map getAvailableServiceByCode(Map input, def customerId) {
return getAvailableServiceByCode(customerId, input)
}

List getSubscriptions(def customerId, Map input = [:]) {
LinkedHashMap params = getPaginationDefaultParams() + input
return getEntities(getSubscriptionEntityType(customerId), params)
}

Map getSubscriptions(Map input, def customerId) {
return getSubscriptions(customerId, input)
}

Map getSubscription(def customerId, def subscriptionId) {
return getEntity(getSubscriptionEntityType(customerId), subscriptionId)
}
Expand Down Expand Up @@ -247,6 +267,10 @@ trait Subscription {
return getEntities(getChildSubscriptionEntityType(customerId, subscriptionId), params)
}

List getChildSubscriptions(Map input, def customerId, def subscriptionId) {
return getChildSubscriptions(customerId, subscriptionId, input)
}

Map getChildSubscription(def customerId, def subscriptionId, def childSubscriptionId) {
return getEntity(getChildSubscriptionEntityType(customerId, subscriptionId), childSubscriptionId)
}
Expand Down

0 comments on commit 71e1951

Please sign in to comment.