Ejemplo n.º 1
0
/**
 * @param PayService $service
 * @param array      $post
 * @param int        $amount
 */
function createPayJp(PayService $service, $post, $amount)
{
    if (!($card_id = $service->getCardIdInPost($post))) {
        return;
    }
    $factory = $service->getFactory();
    if (isset($post['authorize']) && $post['authorize'] === 'auth') {
        $factory->create($card_id)->authorize($amount);
    } else {
        $factory->create($card_id)->charge($amount);
    }
}