Skip to content

Commit

Permalink
Merge pull request #140 from mercadolibre/fix/CCAP-708
Browse files Browse the repository at this point in the history
[CCAP-708] Add default method to get platform for postCardData requisition
  • Loading branch information
douglaseiki authored Nov 3, 2022
2 parents 47bed2f + 4aff053 commit 09ef5fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[Unreleased]
- Added default method to get Platform field for postCardData requisition

# v0.14.0
🚀 Release 0.14.0 🚀
- Two optional fieds added to the header of the postCardData requisition
Expand Down
3 changes: 2 additions & 1 deletion Source/Network/Services/MLCardFormAddCardService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ final class MLCardFormAddCardService: MLCardFormAddCardServiceBase {

let accessBearerToken = bearer + privateKey
let accessTokenParam = MLCardFormAddCardService.AccessTokenParam(accessToken: privateKey)
let platform = getPlatform() ?? MLCardFormBinService().getPlatform()
let headers = MLCardFormAddCardService.Headers(contentType: "application/json",
xFlowId: getFlowId(),
sessionId: MLCardFormTracker.sharedInstance.getSessionID(),
accessToken: accessBearerToken,
productId: getProductId(),
platform: getPlatform())
platform: platform)

NetworkLayer.request(router: MLCardFormApiRouter.postCardData(headers, buildAddCardBody(tokenId, addCardData: addCardData, features: CardFormFeatures(acceptThirdPartyCard: acceptThirdPartyCard, activateCard: activateCard)))) {
(result: Result<MLCardFormAddCardData, Error>) in
Expand Down
2 changes: 1 addition & 1 deletion Source/Network/Services/MLCardFormBinService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class MLCardFormBinService {
return appName.lowercased()
}

private func getPlatform() -> String {
func getPlatform() -> String {
let appName = getAppName()
if appName.contains(meliName) {
return AppIdentifier.meli.rawValue
Expand Down

0 comments on commit 09ef5fd

Please sign in to comment.