Example #1
0
<?php

/** Code for voucher-refill mode calls in a2billing AGI
    Copyright(C) P. Christeas, Areski, 2007-8
*/
if (getAGIconfig('early_answer', false)) {
    $agi->answer();
} else {
    $agi->exec('Progress');
}
$agi->conlog('Voucher mode', 4);
$card = null;
// Repeat until we hangup
for ($num_try = 0; $num_try < getAGIconfig('number_try', 1); $num_try++) {
    if (!$card) {
        $card = getCard();
    } else {
        if (!empty($card['locked'])) {
            ReleaseCard($card);
        }
    }
    if ($card === false) {
        break;
    }
    if ($card === null) {
        continue;
    }
    $agi->conlog('Card: ' . print_r($card, true), 4);
    //TODO: fix lang
    if ($card['status'] != 1) {
        switch ($card['status']) {
    getAllAddresses();
}
if ($function == "get_address") {
    getAddress();
}
if ($function == "update_address") {
    updateAddress();
}
if ($function == "add_address") {
    addAddress();
}
if ($function == "get_all_cards") {
    getAllCards();
}
if ($function == "get_card") {
    getCard();
}
if ($function == "add_credit_card") {
    addCreditCard();
}
if ($function == "add_credit_card_checkout") {
    addCreditCardCheckout();
}
if ($function == "remove_credit_card") {
    removeCreditCard();
}
if ($function == "get_cart") {
    getCart();
}
if ($function == "add_item_to_cart") {
    addItemToCart();