# Manage real cards with controls test cases source: https://developer.mastercard.com/business-payment-controls/documentation/testing/manage-real-cards-with-controls/index.md ## Test cases {#test-cases} ### Test data: Register a real card {#test-data-register-a-real-card} **POST**/real-card-accounts #### Positive sample response {#positive-sample-response} Success: Real card registered HTTP code `2xx` **Payload** ```json { "accountGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "expiry": "2021-11", "billingCurrency": "825", "active": true, "createdDate": "2020-10-06T11:09:42.10+01:00", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00", "applicationSource": "iccp", "nameOnCard": "John Doe", "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "authorizationControlsEnabled": true, "accountNumber": "1234567890123456700", "unmaskedAccountNumber": true } ``` #### Negative sample response {#negative-sample-response} Fail: Authentication absent HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "user.authentication.absent", "Description": "No authentication data was found for the user", "Recoverable": false } ] } ] } ``` ### Test data: Register a new contact linked to a real card {#test-data-register-a-new-contact-linked-to-a-real-card} **POST**/real-card-accounts/{account_guid}/contacts #### Positive sample response {#positive-sample-response-1} Success: A new contact linked to a real card registered HTTP code `2xx` **Payload** ```json { "contactGuid": "CORP1234", "firstName": "First name", "middleInitial": "M", "lastName": "Last name", "nameSuffix": "Name suffix", "issuerGuid": "ISSUER1234", "corpGuid": "CORP1234", "addressLine1": "Address line 1", "addressLine2": "Address line 2", "addressLine3": "Address line 3", "poBoxNumber": "PO Box Number", "cityName": "City name", "countrySubdivisionCode": "Sub Division Code", "postalCode": "Post code", "countryCode": "353", "active": true, "buildingText": "Building Text", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00" } ``` #### Negative sample response {#negative-sample-response-1} Fail: Account GUID not found HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "resource.not.found", "Description": "Resource not found", "Recoverable": false, "Details": "guid" } ] } ] } ``` ### Test data: Register a funding source {#test-data-register-a-funding-source} **POST**/funding-sources #### Positive sample response {#positive-sample-response-2} Success: Funding source registered HTTP code `2xx` **Payload** ```json { "fundingSourceGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "realCardGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "vcnCreationEnabled": true, "fundingSourceAlias": "alias", "authorizationControlsEnabled": true, "active": true, "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "createdDate": "2020-10-06T11:09:42.10+01:00", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00" } ``` #### Negative sample response {#negative-sample-response-2} Fail: Funding source alias not found HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "resource.not.found", "Description": "Resource not found", "Recoverable": false, "Details": "alias" } ] } ] } ``` ### Test data: Register controls to a funding source {#test-data-register-controls-to-a-funding-source} **POST**/funding-sources/{funding_source_guid}/controls #### Positive sample response {#positive-sample-response-3} Success: Funding source controls registered HTTP code `2xx` **Payload** ```json { "accountControl": { "action": "APPROVE", "alias": "Account Service Rule", "cardLimit": { "cardAmount": 500, "authorisationCount": 10 }, "monthlyLimit": { "cardAmount": 500, "authorisationCount": 10 }, "dailyLimit": { "cardAmount": 500, "authorisationCount": 10 }, "weeklyLimit": { "cardAmount": 500, "authorisationCount": 10 }, "quarterlyLimit": { "cardAmount": 500, "authorisationCount": 10 }, "yearlyLimit": { "cardAmount": 500, "authorisationCount": 10 }, "countryCodes": ["001"], "merchantCategoryCodes": ["840"], "startDate": "2020-10-06T11:09:42.10+01:00", "endDate": "2021-10-06T11:09:42.10+01:00" }, "inControlRules": [ { "action": "APPROVE", "alias": "alias", "transactionLimits": [ { "amount": 12, "negate": true } ], "geographies": [ { "negate": true } ], "velocities": [ { "maxTrans": 12, "cumulativeLimit": 1200, "period": "DAILY", "availableBalance": 1200, "currencyType": "MERCHANT", "currencyCode": "825", "endDate": "2020-10-06T11:09:42.10+01:00", "negate": true } ], "validityPeriods": [ { "from": "2020-10-06T11:09:42.10+01:00", "to": "2020-11-06T11:09:42.10+01:00", "strictPreAuthCheck": true, "negate": true } ], "amountRanges": [ { "minAmount": 1000, "maxAmount": 10000, "strictPreAuthCheck": true, "currencyType": "MERCHANT", "currencyCode": "825", "negate": true } ], "acceptorIds": [ { "acceptorId": "123456789012345", "acquirerId": "3", "negate": true } ], "ageingVelocities": [ { "authorizationHoldDays": 1234, "cumulativeLimit": 1000, "timeZone": "UTC-06:00", "availableBalance": 1000, "currencyType": "MERCHANT", "currencyCode": "825", "negate": true } ], "curfews": [ { "fromTime": "08:20", "toTime": "18:20", "timeZone": "UTC", "daysOfWeek": "SUNDAY", "negate": true } ], "timeOfDays": [ { "times": [ { "day": "SUNDAY", "fromTime": "08:21", "toTime": "21:00" } ], "timeZone": "UTC", "negate": true } ], "merchantCategoryCodes": [ { "negate": true, "mccs": "[1234, 5678]" } ] } ] } ``` #### Negative sample response {#negative-sample-response-3} Fail: Funding source GUID not found HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "resource.not.found", "Description": "Resource not found", "Recoverable": false, "Details": "funding source guid" } ] } ] } ``` ### Test data: Retrieve card account details {#test-data-retrieve-card-account-details} **GET**/real-card-accounts/{account_guid} #### Positive sample response {#positive-sample-response} Success: Card account details retrieved HTTP code `2xx` **Payload** ```json { "accountGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "expiry": "2021-11", "billingCurrency": "825", "active": true, "createdDate": "2020-10-06T11:09:42.10+01:00", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00", "applicationSource": "iccp", "nameOnCard": "John Doe", "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "authorizationControlsEnabled": true, "replacedAccountGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "replacedAccountReason": "LOST", "accountNumber": "1234567890123456700", "unmaskedAccountNumber": true } ``` #### Negative sample response {#negative-sample-response} Fail: Account GUID missing HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "resource.not.found", "Description": "Resource not found", "Recoverable": false, "Details": "guid" } ] } ] } ``` ### Test data: Search a real card account using search parameters {#test-data-search-a-real-card-account-using-search-parameters} **POST**/real-card-accounts/searches #### Positive sample response {#positive-sample-response-1} Success: Card account details retrieved HTTP code `2xx` **Payload** ```json { "accountGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "expiry": "2021-11", "billingCurrency": "825", "active": true, "createdDate": "2020-10-06T11:09:42.10+01:00", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00", "applicationSource": "iccp", "nameOnCard": "John Doe", "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "authorizationControlsEnabled": true, "replacedAccountGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "replacedAccountReason": "LOST", "accountNumber": "1234567890123456700", "unmaskedAccountNumber": true, "corpGuid": "CORP1234", "issuerGuid": "ISSUER1234", "fundingSourceGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "alias": "alias", "vcnCreationEnabled": true } ``` #### Negative sample response {#negative-sample-response-1} Fail: Pattern is not valid HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "pattern.invalid", "Recoverable": false, "Details": "accountNumber" } ] } ] } ``` ### Test data: Update card account {#test-data-update-card-account} **PUT**/real-card-accounts/{account_guid} #### Positive sample response {#positive-sample-response-2} Success: Card account updated HTTP code `2xx` **Payload** ```json { "accountGuid": "SENTTY2093845AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE23917889123", "accountNumber": "1234567890123456700", "expiry": "2022-12", "nameOnCard": "John Doe", "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "billingCurrency": "USD", "active": true, "createdDate": "2018-01-12T12:07:31.000Z", "lastUpdateDate": "2018-01-12T12:07:31.000Z", "authorizationControlsEnabled": true, "applicationSource": "iccp" } ``` #### Negative sample response {#negative-sample-response-2} Fail: Unauthorized user HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "user.not.authorized", "Recoverable": false, "Description": "Forbidden" } ] } ] } ``` ### Test data: Retrieve contact details {#test-data-retrieve-contact-details} **GET**/real-card-accounts/{account_guid}/contacts/{contact_guid} #### Positive sample response {#positive-sample-response-3} Success: Contact details retrieved HTTP code `2xx` **Payload** ```json { "contactGuid": "CORP1234", "firstName": "First name", "middleInitial": "M", "lastName": "Last name", "nameSuffix": "Name suffix", "issuerGuid": "ISSUER1234", "corpGuid": "CORP1234", "addressLine1": "Address line 1", "addressLine2": "Address line 2", "addressLine3": "Address line 3", "poBoxNumber": "PO Box Number", "cityName": "City name", "countrySubdivisionCode": "Sub Division Code", "postalCode": "Post code", "countryCode": "353", "active": true, "buildingText": "Building Text", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00" } ``` #### Negative sample response {#negative-sample-response-3} Fail: Contact GUID not found HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "resource.not.found", "Description": "Resource not found", "Recoverable": false, "Details": "guid" } ] } ] } ``` ### Test data: Update contact details {#test-data-update-contact-details} **PUT**/real-card-accounts/{account_guid}/contacts/{contact_guid} #### Positive sample response {#positive-sample-response-4} Success: Contact details updated HTTP code `2xx` **Payload** ```json { "contactGuid": "CORP1234", "firstName": "First name", "middleInitial": "M", "lastName": "Last name", "nameSuffix": "Name suffix", "issuerGuid": "ISSUER1234", "corpGuid": "CORP1234", "addressLine1": "Address line 1", "addressLine2": "Address line 2", "addressLine3": "Address line 3", "poBoxNumber": "PO Box Number", "cityName": "City name", "countrySubdivisionCode": "Sub Division Code", "postalCode": "Post code", "countryCode": "353", "active": true, "buildingText": "Building Text", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00" } ``` #### Negative sample response {#negative-sample-response-4} Fail: Country code is too long HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "length.long", "Recoverable": false, "Details": "countryCode" } ] } ] } ``` ### Test data: Retrieve funding source details {#test-data-retrieve-funding-source-details} **GET**/funding-sources/{funding_source_guid} #### Positive sample response {#positive-sample-response-5} Success: Funding source details retrieved HTTP code `2xx` **Payload** ```json { "fundingSourceGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "realCardGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "vcnCreationEnabled": true, "fundingSourceAlias": "alias", "authorizationControlsEnabled": true, "active": true, "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "createdDate": "2020-10-06T11:09:42.10+01:00", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00" } ``` #### Negative sample response {#negative-sample-response-5} Fail: Funding source GUID is missing HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "resource.not.found", "Description": "Resource not found", "Recoverable": false, "Details": "guid" } ] } ] } ``` ### Test data: Update a funding source {#test-data-update-a-funding-source} **PUT**/funding-sources/{funding_source_guid} #### Positive sample response {#positive-sample-response-6} Success: Funding source updated HTTP code `2xx` **Payload** ```json { "fundingSourceGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "realCardGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "vcnCreationEnabled": true, "fundingSourceAlias": "alias", "authorizationControlsEnabled": true, "active": true, "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "createdDate": "2020-10-06T11:09:42.10+01:00", "lastUpdateDate": "2020-10-06T11:09:42.10+01:00" } ``` #### Negative sample response {#negative-sample-response-6} Fail: A funding source field provided is not recognized HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "field.unrecognized", "Recoverable": false, "Details": "unknownField" } ] } ] } ``` ### Test data: Register a replaced real card {#test-data-register-a-replaced-real-card} **POST**/real-card-accounts #### Positive sample response {#positive-sample-response} Success: Replaced real card registered HTTP code `2xx` **Payload** ```json { "expiry": "2021-11", "applicationSource": "iccp", "nameOnCard": "John Doe", "ownerGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "authorizationControlsEnabled": true, "replacedAccountGuid": "SENTTY13379505AC33CDA796BCBE850EADAF625FAD6B071E8D100CB1ECBEA76AD402DE1519037869", "replacedAccountReason": "LOST", "accountNumber": "1234567890123456700", "unmaskedAccountNumber": true } ``` #### Negative sample response {#negative-sample-response} Fail: Replaced account GUID field not populated HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "field.invalid", "Description": "Replaced Account GUID does not exist", "Recoverable": false, "Details": "replacedAccountGuid" } ] } ] } ``` ### Test data: Delete a funding source linked to a lost real card {#test-data-delete-a-funding-source-linked-to-a-lost-real-card} **DELETE**/funding-sources/{funding_source_guid} #### Positive sample response {#positive-sample-response-1} Success: Funding source deleted HTTP code `204 No content` #### Negative sample response {#negative-sample-response-1} Fail: User not authorized HTTP code `4xx` **Payload** ```json { "Errors": [ { "Error": [ { "Source": "account-service", "ReasonCode": "user.not.authorized", "Recoverable": false, "Description": "Forbidden" } ] } ] } ``` ### Test data: Delete a lost real card account {#test-data-delete-a-lost-real-card-account} **DELETE**/real-card-accounts/{account_guid} #### Positive sample response {#positive-sample-response-2} Success: Real card deleted HTTP code `204 No content` #### Negative sample response {#negative-sample-response-2} Fail: Real card associated with an active funding source HTTP code `4xx` **Payload** ```json { "Errors": { "Error": [ { "Source": "Business Payment Controls", "ReasonCode": "action.invalid", "Description": "Real Card cannot be deleted", "Recoverable": false, "Details": "Funding Source is associated with Real Card" } ] } } ```