o ckF[7@sddlZddlZddlmZddlmZddlmZddlZdgZ dZ ddZ d d Z d d Z d dZddZGdddeZdS)N)AWSQueryConnection)ResponseErrorFactory)ResponseFactory FPSConnection)actionresponsecCs"tD] }t||t||dq|SN)decorated_attrssetattrgetattr)functoattrr5/usr/lib/python3/dist-packages/boto/fps/connection.pyadd_attrs_from$srcfdd}|S)Ncs0fdd}djd|_t|dS)Ncs`t|jD]}||}t|dt|||d<t|d|j||d<q|g|Ri|S)NValuez.Value CurrencyCodez .CurrencyCode)filterhas_keypopr str currencycode)selfargskwfieldamount)fieldsr rrwrapper,s z3complex_amounts..decorator..wrapperz{0} Complex Amounts: {1}z, r )format__doc__joinrr r rr r decorator+s  z"complex_amounts..decoratorr)rr(rr&rcomplex_amounts*s  r)cr)Ncs>fdd}dddD}dj||_t|dS)Ncs\fdd}dtt|kr'dddD}dtdd |}t||iS) Ncst|ttj|kSr)lenrrxrrr>sz>requires..decorator..wrapper.. OR cSg|]}d|qS+r$.0grrr @z@requires..decorator..wrapper..z{0} requires {1} argument(s)rMethod)r*rr$r"r KeyError)rrhasgroupmessage)r groupsr-rr =s z,requires..decorator..wrapperr0cSr1r2r4r5rrrr8Er9z/requires..decorator..z{0} Required: {1}r!)r$r"r#r)r r r=r>r'rr(;s  zrequires..decoratorr)r>r(rr?rrequires9s r@cs&fdd}dj|_t|dS)Ncs|dt|i|S)NCallerReference) setdefaultuuiduuid4)rrr'rrr Nsz'needs_caller_reference..wrapperz2{0} Uses CallerReference, defaults to uuid.uuid4()r!)r"r#rr%rr'rneeds_caller_referenceLs  rEcr)Ncs|dp ttjjdtttj j dr%t tj j dfdd}|_ |_ d j|_|S)N_Responsecs|g|Ri|Srrrrrrr rrrr ^sz.api_action..decorator..wrapperzFPS {0} API call {1})r$mapr capitalize__name__splitrhasattrbotofpsrr rr"r#r%apirJrr(Xszapi_action..decoratorr)rSr(rrRr api_actionVs  rTcseZdZdZeZdZfddZddZe e de gde d d Z e d ge d d Ze dge ddZe d ge ddZe ddZe dge ddZe ddZe ddZe e ddge ddZe e d d!gd"d#Ze e d$e gd%e d&d'Ze e d$e gd%e d(d)Ze d ge d*d+Ze d$e gd,e d-d.Ze d/e gd0e d1d2Ze d3ge d4d5Ze d6gd7ge d8d9Ze d:d;ge dd?Ze d7ge d@dAZ e d7ge dBdCZ!e e dDe gdEe dFdGZ"e dHge dIdJZ#e e dKe gdLe dMdNZ$e dOge dPdQZ%e dOge dRdSZ&e e d/e dOge dTdUZ'e d7ge dVdWZ(Z)S)Xrz 2010-08-28USDcs6|d|j|_|ddtt|j|i|dS)Nrhostzfps.sandbox.amazonaws.com)rrrBsuperr__init__rI __class__rrrXms zFPSConnection.__init__cCsdgS)NrQr)rrrr_required_auth_capabilityrsz'FPSConnection._required_auth_capabilitySettlementAmount)CreditInstrumentIdzSettlementAmount.Value SenderTokenIdzSettlementAmount.CurrencyCodecK||||S)z Allows a caller to initiate a transaction that atomically transfers money from a sender's payment instrument to the recipient, while decreasing corresponding debt balance.  get_objectrrrrrrr settle_debtu zFPSConnection.settle_debt TransactionIdcKr_)z: Gets the latest status of a transaction. r`rbrrrget_transaction_statusz$FPSConnection.get_transaction_status StartDatecKr_)z> Returns transactions for a given date range. r`rbrrrget_account_activityrgz"FPSConnection.get_account_activitycKr_)z7 Returns all details of a transaction. r`rbrrrget_transactionrgzFPSConnection.get_transactioncC||i|S)z~ Returns the total outstanding balance for all the credit instruments for the given creditor account. r`rrrrrrget_outstanding_debt_balancergz*FPSConnection.get_outstanding_debt_balancePrepaidInstrumentIdcKr_)zP Returns the balance available on the given prepaid instrument. r`rbrrrget_prepaid_balancergz!FPSConnection.get_prepaid_balancecCrk)z Returns the total liability held by the given account corresponding to all the prepaid instruments owned by the account. r`rlrrrget_total_prepaid_liabilityrgz)FPSConnection.get_total_prepaid_liabilitycCrk)zJ Returns the account balance for an account in real time. r`rlrrrget_account_balancez!FPSConnection.get_account_balancePaymentInstruction TokenTypecKr_)z< Installs a payment instruction for caller. r`rbrrrinstall_payment_instructionz)FPSConnection.install_payment_instruction returnURL pipelineNamec  sd|jvrdpd}d|}d}d}|d|vsJd|d d d |d |jd dfddtfdd|D}dd}dd||||g}|j |} |d| fg7}| d||||S)zj Generate a signed URL for the Co-Branded service API given arguments as payload. sandboxzpayments-sandboxpaymentszauthorize.{0}.amazon.comz/cobranded-ui/actions/start) SingleUseMultiUse Recurring Recipient SetupPrepaid SetupPostpaid EditTokenrxzInvalid pipelineName HmacSHA2562)signatureMethodsignatureVersion callerKeycSs|durt|p dS)NrF)rr+rrrr.z(FPSConnection.cbui_url..cstj|ddS)N~)safe)urllibquoter+)safestrrrr.scsg|] \}}||fqSrrr6kv) safequoterrr8z*FPSConnection.cbui_url..cSsddd|DS)N&cSsg|] \}}|d|qS)=rrrrrr8rz...r4)prrrr.r GET signaturezhttps://{0}{1}?{2}) rVr"updaterBaws_access_key_idsorteditemsr$ _auth_handler sign_stringsort) rrryendpointbasevalidpipelinespayloadencoded canonicalrr)rrrcbui_urls&   zFPSConnection.cbui_urlTransactionAmount)r^TransactionAmount.ValueTransactionAmount.CurrencyCodecKr_)z Reserve API is part of the Reserve and Settle API conjunction that serve the purpose of a pay where the authorization and settlement have a timing difference. r`rbrrrreserverdzFPSConnection.reservecKr_)zY Allows calling applications to move money from a sender to a recipient. r`rbrrrpay zFPSConnection.paycKr_)zP Cancels an ongoing transaction and puts it in cancelled state. r`rbrrrcancelrgzFPSConnection.cancel)ReserveTransactionIdrrcKr_)z The Settle API is used in conjunction with the Reserve API and is used to settle previously reserved transaction. r`rbrrrsettlerzFPSConnection.settle RefundAmount)reRefundAmount.ValuerAzRefundAmount.CurrencyCodecKr_)z= Refunds a previously completed transaction. r`rbrrrrefund szFPSConnection.refundRecipientTokenIdcKr_)z/ Returns the recipient status. r`rbrrr!get_recipient_verification_statusrgz/FPSConnection.get_recipient_verification_statusrATokenIdcKr_)z Returns the details of a particular token installed by this calling application using the subway co-branded UI. r`rbrrrget_token_by_callerrvz!FPSConnection.get_token_by_caller UrlEndPointHttpParameterscKr_)zM Verify the signature that FPS sent in IPN or callback urls. r`rbrrrverify_signature(rgzFPSConnection.verify_signaturecKr_)zJ Returns a list of tokens installed on the given account. r`rbrrr get_tokens0rrzFPSConnection.get_tokenscKr_)z/ Returns the usage of a token. r`rbrrrget_token_usage7rgzFPSConnection.get_token_usagecKr_)zd Cancels any token installed by the calling application on its own account. r`rbrrr cancel_token?rvzFPSConnection.cancel_token FundingAmount)rnzFundingAmount.Valuer^zFundingAmount.CurrencyCodecKr_)zL Funds the prepaid balance on the given prepaid instrument. r`rbrrr fund_prepaidHrzFPSConnection.fund_prepaidr]cKr_)zS Returns the balance corresponding to the given credit instrument. r`rbrrrget_debt_balanceSrgzFPSConnection.get_debt_balanceAdjustmentAmount)r]zAdjustmentAmount.ValuezAdjustmentAmount.CurrencyCodecKr_)zu Allows a creditor to write off the debt balance accumulated partially or fully at any time. r`rbrrrwrite_off_debt[s zFPSConnection.write_off_debtSubscriptionIdcKr_)zF Returns the transactions for a given subscriptionID. r`rbrrr!get_transactions_for_subscriptiongrgz/FPSConnection.get_transactions_for_subscriptioncKr_)zQ Returns the details of Subscription for a given subscriptionID. r`rbrrrget_subscription_detailsorgz&FPSConnection.get_subscription_detailscKs*d}d|vsd|vsJ|||||S)z) Cancels a subscription. z@If you specify a RefundAmount, you must specify CallerReference.rrAr`)rrrrr=rrrcancel_subscription_and_refundwsz,FPSConnection.cancel_subscription_and_refundcKr_)z: Gets the payment instruction of a token. r`rbrrrget_payment_instructionrgz%FPSConnection.get_payment_instruction)*rM __module__ __qualname__ APIVersionr ResponseErrorrrXr[rEr)r@rTrcrfrirjrmrorprqrurrrrrrrrrrrrrrrrrrr __classcell__rrrYrrgs                               )rrCboto.connectionrboto.fps.exceptionrboto.fps.responserrP__all__r rr)r@rErTrrrrrs