Remove savedCreditCards

@author Tom Haskins-Vaughan <tom@harvestcloud.com>
@since  2013-03-27

@param  \HarvestCloud\CoreBundle\Entity\Payment\SavedCreditCard $savedCreditCard
504111
public function removeSavedCreditCard(\HarvestCloud\CoreBundle\Entity\Payment\SavedCreditCard $savedCreditCard)
    {
        $this->savedCreditCards->removeElement($savedCreditCard);
    }
1035043
def save_card(self, card, cache=False):
        
        if cache:
            self.cache_card(card)
        carddict = card.save()
        with sqlite3.connect(self.dbname) as carddb:
            carddb.execute("DELETE from CARDS where code = ?",
                           (carddict["code"],))
            carddb.execute("INSERT INTO CARDS VALUES(?, ?, ?, ?, ?)",
                           [carddict[key] if isinstance(carddict[key], str)
                            else str(carddict[key]) for key in FIELDS])
1207520
public function cardDelete($card_id)
    {
        if (empty($card_id)) {
            $this->setError('缺少错误');

            return false;
        }

        $queryStr            = [];
        $queryStr['card_id'] = $card_id;

        $this->apitype = 'card';
        $this->module  = 'delete';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
741351
public function SetFormSaved($Saved = TRUE) {
      if ($Saved === '') // Allow reset
         $this->_FormSaved = '';
      else // Force true/false
         $this->_FormSaved = ($Saved) ? TRUE : FALSE;
   }
774178
function deleteCard(card, options) {
  return webdav.deleteObject(card.url, card.etag, options);
}
568979
public function tokenizeCreditCard(CieloCreditCard $cieloCreditCard, CieloCustomer $cieloCustomer)
    {
        try {
            $sale = new Sale();
            $sale->CustomerName   = $cieloCustomer->getName();
            $sale->CardNumber     = $cieloCreditCard->getCardNumber();
            $sale->Holder         = $cieloCreditCard->getHolder();
            $sale->ExpirationDate = $cieloCreditCard->getExpirationDate();
            $sale->Brand          = $cieloCreditCard->getBrand();

            $token = (new TokenizeCardRequest($this->merchant, $this->environment))->execute($sale);

            $paymentData = $token;
            $paymentStatus = 1;
            $paymentMessage = 'Operation Successful';
        } catch (CieloRequestException $e) {
            $error = $e->getCieloError();
            throw new ResourceErrorException($error->getMessage(), $error->getCode());
        }

        return new ResourceResponse($paymentStatus, $paymentMessage, $paymentData);
    }
936868
public Map<String, Object> deleteCreditCard(String creditCardId, Setup setup) {
        this.requestMaker = new RequestMaker(setup);
        RequestProperties props = new RequestPropertiesBuilder()
                .method("DELETE")
                .endpoint(String.format("/v2/fundinginstruments/%s", creditCardId))
                .type(Customers.class)
                .contentType(CONTENT_TYPE)
                .build();

        return this.requestMaker.doRequest(props);
    }
354769
private function addCreditcard(CreditCard $creditcard, $options, $action)
    {
        $xml = $this->xml;
        $year  = $this->cc_format($creditcard->year, 'two_digits');
        $month = $this->cc_format($creditcard->month, 'two_digits');

        $xml->PaymentInfo(null, $action)
            ->PayMethod(
                $this->CARD_MAPPINGS[CreditCard::type($creditcard->number)],
                'PaymentInfo'
            )
            ->CardPan($creditcard->number, 'PaymentInfo')
            ->CardExpDate("{$year}{$month}", 'PaymentInfo')
            ->CardCvv2($creditcard->verification_value, 'PaymentInfo')
            ->CardHolderName(trim($creditcard->name()), 'PaymentInfo');

        if ($options['installments']) {
            $xml->InstallmentParameters(null, 'PaymentInfo')
                ->ExtInstallmentoffset(0, 'InstallmentParameters')
                ->ExtInstallmentperiod($options['installments'], 'InstallmentParameters');
        }
    }
1020741
public function delCard($card_id) {
        $data = array(
            'card_id' => $card_id,
        );
        if (!$this->access_token && !$this->checkAuth()) return false;
        $result = $this->http_post(self::API_BASE_URL_PREFIX . self::CARD_DELETE . 'access_token=' . $this->access_token, self::json_encode($data));
        if ($result) {
            $json = json_decode($result, true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg  = $json['errmsg'];
                return false;
            }
            return true;
        }
        return false;
    }
529332
private function addCreditcard(CreditCard $creditcard)
    {
        $this->post['CardNumber'] = $creditcard->number;
        $this->post['CardExpiryMonth'] = $this->cc_format($creditcard->month, 'two_digits');
        $this->post['CardExpiryYear'] = $this->cc_format($creditcard->year, 'two_digits');
        $this->post['CustomerFirstName'] = $creditcard->first_name;
        $this->post['CustomerLastName'] = $creditcard->last_name;
        $this->post['CardHoldersName'] = $creditcard->name();

        if ($creditcard->verification_value) {
            $this->post['CVN'] = $creditcard->verification_value;
        }
    }
398559
public function removeCreditNote(string $id, array $data, array $headers = [])
    {
        $url = $this->url('invoices/%s/remove_credit_note', $id);

        return $this->post($url, $data, $headers);
    }
946781
def delete(customer, card):
        
        if isinstance(customer, resources.Customer):
            customer = customer.id
        if isinstance(card, resources.Card):
            card = card.id

        http_client = HttpClient()
        http_client.delete(routes.url(routes.CARD_RESOURCE, resource_id=card, customer_id=customer))
33264
public function create(GiftCard &$giftCard)
    {
        $data = $giftCard->exportData();
        $endpoint = '/admin/gift_cards.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'gift_card' => $data
            )
        );
        $giftCard->setData($response['gift_card']);
    }
454450
public function actionIndexDelete($id=NULL)
	{
		$cards = $this->loadDashboardCards();
		$value = $cards->value;
		
		if (array_key_exists($id, $value))
			unset($value[$id]);

		$cards->value = CJSON::encode($value);
		
		if ($cards->save())
		{
			$newCard = $this->loadCardDetailsModel($id);
			if ($newCard->delete())
				return true;
		}
		throw new CHttpException(500, Yii::t('Api.card', 'Card could not be saved.'));
	}
422809
protected function fillCardDetails($card)
    {
        if ($card) {
            $this->card_brand = $card->brand;
            $this->card_last_four = $card->last4;
        }

        return $this;
    }
977172
func (ctrl Controller) CompleteCreditCard(w http.ResponseWriter, req *http.Request) {
	req.ParseForm()

	order := getCurrentOrder(w, req)

	expMonth, _ := strconv.Atoi(req.Form.Get("exp_month"))
	expYear, _ := strconv.Atoi(req.Form.Get("exp_year"))

	creditCard := gomerchant.CreditCard{
		Name:     req.Form.Get("name"),
		Number:   req.Form.Get("creditcard"),
		CVC:      req.Form.Get("cvv"),
		ExpYear:  uint(expYear),
		ExpMonth: uint(expMonth),
	}

	if creditCard.ValidNumber() {
		// TODO integrate with https://github.com/qor/gomerchant to handle those information
		tx := utils.GetDB(req)
		err := orders.OrderState.Trigger("checkout", order, tx, "")

		if err == nil {
			tx.Save(order)
			http.Redirect(w, req, "/cart/success", http.StatusFound)
			return
		}
	}

	utils.AddFlashMessage(w, req, "Invalid Credit Card", "error")
	http.Redirect(w, req, "/cart", http.StatusFound)
}
877042
public function updateCard(string $token): void
    {
        $customer = $this->asStripeCustomer();
        $token = Token::retrieve($token, ['api_key' => $this->getStripeKey()]);
        // If the given token already has the card as their default source, we can just
        // bail out of the method now. We don't need to keep adding the same card to
        // the user's account each time we go through this particular method call.
        if ($token->card->id === $customer->default_source) {
            return;
        }
        $card = $customer->sources->create(['source' => $token]);
        $customer->default_source = $card->id;
        $customer->save();
        // Next, we will get the default source for this user so we can update the last
        // four digits and the card brand on this user record in the database, which
        // is convenient when displaying on the front-end when updating the cards.
        $source = $customer->default_source
            ? $customer->sources->retrieve($customer->default_source)
            : null;

        $this->fillCardDetails($source);

        $this->save();
    }