public function getCharge(ChargeRequest $chargeRequest) { $stripeCharge = $this->createCharge($chargeRequest); $chargeResponse = new ChargeResponse(); $chargeResponse->setExternalId($stripeCharge['id']); $chargeResponse->setAmount($stripeCharge['amount']); $chargeResponse->setLast4($stripeCharge['source']['last4']); $chargeResponse->setBrand($stripeCharge['source']['brand']); $chargeResponse->setCurrency($stripeCharge['currency']); $chargeResponse->setDescription($stripeCharge['description']); $chargeResponse->setCreated($stripeCharge['created']); return $chargeResponse; }
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; }