示例#1
0
        /// <summary>
        /// Update card
        /// </summary>
        /// <param name="card">Card</param>
        /// <returns>Card</returns>
        public Card Update(Card card)
        {
            card.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId,
                GlobalConstants.Id
            });
            card.CheckRequiredFields();
            card.SetRequiredFields(new List <string> {
            });
            card.SetOptionalFields(new List <string> {
                GlobalConstants.CardExpiry,
                GlobalConstants.NickName,
                GlobalConstants.MerchantRefNum,
                GlobalConstants.HolderName,
                GlobalConstants.BillingAddressId
            });

            Request request = new Request(
                method: RequestType.Put,
                uri: PrepareUri("/profiles/" + card.ProfileId() + "/cards/" + card.Id()),
                body: card
                );

            dynamic response = _client.ProcessRequest(request);

            Card returnVal = new Card(response);

            returnVal.ProfileId(card.ProfileId());
            return(returnVal);
        }
示例#2
0
        /// <summary>
        /// Get card
        /// </summary>
        /// <param name="card">Card</param>
        /// <returns>Card</returns>
        public Card Get(Card card)
        {
            card.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId,
                GlobalConstants.Id
            });
            card.CheckRequiredFields();

            Request request = new Request(
                method: RequestType.Get,
                uri: PrepareUri("/profiles/" + card.ProfileId() + "/cards/" + card.Id())
                );

            dynamic response = _client.ProcessRequest(request);

            Card returnVal = new Card(response);

            returnVal.ProfileId(card.ProfileId());
            return(returnVal);
        }
示例#3
0
        /// <summary>
        /// Delete card
        /// </summary>
        /// <param name="card">Card</param>
        /// <returns>bool</returns>
        public bool Delete(Card card)
        {
            card.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId,
                GlobalConstants.Id
            });
            card.CheckRequiredFields();

            Request request = new Request(
                method: RequestType.Delete,
                uri: PrepareUri("/profiles/" + card.ProfileId() + "/cards/" + card.Id()),
                body: card
                );

            _client.ProcessRequest(request);

            return(true);
        }