Skip to content

Commit 6206bfa

Browse files
committed
Merge branch '365-update-fueling-api-to-2024-3' into 'master'
Resolve "Update Fueling API to 2024-3" Closes #365 See merge request pace/mobile/ios/pace-cloud-sdk!418
2 parents 2bdc5c8 + 2c332e3 commit 6206bfa

File tree

3 files changed

+233
-21
lines changed

3 files changed

+233
-21
lines changed

PACECloudSDK/API/Fueling/Generated/FuelingAPI.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55

66
import Foundation
77

8-
/** Fueling API */
8+
/** The PACE Fueling API is responsible for managing fueling related actions. */
99
public struct FuelingAPI {
1010

1111
/// Used to encode Dates when uses as string params
1212
public static var dateEncodingFormatter = DateFormatter(formatString: "yyyy-MM-dd'T'HH:mm:ss'Z'",
1313
locale: Locale(identifier: "de_DE"),
1414
calendar: Calendar(identifier: .gregorian))
1515

16-
public static let version = "2024-2"
16+
public static let version = "2024-3"
1717

1818
public enum Discount {}
1919
public enum Fueling {}
2020
public enum Notification {}
2121

2222
public enum FuelingAPIServer {
23-
/** Production server (stable release 2024-2) **/
24-
public static let main = "https://api.pace.cloud/fueling/2024-2"
23+
/** Production server (preview release 2024-3) **/
24+
public static let main = "https://api.pace.cloud/fueling/2024-3"
2525
}
2626
}
2727

PACECloudSDK/API/Fueling/Generated/FuelingAPIRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class FuelingAPIRequest<ResponseType: APIResponseValue> {
1313
public let encodeBody: ((RequestEncoder) throws -> Data)?
1414
private(set) var headerParameters: [String: String]
1515
public var customHeaders: [String: String] = [:]
16-
public var version: String = "2024-2"
16+
public var version: String = "2024-3"
1717
public var contentType: String = "application/json"
1818

1919
public var headers: [String: String] {

PACECloudSDK/API/Fueling/Generated/Requests/Fueling/FuelingAPIProcessPayment.swift

Lines changed: 228 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,229 @@ As an additional feature, the caller can - in case of Post Pay - opt for unatten
14731473
}
14741474
}
14751475

1476+
/** Error objects provide additional information about problems encountered while performing an operation.
1477+
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
1478+
* `1000`: generic error
1479+
* `1001`: payment processing temporarily unavailable
1480+
* `1002`: requested amount exceeds the authorized amount of the provided token
1481+
* `1003`: implicit payment methods cannot be modified
1482+
* `1004`: payment method rejected by provider
1483+
* `provider:payment-method-rejected`: payment method rejected by provider (identical to `1004`)
1484+
* `rule:product-denied`: Product restrictions forbid transaction, e.g., forbidden fuel type - token authorized only for Diesel but attempted to fuel Super.
1485+
*/
1486+
public class Status412: APIModel {
1487+
1488+
public var errors: [Errors]?
1489+
1490+
/** Error objects provide additional information about problems encountered while performing an operation.
1491+
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
1492+
* `1000`: generic error
1493+
* `1001`: payment processing temporarily unavailable
1494+
* `1002`: requested amount exceeds the authorized amount of the provided token
1495+
* `1003`: implicit payment methods cannot be modified
1496+
* `1004`: payment method rejected by provider
1497+
* `provider:payment-method-rejected`: payment method rejected by provider (identical to `1004`)
1498+
* `rule:product-denied`: Product restrictions forbid transaction, e.g., forbidden fuel type - token authorized only for Diesel but attempted to fuel Super.
1499+
*/
1500+
public class Errors: APIModel {
1501+
1502+
/** an application-specific error code, expressed as a string value.
1503+
*/
1504+
public var code: String?
1505+
1506+
/** a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized.
1507+
*/
1508+
public var detail: String?
1509+
1510+
/** A unique identifier for this particular occurrence of the problem. */
1511+
public var id: String?
1512+
1513+
public var links: Links?
1514+
1515+
/** a meta object containing non-standard meta-information about the error.
1516+
*/
1517+
public var meta: [String: Any]?
1518+
1519+
/** An object containing references to the source of the error.
1520+
*/
1521+
public var source: Source?
1522+
1523+
/** the HTTP status code applicable to this problem, expressed as a string value.
1524+
*/
1525+
public var status: String?
1526+
1527+
/** A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
1528+
*/
1529+
public var title: String?
1530+
1531+
/** Error objects provide additional information about problems encountered while performing an operation.
1532+
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
1533+
* `1000`: generic error
1534+
* `1001`: payment processing temporarily unavailable
1535+
* `1002`: requested amount exceeds the authorized amount of the provided token
1536+
* `1003`: implicit payment methods cannot be modified
1537+
* `1004`: payment method rejected by provider
1538+
* `provider:payment-method-rejected`: payment method rejected by provider (identical to `1004`)
1539+
* `rule:product-denied`: Product restrictions forbid transaction, e.g., forbidden fuel type - token authorized only for Diesel but attempted to fuel Super.
1540+
*/
1541+
public class Links: APIModel {
1542+
1543+
/** A link that leads to further details about this particular occurrence of the problem.
1544+
*/
1545+
public var about: String?
1546+
1547+
public init(about: String? = nil) {
1548+
self.about = about
1549+
}
1550+
1551+
public required init(from decoder: Decoder) throws {
1552+
let container = try decoder.container(keyedBy: StringCodingKey.self)
1553+
1554+
about = try container.decodeIfPresent("about")
1555+
}
1556+
1557+
public func encode(to encoder: Encoder) throws {
1558+
var container = encoder.container(keyedBy: StringCodingKey.self)
1559+
1560+
try container.encodeIfPresent(about, forKey: "about")
1561+
}
1562+
1563+
public func isEqual(to object: Any?) -> Bool {
1564+
guard let object = object as? Links else { return false }
1565+
guard self.about == object.about else { return false }
1566+
return true
1567+
}
1568+
1569+
public static func == (lhs: Links, rhs: Links) -> Bool {
1570+
return lhs.isEqual(to: rhs)
1571+
}
1572+
}
1573+
1574+
/** An object containing references to the source of the error.
1575+
*/
1576+
public class Source: APIModel {
1577+
1578+
/** A string indicating which URI query parameter caused the error.
1579+
*/
1580+
public var parameter: String?
1581+
1582+
/** A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute].
1583+
*/
1584+
public var pointer: String?
1585+
1586+
public init(parameter: String? = nil, pointer: String? = nil) {
1587+
self.parameter = parameter
1588+
self.pointer = pointer
1589+
}
1590+
1591+
public required init(from decoder: Decoder) throws {
1592+
let container = try decoder.container(keyedBy: StringCodingKey.self)
1593+
1594+
parameter = try container.decodeIfPresent("parameter")
1595+
pointer = try container.decodeIfPresent("pointer")
1596+
}
1597+
1598+
public func encode(to encoder: Encoder) throws {
1599+
var container = encoder.container(keyedBy: StringCodingKey.self)
1600+
1601+
try container.encodeIfPresent(parameter, forKey: "parameter")
1602+
try container.encodeIfPresent(pointer, forKey: "pointer")
1603+
}
1604+
1605+
public func isEqual(to object: Any?) -> Bool {
1606+
guard let object = object as? Source else { return false }
1607+
guard self.parameter == object.parameter else { return false }
1608+
guard self.pointer == object.pointer else { return false }
1609+
return true
1610+
}
1611+
1612+
public static func == (lhs: Source, rhs: Source) -> Bool {
1613+
return lhs.isEqual(to: rhs)
1614+
}
1615+
}
1616+
1617+
public init(code: String? = nil, detail: String? = nil, id: String? = nil, links: Links? = nil, meta: [String: Any]? = nil, source: Source? = nil, status: String? = nil, title: String? = nil) {
1618+
self.code = code
1619+
self.detail = detail
1620+
self.id = id
1621+
self.links = links
1622+
self.meta = meta
1623+
self.source = source
1624+
self.status = status
1625+
self.title = title
1626+
}
1627+
1628+
public required init(from decoder: Decoder) throws {
1629+
let container = try decoder.container(keyedBy: StringCodingKey.self)
1630+
1631+
code = try container.decodeIfPresent("code")
1632+
detail = try container.decodeIfPresent("detail")
1633+
id = try container.decodeIfPresent("id")
1634+
links = try container.decodeIfPresent("links")
1635+
meta = try container.decodeAnyIfPresent("meta")
1636+
source = try container.decodeIfPresent("source")
1637+
status = try container.decodeIfPresent("status")
1638+
title = try container.decodeIfPresent("title")
1639+
}
1640+
1641+
public func encode(to encoder: Encoder) throws {
1642+
var container = encoder.container(keyedBy: StringCodingKey.self)
1643+
1644+
try container.encodeIfPresent(code, forKey: "code")
1645+
try container.encodeIfPresent(detail, forKey: "detail")
1646+
try container.encodeIfPresent(id, forKey: "id")
1647+
try container.encodeIfPresent(links, forKey: "links")
1648+
try container.encodeAnyIfPresent(meta, forKey: "meta")
1649+
try container.encodeIfPresent(source, forKey: "source")
1650+
try container.encodeIfPresent(status, forKey: "status")
1651+
try container.encodeIfPresent(title, forKey: "title")
1652+
}
1653+
1654+
public func isEqual(to object: Any?) -> Bool {
1655+
guard let object = object as? Errors else { return false }
1656+
guard self.code == object.code else { return false }
1657+
guard self.detail == object.detail else { return false }
1658+
guard self.id == object.id else { return false }
1659+
guard self.links == object.links else { return false }
1660+
guard NSDictionary(dictionary: self.meta ?? [:]).isEqual(to: object.meta ?? [:]) else { return false }
1661+
guard self.source == object.source else { return false }
1662+
guard self.status == object.status else { return false }
1663+
guard self.title == object.title else { return false }
1664+
return true
1665+
}
1666+
1667+
public static func == (lhs: Errors, rhs: Errors) -> Bool {
1668+
return lhs.isEqual(to: rhs)
1669+
}
1670+
}
1671+
1672+
public init(errors: [Errors]? = nil) {
1673+
self.errors = errors
1674+
}
1675+
1676+
public required init(from decoder: Decoder) throws {
1677+
let container = try decoder.container(keyedBy: StringCodingKey.self)
1678+
1679+
errors = try container.decodeArrayIfPresent("errors")
1680+
}
1681+
1682+
public func encode(to encoder: Encoder) throws {
1683+
var container = encoder.container(keyedBy: StringCodingKey.self)
1684+
1685+
try container.encodeIfPresent(errors, forKey: "errors")
1686+
}
1687+
1688+
public func isEqual(to object: Any?) -> Bool {
1689+
guard let object = object as? Status412 else { return false }
1690+
guard self.errors == object.errors else { return false }
1691+
return true
1692+
}
1693+
1694+
public static func == (lhs: Status412, rhs: Status412) -> Bool {
1695+
return lhs.isEqual(to: rhs)
1696+
}
1697+
}
1698+
14761699
/** Error objects provide additional information about problems encountered while performing an operation.
14771700
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
14781701
* `1000`: generic error
@@ -2186,22 +2409,11 @@ Example:
21862409
/** The provided priceIncludingVAT does not match the actual price */
21872410
case status409(Status409)
21882411

2189-
/** Precondition failed
2190-
```
2191-
{
2192-
"errors": [
2193-
{
2194-
"id": "buck3h44qtf5j268141g",
2195-
"title": "Pump already unlocked/in-use on site by someone else",
2196-
"detail": "",
2197-
"status": "412",
2198-
"code": "FUELING_PUMP_BUSY_ON_SITE"
2199-
}
2200-
]
2201-
}
2202-
```
2412+
/** A preconditon for the payment process failed. The following codes may be seen:
2413+
* `FUELING_PUMP_BUSY_ON_SITE`: The pump is aready unlocked.
2414+
* `FUELING_PROVIDER_FORCED_PRE_AUTH`: The pump is already in use. This code is only used for a specific integration in ifsf360 to show an errorscreen in our app.
22032415
*/
2204-
case status412(PCFuelingErrors)
2416+
case status412(Status412)
22052417

22062418
/** The specified content type header is invalid */
22072419
case status415(Status415)
@@ -2286,7 +2498,7 @@ Example:
22862498
case 404: self = try .status404(decoder.decode(Status404.self, from: data))
22872499
case 406: self = try .status406(decoder.decode(Status406.self, from: data))
22882500
case 409: self = try .status409(decoder.decode(Status409.self, from: data))
2289-
case 412: self = try .status412(decoder.decode(PCFuelingErrors.self, from: data))
2501+
case 412: self = try .status412(decoder.decode(Status412.self, from: data))
22902502
case 415: self = try .status415(decoder.decode(Status415.self, from: data))
22912503
case 422: self = try .status422(decoder.decode(Status422.self, from: data))
22922504
case 500: self = try .status500(decoder.decode(Status500.self, from: data))

0 commit comments

Comments
 (0)