Class Mage_Paypal_Model_Api_Nvp
NVP API wrappers model
- Varien_Object
- Mage_Paypal_Model_Api_Abstract
- Mage_Paypal_Model_Api_Nvp
Direct known subclasses
Mage_PaypalUk_Model_Api_NvpCopyright: Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
License: Open Software License (OSL 3.0)
TODO:: move some parts to abstract, don't hesitate to throw exceptions on api calls
Located at code/core/Mage/Paypal/Model/Api/Nvp.php
public
string
|
|
public
string
|
|
public
string
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
callGetRecurringPaymentsProfileDetails( Varien_Object $result )
GetRecurringPaymentsProfileDetails call |
public
Varien_Object
|
#
prepareShippingOptionsCallbackAddress( array $request )
Import callback request array into $this public data |
public
string
|
|
protected
array
|
|
public
array
|
|
public
|
|
protected
|
|
protected
boolean|
|
|
protected
boolean
|
|
protected
array
|
|
protected
true|null
|
#
_exportLineItems( array & $request, integer $i = 0 )
NVP doesn't support passing discount total as a separate amount - add it as a line item |
protected
|
|
protected
|
#
_applyStreetAndRegionWorkarounds( Varien_Object $address )
Adopt specified address object to be compatible with Magento |
protected
|
#
_applyCountryWorkarounds( array & $request )
Adopt specified request array to be compatible with Paypal Puerto Rico should be as state of USA and not as a country |
protected
array
|
|
protected
string
|
|
protected
mixed
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string|null
|
#
_filterPaymentStatusFromNvpToInfo( string $value )
Convert payment status from NVP format to paypal/info model format |
protected
string|null
|
|
protected
string|null
|
|
protected
|
#
_analyzeRecurringProfileStatus( string $value, Varien_Object $result )
Check the obtained RP status in NVP format and specify the profile state |
protected
string
|
|
protected
array
|
#
_prepareEachCallRequest( string $methodName )
Return each call request without unused fields in case of Express Checkout Unilateral payments |
protected
|
#
_prepareExpressCheckoutCallRequest( &array & $requestFields )
Check the EC request against unilateral payments mode and remove the SUBJECT if needed |
string |
DO_DIRECT_PAYMENT
|
'DoDirectPayment' |
#
Paypal methods definition |
string |
DO_CAPTURE
|
'DoCapture' |
|
string |
DO_AUTHORIZATION
|
'DoAuthorization' |
|
string |
DO_VOID
|
'DoVoid' |
|
string |
REFUND_TRANSACTION
|
'RefundTransaction' |
|
string |
SET_EXPRESS_CHECKOUT
|
'SetExpressCheckout' |
|
string |
GET_EXPRESS_CHECKOUT_DETAILS
|
'GetExpressCheckoutDetails' |
|
string |
DO_EXPRESS_CHECKOUT_PAYMENT
|
'DoExpressCheckoutPayment' |
|
string |
CALLBACK_RESPONSE
|
'CallbackResponse' |
|
string |
PENDING_TRANSACTION_ACCEPT
|
'Accept' |
#
Paypal ManagePendingTransactionStatus actions |
string |
PENDING_TRANSACTION_DENY
|
'Deny' |
protected
string
|
$_captureTypeComplete | 'Complete' |
#
Capture types (make authorization close or remain open) |
protected
string
|
$_captureTypeNotcomplete | 'NotComplete' |
|
protected
array
|
$_globalMap | array(
// each call
'VERSION' => 'version',
'USER' => 'api_username',
'PWD' => 'api_password',
'SIGNATURE' => 'api_signature',
'BUTTONSOURCE' => 'build_notation_code',
// for Unilateral payments
'SUBJECT' => 'business_account',
// commands
'PAYMENTACTION' => 'payment_action',
'RETURNURL' => 'return_url',
'CANCELURL' => 'cancel_url',
'INVNUM' => 'inv_num',
'TOKEN' => 'token',
'CORRELATIONID' => 'correlation_id',
'SOLUTIONTYPE' => 'solution_type',
'GIROPAYCANCELURL' => 'giropay_cancel_url',
'GIROPAYSUCCESSURL' => 'giropay_success_url',
'BANKTXNPENDINGURL' => 'giropay_bank_txn_pending_url',
'IPADDRESS' => 'ip_address',
'NOTIFYURL' => 'notify_url',
'RETURNFMFDETAILS' => 'fraud_management_filters_enabled',
'NOTE' => 'note',
'REFUNDTYPE' => 'refund_type',
'ACTION' => 'action',
'REDIRECTREQUIRED' => 'redirect_required',
'SUCCESSPAGEREDIRECTREQUESTED' => 'redirect_requested',
'REQBILLINGADDRESS' => 'require_billing_address',
// style settings
'PAGESTYLE' => 'page_style',
'HDRIMG' => 'hdrimg',
'HDRBORDERCOLOR' => 'hdrbordercolor',
'HDRBACKCOLOR' => 'hdrbackcolor',
'PAYFLOWCOLOR' => 'payflowcolor',
'LOCALECODE' => 'locale_code',
'PAL' => 'pal',
// transaction info
'TRANSACTIONID' => 'transaction_id',
'AUTHORIZATIONID' => 'authorization_id',
'REFUNDTRANSACTIONID' => 'refund_transaction_id',
'COMPLETETYPE' => 'complete_type',
'AMT' => 'amount',
'ITEMAMT' => 'subtotal_amount',
'GROSSREFUNDAMT' => 'refunded_amount', // possible mistake, check with API reference
// payment/billing info
'CURRENCYCODE' => 'currency_code',
'PAYMENTSTATUS' => 'payment_status',
'PENDINGREASON' => 'pending_reason',
'PROTECTIONELIGIBILITY' => 'protection_eligibility',
'PAYERID' => 'payer_id',
'PAYERSTATUS' => 'payer_status',
'ADDRESSID' => 'address_id',
'ADDRESSSTATUS' => 'address_status',
'EMAIL' => 'email',
// backwards compatibility
'FIRSTNAME' => 'firstname',
'LASTNAME' => 'lastname',
// shipping rate
'SHIPPINGOPTIONNAME' => 'shipping_rate_code',
'NOSHIPPING' => 'suppress_shipping',
// paypal direct credit card information
'CREDITCARDTYPE' => 'credit_card_type',
'ACCT' => 'credit_card_number',
'EXPDATE' => 'credit_card_expiration_date',
'CVV2' => 'credit_card_cvv2',
'STARTDATE' => 'maestro_solo_issue_date', // MMYYYY, always six chars, including leading zero
'ISSUENUMBER' => 'maestro_solo_issue_number',
'CVV2MATCH' => 'cvv2_check_result',
'AVSCODE' => 'avs_result',
// cardinal centinel
'AUTHSTATUS3DS' => 'centinel_authstatus',
'MPIVENDOR3DS' => 'centinel_mpivendor',
'CAVV' => 'centinel_cavv',
'ECI3DS' => 'centinel_eci',
'XID' => 'centinel_xid',
'VPAS' => 'centinel_vpas_result',
'ECISUBMITTED3DS' => 'centinel_eci_result',
// recurring payment profiles
//'TOKEN' => 'token',
'SUBSCRIBERNAME' =>'subscriber_name',
'PROFILESTARTDATE' => 'start_datetime',
'PROFILEREFERENCE' => 'internal_reference_id',
'DESC' => 'schedule_description',
'MAXFAILEDPAYMENTS' => 'suspension_threshold',
'AUTOBILLAMT' => 'bill_failed_later',
'BILLINGPERIOD' => 'period_unit',
'BILLINGFREQUENCY' => 'period_frequency',
'TOTALBILLINGCYCLES' => 'period_max_cycles',
//'AMT' => 'billing_amount', // have to use 'amount', see above
'TRIALBILLINGPERIOD' => 'trial_period_unit',
'TRIALBILLINGFREQUENCY' => 'trial_period_frequency',
'TRIALTOTALBILLINGCYCLES' => 'trial_period_max_cycles',
'TRIALAMT' => 'trial_billing_amount',
// 'CURRENCYCODE' => 'currency_code',
'SHIPPINGAMT' => 'shipping_amount',
'TAXAMT' => 'tax_amount',
'INITAMT' => 'init_amount',
'FAILEDINITAMTACTION' => 'init_may_fail',
'PROFILEID' => 'recurring_profile_id',
'PROFILESTATUS' => 'recurring_profile_status',
'STATUS' => 'status',
//Next two fields are used for Brazil only
'TAXID' => 'buyer_tax_id',
'TAXIDTYPE' => 'buyer_tax_id_type',
'BILLINGAGREEMENTID' => 'billing_agreement_id',
'REFERENCEID' => 'reference_id',
'BILLINGAGREEMENTSTATUS' => 'billing_agreement_status',
'BILLINGTYPE' => 'billing_type',
'SREET' => 'street',
'CITY' => 'city',
'STATE' => 'state',
'COUNTRYCODE' => 'countrycode',
'ZIP' => 'zip',
'PAYERBUSINESS' => 'payer_business',
) |
#
Global public interface map |
protected
array
|
$_exportToRequestFilters | array(
'AMT' => '_filterAmount',
'ITEMAMT' => '_filterAmount',
'TRIALAMT' => '_filterAmount',
'SHIPPINGAMT' => '_filterAmount',
'TAXAMT' => '_filterAmount',
'INITAMT' => '_filterAmount',
'CREDITCARDTYPE' => '_filterCcType',
// 'PROFILESTARTDATE' => '_filterToPaypalDate',
'AUTOBILLAMT' => '_filterBillFailedLater',
'BILLINGPERIOD' => '_filterPeriodUnit',
'TRIALBILLINGPERIOD' => '_filterPeriodUnit',
'FAILEDINITAMTACTION' => '_filterInitialAmountMayFail',
'BILLINGAGREEMENTSTATUS' => '_filterBillingAgreementStatus',
'NOSHIPPING' => '_filterInt',
) |
#
Filter callbacks for preparing internal amounts to NVP request |
protected
array
|
$_importFromRequestFilters | array(
'REDIRECTREQUIRED' => '_filterToBool',
'SUCCESSPAGEREDIRECTREQUESTED' => '_filterToBool',
'PAYMENTSTATUS' => '_filterPaymentStatusFromNvpToInfo',
) |
#
Filter callbacks for importing API result to $this data |
protected
array
|
$_eachCallRequest | array('VERSION', 'USER', 'PWD', 'SIGNATURE', 'BUTTONSOURCE',) |
#
Request map for each API call |
protected
array
|
$_setExpressCheckoutRequest | array(
'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'RETURNURL', 'CANCELURL', 'INVNUM', 'SOLUTIONTYPE', 'NOSHIPPING',
'GIROPAYCANCELURL', 'GIROPAYSUCCESSURL', 'BANKTXNPENDINGURL',
'PAGESTYLE', 'HDRIMG', 'HDRBORDERCOLOR', 'HDRBACKCOLOR', 'PAYFLOWCOLOR', 'LOCALECODE',
'BILLINGTYPE', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT', 'REQBILLINGADDRESS',
) |
#
SetExpressCheckout request/response map |
protected
array
|
$_setExpressCheckoutResponse | array('TOKEN') |
|
protected
array
|
$_getExpressCheckoutDetailsRequest | array('TOKEN', 'SUBJECT',) |
#
GetExpressCheckoutDetails request/response map |
protected
array
|
$_doExpressCheckoutPaymentRequest | array(
'TOKEN', 'PAYERID', 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'IPADDRESS', 'BUTTONSOURCE', 'NOTIFYURL',
'RETURNFMFDETAILS', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT',
) |
#
DoExpressCheckoutPayment request/response map |
protected
array
|
$_doExpressCheckoutPaymentResponse | array(
'TRANSACTIONID', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON', 'REDIRECTREQUIRED'
) |
|
protected
array
|
$_doDirectPaymentRequest | array(
'PAYMENTACTION', 'IPADDRESS', 'RETURNFMFDETAILS',
'AMT', 'CURRENCYCODE', 'INVNUM', 'NOTIFYURL', 'EMAIL', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT',
'CREDITCARDTYPE', 'ACCT', 'EXPDATE', 'CVV2', 'STARTDATE', 'ISSUENUMBER',
'AUTHSTATUS3DS', 'MPIVENDOR3DS', 'CAVV', 'ECI3DS', 'XID',
) |
#
DoDirectPayment request/response map |
protected
array
|
$_doDirectPaymentResponse | array(
'TRANSACTIONID', 'AMT', 'AVSCODE', 'CVV2MATCH', 'VPAS', 'ECISUBMITTED3DS'
) |
|
protected
array
|
$_doReauthorizationRequest | array('AUTHORIZATIONID', 'AMT', 'CURRENCYCODE') |
#
DoReauthorization request/response map |
protected
array
|
$_doReauthorizationResponse | array(
'AUTHORIZATIONID', 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY'
) |
|
protected
array
|
$_doCaptureRequest | array('AUTHORIZATIONID', 'COMPLETETYPE', 'AMT', 'CURRENCYCODE', 'NOTE', 'INVNUM',) |
#
DoCapture request/response map |
protected
array
|
$_doCaptureResponse | array('TRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON',) |
|
protected
array
|
$_doAuthorizationRequest | array('TRANSACTIONID', 'AMT', 'CURRENCYCODE') |
#
DoAuthorization request/response map |
protected
array
|
$_doAuthorizationResponse | array('TRANSACTIONID', 'AMT') |
|
protected
array
|
$_doVoidRequest | array('AUTHORIZATIONID', 'NOTE',) |
#
DoVoid request map |
protected
array
|
$_getTransactionDetailsRequest | array('TRANSACTIONID') |
#
GetTransactionDetailsRequest |
protected
array
|
$_getTransactionDetailsResponse | array(
'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID', 'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT',
'PAYMENTSTATUS', 'PENDINGREASON',
) |
|
protected
array
|
$_refundTransactionRequest | array('TRANSACTIONID', 'REFUNDTYPE', 'CURRENCYCODE', 'NOTE',) |
#
RefundTransaction request/response map |
protected
array
|
$_refundTransactionResponse | array('REFUNDTRANSACTIONID', 'GROSSREFUNDAMT',) |
|
protected
array
|
$_managePendingTransactionStatusRequest | array('TRANSACTIONID', 'ACTION') |
#
ManagePendingTransactionStatus request/response map |
protected
array
|
$_managePendingTransactionStatusResponse | array('TRANSACTIONID', 'STATUS') |
|
protected
array
|
$_getPalDetailsResponse | array('PAL') |
#
GetPalDetails response map |
protected
array
|
$_createRecurringPaymentsProfileRequest | array(
'TOKEN', 'SUBSCRIBERNAME', 'PROFILESTARTDATE', 'PROFILEREFERENCE', 'DESC', 'MAXFAILEDPAYMENTS', 'AUTOBILLAMT',
'BILLINGPERIOD', 'BILLINGFREQUENCY', 'TOTALBILLINGCYCLES', 'AMT', 'TRIALBILLINGPERIOD', 'TRIALBILLINGFREQUENCY',
'TRIALTOTALBILLINGCYCLES', 'TRIALAMT', 'CURRENCYCODE', 'SHIPPINGAMT', 'TAXAMT', 'INITAMT', 'FAILEDINITAMTACTION'
) |
#
CreateRecurringPaymentsProfile request/response map |
protected
array
|
$_createRecurringPaymentsProfileResponse | array(
'PROFILEID', 'PROFILESTATUS'
) |
|
protected
array
|
$_manageRecurringPaymentsProfileStatusRequest | array('PROFILEID', 'ACTION') |
#
Request/response for ManageRecurringPaymentsProfileStatus map |
protected
array
|
$_getRecurringPaymentsProfileDetailsRequest | array('PROFILEID') |
#
Request/response for GetRecurringPaymentsProfileDetails |
protected
array
|
$_getRecurringPaymentsProfileDetailsResponse | array('STATUS', /* TODO: lot of other stuff */) |
|
protected
array
|
$_billingAddressMap | array (
'BUSINESS' => 'company',
'NOTETEXT' => 'customer_notes',
'EMAIL' => 'email',
'FIRSTNAME' => 'firstname',
'LASTNAME' => 'lastname',
'MIDDLENAME' => 'middlename',
'SALUTATION' => 'prefix',
'SUFFIX' => 'suffix',
'COUNTRYCODE' => 'country_id', // iso-3166 two-character code
'STATE' => 'region',
'CITY' => 'city',
'STREET' => 'street',
'STREET2' => 'street2',
'ZIP' => 'postcode',
'PHONENUM' => 'telephone',
) |
#
Map for billing address import/export |
protected
array
|
$_billingAddressMapRequest | array () |
#
Map for billing address to do request (not response) Merging with $_billingAddressMap |
protected
array
|
$_shippingAddressMap | array(
'SHIPTOCOUNTRYCODE' => 'country_id',
'SHIPTOSTATE' => 'region',
'SHIPTOCITY' => 'city',
'SHIPTOSTREET' => 'street',
'SHIPTOSTREET2' => 'street2',
'SHIPTOZIP' => 'postcode',
'SHIPTOPHONENUM' => 'telephone',
// 'SHIPTONAME' will be treated manually in address import/export methods
) |
#
Map for shipping address import/export (extends billing address mapper) |
protected
array
|
$_callbackRequestMap | array(
'SHIPTOCOUNTRY' => 'country_id',
'SHIPTOSTATE' => 'region',
'SHIPTOCITY' => 'city',
'SHIPTOSTREET' => 'street',
'SHIPTOSTREET2' => 'street2',
'SHIPTOZIP' => 'postcode'
) |
#
Map for callback request |
protected
array
|
$_paymentInformationResponse | array(
'PAYERID', 'PAYERSTATUS', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS',
'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', 'EMAIL', 'SHIPPINGOPTIONNAME', 'TAXID', 'TAXIDTYPE'
) |
#
Payment information response specifically to be collected after some requests |
protected
array
|
$_lineItemTotalExportMap | array(
Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL => 'ITEMAMT',
Mage_Paypal_Model_Cart::TOTAL_TAX => 'TAXAMT',
Mage_Paypal_Model_Cart::TOTAL_SHIPPING => 'SHIPPINGAMT',
) |
#
Line items export mapping settings |
protected
array
|
$_lineItemExportItemsFormat | array(
'id' => 'L_NUMBER%d',
'name' => 'L_NAME%d',
'qty' => 'L_QTY%d',
'amount' => 'L_AMT%d',
) |
#
Line items export to request mapping settings |
protected
array
|
$_shippingOptionsExportItemsFormat | array(
'is_default' => 'L_SHIPPINGOPTIONISDEFAULT%d',
'amount' => 'L_SHIPPINGOPTIONAMOUNT%d',
'code' => 'L_SHIPPINGOPTIONNAME%d',
'name' => 'L_SHIPPINGOPTIONLABEL%d',
'tax_amount' => 'L_TAXAMT%d',
) |
#
Shipping options export to request mapping settings |
protected
array
|
$_customerBillingAgreementRequest | array('RETURNURL', 'CANCELURL', 'BILLINGTYPE') |
#
init Billing Agreement request/response map |
protected
array
|
$_customerBillingAgreementResponse | array('TOKEN') |
|
protected
array
|
$_billingAgreementCustomerDetailsRequest | array('TOKEN') |
#
Billing Agreement details request/response map |
protected
array
|
$_billingAgreementCustomerDetailsResponse | array('EMAIL', 'PAYERID', 'PAYERSTATUS', 'SHIPTOCOUNTRYCODE',
'PAYERBUSINESS'
) |
|
protected
array
|
$_createBillingAgreementRequest | array('TOKEN') |
#
Create Billing Agreement request/response map |
protected
array
|
$_createBillingAgreementResponse | array('BILLINGAGREEMENTID') |
|
protected
array
|
$_updateBillingAgreementRequest | array(
'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM'
) |
#
Update Billing Agreement request/response map |
protected
array
|
$_updateBillingAgreementResponse | array(
'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM'
) |
|
protected
array
|
$_doReferenceTransactionRequest | array('REFERENCEID', 'PAYMENTACTION', 'AMT', 'ITEMAMT', 'SHIPPINGAMT',
'TAXAMT', 'INVNUM', 'NOTIFYURL'
) |
#
Do Reference Transaction request/response map |
protected
array
|
$_doReferenceTransactionResponse | array('BILLINGAGREEMENTID', 'TRANSACTIONID') |
|
protected
array
|
$_debugReplacePrivateDataKeys | array(
'ACCT', 'EXPDATE', 'CVV2', 'CARDISSUE', 'CARDSTART', 'CREDITCARDTYPE', 'USER', 'PWD', 'SIGNATURE'
) |
#
Fields that should be replaced in debug with '***' |
protected
array
|
$_supportedCcTypes | array(
'VI' => 'Visa', 'MC' => 'MasterCard', 'DI' => 'Discover', 'AE' => 'Amex', 'SM' => 'Maestro', 'SO' => 'Solo') |
#
Map of credit card types supported by this API |
protected
array
|
$_requiredResponseParams | array(
self::DO_DIRECT_PAYMENT => array('ACK', 'CORRELATIONID', 'AMT')
) |
#
Required fields in the response |
protected
array
|
$_callWarnings | array() |
#
Warning codes recollected after each API call |
protected
array
|
$_callErrors | array() |
#
Error codes recollected after each API call |
protected
boolean
|
$_rawResponseNeeded | false |
#
Whether to return raw response information after each call |
$_cart,
$_config,
$_lineItemExportItemsFilters,
$_recurringPaymentProfiles
|