当前位置: 首页>>代码示例>>PHP>>正文


PHP Transaction::setAccount方法代码示例

本文整理汇总了PHP中Transaction::setAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::setAccount方法的具体用法?PHP Transaction::setAccount怎么用?PHP Transaction::setAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


在下文中一共展示了Transaction::setAccount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAccountAssesor

 public function testAccountAssesor()
 {
     $expected = '62.90.64.393';
     $transaction = new Transaction();
     $transaction->setAccount($expected);
     $this->assertEquals($expected, $transaction->getAccount());
 }
开发者ID:SamMousa,项目名称:php-mt940,代码行数:7,代码来源:TransactionTest.php

示例2: HostedPage

$hostedPageInfo = new HostedPage();
$hostedPageInfo->setCountryCode('MY');
$hostedPageInfo->setLanguage('en');
$hostedPageInfo->setReturnUrl('http://www.mysite.co.my/PaymentReturn.php');
// specify a page on your site customer will be redirected to after completing the MOLPay payment
$hostedPageInfo->setProcessorPaymentMethodId('all');
// Customer can choose any payment method type at MOLPay
$provider = new PaymentProvider();
$provider->setName('MOLPay');
$hostedPageInfo->setPaymentProvider($provider);
$pm->setHostedPage($hostedPageInfo);
$transaction = new Transaction();
$transaction->setCurrency('MYR');
// Unique transaction ID, use prefix to tell transactions apart from the subscription transactions
$transaction->setMerchantTransactionId('VINTEST-' . rand(10000, 99999));
$transaction->setAccount($account);
$transaction->setSourcePaymentMethod($pm);
//Create purchase line items. This can also be created by looking up a CashBox Product
$transaction_lineItem0 = new TransactionItem();
$transaction_lineItem0->setSku('MYPRODUCT001');
// If using a CashBox Product, specify the Product's ID here
$transaction_lineItem0->setName('Digital Magazine');
$transaction_lineItem0->setPrice('4.99');
$transaction_lineItem0->setQuantity('1');
$transaction_lineItem0->setTaxClassification('DM010100');
// Specify appropriate Avalara TaxCode here
// Campaign Code can be specified for each individual line item:
//$transaction_lineItem0->setCampaignCode('promo2');
$lineitems = array($transaction_lineItem0);
$transaction->setTransactionItems($lineitems);
// we can choose to send email for one-time transactions, or not
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:31,代码来源:MOLPayOneTimeTransaction.php

示例3: Account

$dryrun = $argv[2];
print "accountId is {$accountId} \n";
print "dryrun is {$dryrun} \n";
$account = new Account();
$return = $account->fetchByMerchantAccountId($accountId);
$customer = $return['data']->account;
// This example is assuming we already know it's the default PM and type is Credit Card
$pm = $customer->paymentMethods[0];
$nv = new NameValuePair();
$nv->setName('CVN');
$nv->setValue('123');
$pm->setNameValues(array($nv));
$transaction = new Transaction();
$transaction->setCurrency('USD');
$transaction->setMerchantTransactionId('testTrx-' . rand(10000, 99999));
$transaction->setAccount($customer);
$transaction_lineItem0 = new TransactionItem();
$transaction_lineItem0->setSku('RMMTEST002');
$transaction_lineItem0->setName('LineItem 1');
$transaction_lineItem0->setMerchantAutoBillItemId('foobar');
$transaction_lineItem0->setPrice('99.99');
$transaction_lineItem0->setQuantity('1');
// Campaign Code can be assigned to each individual line item:
$transaction_lineItem0->setCampaignCode('promo2');
$lineitems = array($transaction_lineItem0);
$transaction->setTransactionItems($lineitems);
$transaction->setSourcePaymentMethod($pm);
// we can choose to send email for one-time transactions, or not
$sendEmailNotification = 1;
// use the default CashBox AVS and CVN policy
$ignoreAvsPolicy = 0;
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:31,代码来源:transactionAuthCapture.php

示例4: retrieveByClient

  static public function retrieveByClient($status, $client_id = null)
  {
//echo $status;
    $types= array('all','sell','purchase','switch');
    $statuses= array('all','pending','completed','cancelled');    
    if(!in_array($status,$statuses))
    if(!in_array($status,$types))    
      die('Wrong status when getting tranaction collection!');
    $IsTypeOriented = in_array($status,$statuses) ? false: true;
    if(!$client_id)
      die('Should add case for all clients!');


    $transactions= array();
    if($IsTypeOriented)
      $addition = ($status!= 'all') ? " AND types = '$status'" : "";
    else
      $addition = ($status!= 'all') ? " AND status = '$status'" : "";
      
    $query = " SELECT t.id, t.created_at, t.comment_user, t.comment_admin, a.name aname, i.fund_name name,
    i.ISIN code, t.status, t.types, t.amount1  FROM transactions t, custody_ac a, fund i
    WHERE t.id_client = '$client_id' AND a.id = t.id_account AND i.id = t.id_isin1 $addition ";
    
//echo $query;

    $qres=mysql_query($query) or die(mysql_error());
    while($row=mysql_fetch_assoc($qres))
    {
      if(trim($row['id_isin2']))
      {
        $query = " SELECT name, code FROM isin WHERE id = '".trim($row['id_isin2'])."' LIMIT 1";
        //die($query);
        $qres1=mysql_query($query);
        $crow=mysql_fetch_assoc($qres1);
      }


      $transaction = new Transaction();
      $transaction->setId($row['id']);
      $transaction->setStatus($row['status']);
      $transaction->setType($row['types']);
      $transaction->setCommentUser($row['comment_user']);
      $transaction->setCommentAdmin($row['comment_admin']);
      $transaction->setSecurity1($row['name']);
      $transaction->setAmount1($row['amount1']);
      $transaction->setSecurity2($crow['name']?$crow['name']:0);
      $transaction->setAmount2($row['amount2']);
      $transaction->setIsin($row['code']);
      $transaction->setIsin2($crow['code']);
      $transaction->setAccount($row['aname']);
      $transaction->setDatetime($row['created_at']);
      $transactions[] = $transaction;

    }

    return $transactions;
  }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:57,代码来源:transactioncollection.class.php

示例5: prepay

function prepay($autobill)
{
    // Only use sparse object, so all data members are not over-written.
    $sparseAccount = new Account();
    $sparseAccount->merchantAccountId = $autobill->account->merchantAccountId;
    $fetchedPaymentMethod = $autobill->account->paymentMethods[0];
    // Only use sparse object, so all data members are not over-written.
    $sparsePaymentMethod = new PaymentMethod();
    $sparsePaymentMethod->merchantPaymentMethodId = $fetchedPaymentMethod->merchantPaymentMethodId;
    $transaction = new Transaction();
    $transaction->setCurrency('USD');
    $transaction->setSourcePaymentMethod($sparsePaymentMethod);
    $transaction->setAccount($sparseAccount);
    // loop through the cart on server side to add items.
    $transaction_lineitem1 = new TransactionItem();
    $transaction_lineitem1->setSku($autobill->items[0]->product->merchantProductId);
    $transaction_lineitem1->setName('PRE-PAY:' . $autobill->items[0]->product->descriptions[0]->description);
    $transaction_lineitem1->setPrice($autobill->items[0]->product->prices[0]->amount);
    $transaction_lineitem1->setQuantity('1');
    $lineitems = array($transaction_lineitem1);
    $transaction->setTransactionItems($lineitems);
    $sendEmailNotification = false;
    $ignoreAvsPolicy = true;
    $ignoreCvnPolicy = true;
    $campaign = NULL;
    $dryrun = false;
    $response = $transaction->authCapture($sendEmailNotification, $ignoreAvsPolicy, $ignoreCvnPolicy, $campaign, $dryrun);
    if ($response['returnCode'] != '200') {
        print $response['returnCode'] . PHP_EOL;
        print $response['returnString'] . PHP_EOL;
    } else {
        print "returnCode=" . $response['returnCode'] . PHP_EOL;
        print "returnString=" . $response['returnString'] . PHP_EOL;
        if ($response['returnCode'] == "200") {
            $returnTransaction = $response['data']->transaction;
            if ($returnTransaction->statusLog[0]->status == 'Authorized') {
                print "Transaction approved\n";
                print "Transaction with id " . $returnTransaction->merchantTransactionId . " was successfully captured";
                return $returnTransaction->merchantTransactionId;
            } else {
                if ($returnTransaction->statusLog[0]->status == 'Cancelled') {
                    print "Transaction not approved \n";
                    print "Reason code is: ";
                    print $returnTransaction->statusLog[0]->creditCardStatus->authCode;
                    print "\n";
                } else {
                    print "Error: Unexpected transaction status\n";
                }
            }
        } else {
            if ($response['returnCode'] == "202") {
                print "Transaction cannot be processed due to taxes being temporarily unavailable\n";
            } else {
                if ($response['returnCode'] == "400") {
                    print "Transaction cannot be processed due to data validation error\n";
                } else {
                    if ($response['returnCode'] == "402") {
                        print "Transaction cannot be processed due to transaction error\n";
                    } else {
                        if ($response['returnCode'] == "409") {
                            print "Transaction cannot be processed due to Failed AVS and CVN policy evaluation\n";
                        } else {
                            if ($response['returnCode'] == "410") {
                                print "Transaction cannot be processed due to not being able to perform AVS and CVN policy evaluation\n";
                            } else {
                                print "Error while making call to Vindicia CashBox\n";
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:74,代码来源:PrepayNonRecurringSubscriptionWithNewNonRecurringSubscription.php

示例6: createTransaction

function createTransaction($account, $merchantPaymentMethodId, $merchantTransactionId)
{
    #-----------------------------------------------------------------------------------
    # Process Transaction, setting Line Items so they will be helpful in providing
    # a clear indication of what was being purchased, the cost per item and the
    # price for each item, to be used for the first step in collecting information
    # needed for Chargeback defense.
    #
    # 1) Line Item Detail (at time of transaction):
    #
    # a) Line Item Detail for One Time Transactions:
    #
    # First, note that at the time of the transaction, you are already logging Line Item
    # information in TransactionItem entries on the Transaction in realtime.
    #
    # This function demonstrates setting of these Line Items in preparation for use as
    # part of Chargeback defense, used in conjunction with the Activity Reporting which
    # is subsequent sent to CashBox once Usage by the Cardholder has occurred.
    #
    #-----------------------------------------------------------------------------------
    $transaction = new Transaction();
    $transaction->setCurrency('USD');
    # Specify Account to use:
    $transaction->setAccount($account);
    # Specify PaymentMethod to use:
    # use a sparse local PaymentMethod object, only specify an identifier for CashBox
    # to locate existing PaymentMethod:
    $pm = new PaymentMethod();
    $pm->setMerchantPaymentMethodId($merchantPaymentMethodId);
    $transaction->setSourcePaymentMethod($pm);
    # Specify merchantTransactionId to use:
    $transaction->setMerchantTransactionId($merchantTransactionId);
    # Considerations for Line Time Detail:
    #
    # 1) Descriptive name for the Product/SKU, ideally readable text clearly indicating:
    #		- Product name
    #		- Duration it is valid
    #		- What the Product/SKU applies to
    #
    # 2) Description field, set in the API as TransactionItem.name field, indicating:
    #		- How much it cost for 1 item
    #		- For what period the purchase is applicable
    #		- League or other identifying information.
    #
    # 3) Quantity should show how many were purchased.
    # 4) The Amount for a single unit should be indicated in the Line Item.
    #
    # This will result in CashBox automatically setting the Transaction Amount to be
    # the total of the extended price for each Line Item from the product of Quantity
    # & Amount from each Line Item.
    # Use a single Line Item for this sample:
    $tx_lineItem0 = new TransactionItem();
    $tx_lineItem0->setSku('WIDGET200');
    # 1) Descriptive name
    $tx_lineItem0->setName('600 Widgets ($3.30 for 200)');
    # 2) Description field
    $tx_lineItem0->setQuantity('3');
    # 3) Quantity: how many were purchased
    $tx_lineItem0->setPrice('3.30');
    # 4) Amount for a single unit
    # CashBox automatically computes extended price (3 X $3.30) & sets the
    # Transaction amount to be the result, $9.90.
    # Campaign Code can be assigned to each individual line item:
    # $transaction_lineItem0->setCampaignCode('promo2');
    $lineitems = array($tx_lineItem0);
    $transaction->setTransactionItems($lineitems);
    # we can choose to send email for one-time transactions, or not
    $sendEmailNotification = true;
    # use the default CashBox AVS and CVN policy
    $ignoreAvsPolicy = false;
    $ignoreCvnPolicy = false;
    # Campaign Code can also be passed in to the call as a param to apply to all eligible items
    $campaign = '';
    # 'promo2';
    $dryrun = false;
    $response = $transaction->authCapture($sendEmailNotification, $ignoreAvsPolicy, $ignoreCvnPolicy, $campaign, $dryrun);
    print_r($response);
    $return_code = $response['returnCode'];
    print "Transaction.authCapture Return Code is: {$return_code} \n";
    $return_string = $response['returnString'];
    print "Transaction.authCapture Return String is: {$return_string} \n";
    $txAuthCapture_SoapId = $response['data']->return->soapId;
    print "Transaction.authCapture soapId: " . $txAuthCapture_SoapId . PHP_EOL . PHP_EOL;
    $txStatus = $response['data']->transaction->statusLog[0];
    $status = $txStatus->status;
    print "Transaction.authCapture status: " . $status . PHP_EOL;
    $vinAVS = $txStatus->vinAVS;
    print "Transaction.authCapture vinAVS: " . $vinAVS . PHP_EOL;
    $ccStatus = $txStatus->creditCardStatus;
    print_r($ccStatus);
    $authCode = $ccStatus->authCode;
    print "Transaction.authCapture authCode: " . $authCode . PHP_EOL;
    $avsCode = $ccStatus->avsCode;
    print "Transaction.authCapture avsCode: " . $avsCode . PHP_EOL;
    $cvnCode = $ccStatus->cvnCode;
    print "Transaction.authCapture cvnCode: " . $cvnCode . PHP_EOL;
    $extendedCardAttributes = $ccStatus->extendedCardAttributes;
    print "Transaction.authCapture extendedCardAttributes: " . PHP_EOL;
    print_r($extendedCardAttributes);
}
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:100,代码来源:UC-044_ActivityReporting.php

示例7: finalize_paypal_AutoBill_then_transaction_auth_capture_Transaction_Items

function finalize_paypal_AutoBill_then_transaction_auth_capture_Transaction_Items($vid)
{
    $autobill = new Autobill();
    $response = $autobill->finalizePayPalAuth($vid, true);
    if ($response['returnCode'] != '200') {
        print 'Error finalizing autobill' . PHP_EOL;
        print 'Soap Id = ' . $response['data']->return->soapId . PHP_EOL;
        print 'Return Code = ' . $response['returnCode'] . PHP_EOL;
        print 'Return String = ' . $response['returnString'] . PHP_EOL;
    } else {
        // You can obtain the paypal payer email address from the return object if you desire to persist this.
        $response_object = $response['data'];
        $auth_status = $response_object->authStatus;
        $payPalEmail = $auth_status->payPalStatus->paypalEmail;
        print 'Successfully paid for by ' . $payPalEmail;
        //Get info from autobill transaction for use processing remaining cart items
        $autobill = $response['data']->autobill;
        $account = $autobill->account;
        $paymentMethod = $autobill->paymentMethod;
        $transaction = new Transaction();
        $transaction->setCurrency('USD');
        $transaction->setSourcePaymentMethod($paymentMethod);
        $transaction->setAccount($account);
        $transaction->setShippingAddress($account->shippingAddress);
        // loop through the cart on server side to add items.
        $transaction_lineitem1 = new TransactionItem();
        $transaction_lineitem1->setSku('club cover');
        $transaction_lineitem1->setName('club cover');
        $transaction_lineitem1->setPrice('4.99');
        $transaction_lineitem1->setQuantity('1');
        $transaction_lineitem2 = new TransactionItem();
        $transaction_lineitem2->setSku('shipping');
        $transaction_lineitem2->setName('shipping');
        $transaction_lineitem2->setPrice('5.00');
        $transaction_lineitem2->setQuantity('1');
        $transaction_lineitem2->setTaxClassification('NT');
        $lineitems = array($transaction_lineitem1, $transaction_lineitem2);
        $transaction->setTransactionItems($lineitems);
        $billPayPalImmediately = new NameValuePair();
        $billPayPalImmediately->setName('vin:BillPayPalImmediately');
        $billPayPalImmediately->setValue('true');
        $autobillVID = new NameValuePair();
        $autobillVID->setName('vin:AutoBillVID');
        $autobillVID->setValue('none');
        $transaction->setNameValues(array($billPayPalImmediately, $autobillVID));
        $sendEmailNotification = false;
        $ignoreAvsPolicy = true;
        $ignoreCvnPolicy = true;
        $campaign = NULL;
        $dryrun = false;
        $response = $transaction->authCapture($sendEmailNotification, $ignoreAvsPolicy, $ignoreCvnPolicy, $campaign, $dryrun);
        if ($response['returnCode'] != '200') {
            print $response['returnCode'] . PHP_EOL;
            print $response['returnString'] . PHP_EOL;
        } else {
            print "returnCode=" . $response['returnCode'] . PHP_EOL;
            print "returnString=" . $response['returnString'] . PHP_EOL;
            if ($response['returnCode'] == "200") {
                $returnTransaction = $response['data']->transaction;
                if ($returnTransaction->statusLog[0]->status == 'Authorized') {
                    print "Transaction approved\n";
                    print "Transaction with id " . $returnTransaction->merchantTransactionId . " was successfully captured";
                    return $returnTransaction->merchantTransactionId;
                } else {
                    if ($returnTransaction->statusLog[0]->status == 'Cancelled') {
                        print "Transaction not approved \n";
                        print "Reason code is: ";
                        print $returnTransaction->statusLog[0]->creditCardStatus->authCode;
                        print "\n";
                    } else {
                        print "Error: Unexpected transaction status\n";
                    }
                }
            } else {
                if ($response['returnCode'] == "202") {
                    print "Transaction cannot be processed due to taxes being temporarily unavailable\n";
                } else {
                    if ($response['returnCode'] == "400") {
                        print "Transaction cannot be processed due to data validation error\n";
                    } else {
                        if ($response['returnCode'] == "402") {
                            print "Transaction cannot be processed due to transaction error\n";
                        } else {
                            if ($response['returnCode'] == "409") {
                                print "Transaction cannot be processed due to Failed AVS and CVN policy evaluation\n";
                            } else {
                                if ($response['returnCode'] == "410") {
                                    print "Transaction cannot be processed due to not being able to perform AVS and CVN policy evaluation\n";
                                } else {
                                    print "Error while making call to Vindicia CashBox\n";
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:99,代码来源:HybridCheckout.php

示例8: rand

<?php

require_once 'Vindicia/Soap/Vindicia.php';
require_once 'Vindicia/Soap/Const.php';
$testId = rand(1, 1000000);
// random number for some unique IDs
$tx = new Transaction();
$tx->setMerchantTransactionId('DRYRUN-' . $testId);
$acct = new Account();
$acct->setMerchantAccountId('jdoe101');
// existing customer account ID
$tx->setAccount($acct);
$tx->setCurrency('USD');
$txItem1 = new TransactionItem();
$txItem1->setSku('ppv-movie-us-prem');
$txItem1->setName('Premium Pay-per-view movie (English)');
$txItem1->setPrice(5.99);
$txItem1->setQuantity(1);
$txItem1->setTaxClassification('DM030000');
$txItem1->setCampaignCode('PPV2015US');
$txItem2 = new TransactionItem();
$txItem2->setSku('smAccess2015');
$txItem2->setName('Social Media Chat Access');
$txItem2->setPrice(2.0);
$txItem2->setQuantity(1);
$txItem2->setTaxClassification('D0000000');
$tx->setTransactionItems(array($txItem1, $txItem2));
$addr = new Address();
$addr->setAddr1('809 Cuesta Dr');
$addr->setCity('Mountain View');
$addr->setDistrict('CA');
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:31,代码来源:dryRunOneTimeTransaction.php


注:本文中的Transaction::setAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。