<commit_before><?php
class Infusionsoft_InvoiceService extends Infusionsoft_InvoiceServiceBase{
    public static function chargeInvoiceArbitraryAmount($contactId, $invoiceId, $cardId, $amount, $merchantAccountId){

    //Create a new order (InvoiceService.blankOrder...
        $dummyInvoiceId = Infusionsoft_InvoiceService::createBlankOrder($contactId, "API invoice :" . $amount, date('Ymd\TH:i:s'));

    //Add an order item that is the correct amount you want to charge...
        Infusionsoft_InvoiceService::addOrderItem($dummyInvoiceId, 0, 3, $amount, 1, "API order", "");
    //Set orders custom field "_ChargeStatus" to "Pending"
        $dummyOrder = new Infusionsoft_Job(Infusionsoft_InvoiceService::getOrderId($dummyInvoiceId));
        $dummyOrder->OrderStatus = "Pending";
        $dummyOrder->save();
    //Try to charge the invoice
        $result = Infusionsoft_InvoiceService::chargeInvoice($dummyInvoiceId, "API payment", $cardId, $merchantAccountId, false);<commit_msg>Fixed bug in InvoiceService::chargeInvoiceArbitraryAmount.<commit_after><?php
class Infusionsoft_InvoiceService extends Infusionsoft_InvoiceServiceBase{
    public static function chargeInvoiceArbitraryAmount($contactId, $invoiceId, $cardId, $amount, $merchantAccountId){

    //Create a new order (InvoiceService.blankOrder...
        $dummyInvoiceId = Infusionsoft_InvoiceService::createBlankOrder($contactId, "API Arbitrary Payment Invoice: " . $amount, date('Ymd\TH:i:s'));

    //Add an order item that is the correct amount you want to charge...
        Infusionsoft_InvoiceService::addOrderItem($dummyInvoiceId, 0, 3, $amount, 1, "API order", "");
    //Set orders custom field "_ChargeStatus" to "Pending"
        $invoice = new Infusionsoft_Invoice($dummyInvoiceId);
        $dummyOrder = new Infusionsoft_Job($invoice->JobId);
        $dummyOrder->OrderStatus = "Pending";
        $dummyOrder->save();
    //Try to charge the invoice
        $result = Infusionsoft_InvoiceService::chargeInvoice($dummyInvoiceId, "API payment", $cardId, $merchantAccountId, false);
{'fraction_non_alphanumeric': 0.11590688651794374, 'fraction_numerical': 0.002909796314258002, 'mean_word_length': 4.92816091954023, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2338864', 'n_tokens_mistral': 606, 'n_tokens_neox': 597, 'n_words': 145}