Laravel 5.4上的Moneris循环支付网关

时间:2018-03-13 15:14:05

标签: api

我已经阅读了Moneris文档,他们提供了直截了当的API。我正在尝试定期付款,但无法理解如何获取以前转换特定客户的DataKeys。这里是我为购买而编写的,其中DateKey用作演示Moneris Payment文档中的静态。但我无法获取我的客户端data_key,我们如何获得dataKey请帮助我!如果此代码不好,请告诉我更好的解决方案。

/ ************************交易变数******************** ********** /

    $data_key='FjhVlt4020HAVSaOmnaaPACpJ';
    $orderid='ord-'.date("dmy-G:i:s");
    $amount='1.00';
    $custid='test';
    $crypt_type='1';
    $commcard_invoice='Invoice 123';
    $commcard_tax_amount='1.00';

    /************************** CVD Variables *****************************/

    $cvd_indicator = '1';
    $cvd_value = '198';

    /********************** CVD Associative Array *************************/

    $cvdTemplate = array(
                         'cvd_indicator' => $cvd_indicator,
                         'cvd_value' => $cvd_value
                        );

    $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

    /************************** Recur Variables *****************************/

    $recurUnit = 'day';
    $startDate = '2018/04/09';
    $numRecurs = '4';
    $recurInterval = '10';
    $recurAmount = '09.00';
    $startNow = 'true';

    /****************************** Recur Array **************************/

    $recurArray = array('recur_unit'=>$recurUnit,  // (day | week | month)
                        'start_date'=>$startDate, //yyyy/mm/dd
                        'num_recurs'=>$numRecurs,
                        'start_now'=>$startNow,
                        'period' => $recurInterval,
                        'recur_amount'=> $recurAmount
                        );

    $mpgRecur = new mpgRecur($recurArray);

    /************************ Transaction Array **********************************/

    $txnArray=array('type'=>'res_purchase_cc',  
                    'data_key'=>$data_key,
                    'order_id'=>$orderid,
                    'cust_id'=>$custid,
                    'amount'=>$amount,
                    'crypt_type'=>$crypt_type,
                    'commcard_invoice'=>$commcard_invoice,
                    'commcard_tax_amount'=>$commcard_tax_amount
                     );

    /************************ Transaction Object *******************************/

    $mpgTxn = new mpgTransaction($txnArray);
    $mpgTxn->setCvdInfo($mpgCvdInfo);
    $mpgTxn->setRecur($mpgRecur);

    /************************ Request Object **********************************/

    $mpgRequest = new mpgRequest($mpgTxn);
    $mpgRequest->setProcCountryCode("US"); //"CA" for sending transaction to Canadian environment
    $mpgRequest->setTestMode(true); //false or comment out this line for production transactions

    /************************ mpgHttpsPost Object ******************************/

    $mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);

    /************************ Response Object **********************************/

    $mpgResponse=$mpgHttpPost->getMpgResponse();
    // print_r($mpgResponse);
    print("\nDataKey = " . $mpgResponse->getDataKey());
    print("\nReceiptId = " . $mpgResponse->getReceiptId());
    print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
    print("\nResponseCode = " . $mpgResponse->getResponseCode());
    print("\nAuthCode = " . $mpgResponse->getAuthCode());
    print("\nMessage = " . $mpgResponse->getMessage());
    print("\nTransDate = " . $mpgResponse->getTransDate());
    print("\nTransTime = " . $mpgResponse->getTransTime());
    print("\nTransType = " . $mpgResponse->getTransType());
    print("\nComplete = " . $mpgResponse->getComplete());
    print("\nTransAmount = " . $mpgResponse->getTransAmount());
    print("\nCardType = " . $mpgResponse->getCardType());
    print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
    print("\nTimedOut = " . $mpgResponse->getTimedOut());
    print("\nAVSResponse = " . $mpgResponse->getAvsResultCode());
    print("\nRecurSuccess = " . $mpgResponse->getRecurSuccess());
    print("\nResSuccess = " . $mpgResponse->getResSuccess());
    print("\nPaymentType = " . $mpgResponse->getPaymentType());

    //----------------- ResolveData ------------------------------

    print("\n\nCust ID = " . $mpgResponse->getResDataCustId());
    print("\nPhone = " . $mpgResponse->getResDataPhone());
    print("\nEmail = " . $mpgResponse->getResDataEmail());
    print("\nNote = " . $mpgResponse->getResDataNote());
    print("\nMasked Pan = " . $mpgResponse->getResDataMaskedPan());
    print("\nExp Date = " . $mpgResponse->getResDataExpDate());
    print("\nCrypt Type = " . $mpgResponse->getResDataCryptType());
    print("\nAvs Street Number = " . $mpgResponse->getResDataAvsStreetNumber());
    print("\nAvs Street Name = " . $mpgResponse->getResDataAvsStreetName());
    print("\nAvs Zipcode = " . $mpgResponse->getResDataAvsZipcode()); 

1 个答案:

答案 0 :(得分:0)

我已经邮寄到MINDBODY API支持,他们回复了消息

“由于当前的API限制,当前没有过滤GetClasses REQUEST的当前选项。目前有必要解析RESPONSE所需的时间。”

时间没有过滤选项。

谢谢