public function getCharge(ChargeRequest $chargeRequest)
 {
     $card = $chargeRequest->getCreditCard();
     $last4 = substr($card->getNumber(), -4);
     $chargeResponse = new ChargeResponse();
     $chargeResponse->setExternalId('ch_xxxxxxxxxxxxxx');
     $chargeResponse->setAmount($chargeRequest->getAmount());
     $chargeResponse->setLast4($last4);
     $chargeResponse->setBrand('Visa');
     $chargeResponse->setCurrency($chargeRequest->getCurrency());
     $chargeResponse->setDescription($chargeRequest->getDescription());
     $chargeResponse->setCreated(time());
     return $chargeResponse;
 }
Beispiel #2
0
 private function createCharge(ChargeRequest $chargeRequest)
 {
     $card = $chargeRequest->getCreditCard();
     return \Stripe\Charge::create(['amount' => $chargeRequest->getAmount(), 'currency' => $chargeRequest->getCurrency(), 'card' => ['name' => $card->getName(), 'address_zip' => $card->getZip5(), 'number' => $card->getNumber(), 'cvc' => $card->getCvc(), 'exp_month' => $card->getExpirationMonth(), 'exp_year' => $card->getExpirationYear()], 'description' => $chargeRequest->getDescription()]);
 }