def get_cbui_url( self, order_id, return_url, amount, reason_text=None, pipeline=CBUIPipeline.SingleUse, paymentMethod=[PaymentMethod.ABT, PaymentMethod.ACH, PaymentMethod.CC]): """ Generates a url for the Co-Branded User Interface pipeline. :param order_id: The id created by you that describes identifies the order. :param return_url: The URL that the sender will be redirected to once payment is complete. The query parameters will contain information about the status of the transaction. :param amount: The amount that the transaction is for. When using the SandboxAPI amounts where the decimal is between .60 and .89 can be used to simulate various error conditions. :param reason_text: Reason for the payment request. Will be shown to the sender on the CBUI checkout page. :param pipline: The CBUI Pipeline to use. The default is :py:obj:`flexpay.payment.CBUIPipeline.SingleUse` :param paymentMethod: A list of payment methods from the :py:class:`flexpay.payment.PaymentMethod` class. :Returns: URL to the Amazon Co-Branded User Interface. http://docs.aws.amazon.com/AmazonFPS/latest/FPSBasicGuide/SingleUsePipeline.html """ if not isinstance(pipeline, CBUIPipeline): raise TypeError( 'Argument pipeline should be an instance of CBUIPipeline.') # paymentMethod should be a list. if not isinstance(paymentMethod, list): paymentMethod = [paymentMethod] # Each element of the list should be an instance of PaymentMethod for pm in paymentMethod: if not isinstance(pm, PaymentMethod): raise TypeError( 'Argument paymentMethod should be a list of PaymentMethod instances.' ) params = { 'callerReference': order_id, 'currencyCode': self.currency_code, 'paymentMethod': ','.join(paymentMethod), 'transactionAmount': make_amount(amount), 'pipelineName': pipeline, 'returnURL': return_url, } if reason_text is not None: params['paymentReason'] = reason_text return params
def get_cbui_url(self, order_id, return_url, amount, reason_text = None, pipeline = CBUIPipeline.SingleUse, paymentMethod = [PaymentMethod.ABT, PaymentMethod.ACH, PaymentMethod.CC]): """ Generates a url for the Co-Branded User Interface pipeline. :param order_id: The id created by you that describes identifies the order. :param return_url: The URL that the sender will be redirected to once payment is complete. The query parameters will contain information about the status of the transaction. :param amount: The amount that the transaction is for. When using the SandboxAPI amounts where the decimal is between .60 and .89 can be used to simulate various error conditions. :param reason_text: Reason for the payment request. Will be shown to the sender on the CBUI checkout page. :param pipline: The CBUI Pipeline to use. The default is :py:obj:`flexpay.payment.CBUIPipeline.SingleUse` :param paymentMethod: A list of payment methods from the :py:class:`flexpay.payment.PaymentMethod` class. :Returns: URL to the Amazon Co-Branded User Interface. http://docs.aws.amazon.com/AmazonFPS/latest/FPSBasicGuide/SingleUsePipeline.html """ if not isinstance(pipeline, CBUIPipeline): raise TypeError('Argument pipeline should be an instance of CBUIPipeline.') # paymentMethod should be a list. if not isinstance(paymentMethod, list): paymentMethod = [ paymentMethod ] # Each element of the list should be an instance of PaymentMethod for pm in paymentMethod: if not isinstance(pm, PaymentMethod): raise TypeError('Argument paymentMethod should be a list of PaymentMethod instances.') params = { 'callerReference': order_id, 'currencyCode': self.currency_code, 'paymentMethod': ','.join(paymentMethod), 'transactionAmount': make_amount(amount), 'pipelineName': pipeline, 'returnURL': return_url, } if reason_text is not None: params['paymentReason'] = reason_text return params
def pay(self, order_id, sender_id, amount, charge_to='Recipient'): ''' http://docs.aws.amazon.com/AmazonFPS/latest/FPSAPIReference/Pay.html ''' params = { 'Action': 'Pay', 'ChargeFeeTo': charge_to, 'TransactionAmount.Value': make_amount(amount), 'TransactionAmount.CurrencyCode': self.currency_code, 'SenderTokenId': sender_id, 'CallerReference': order_id, } return params
def settle(self, transaction_id, amount=None): ''' http://docs.aws.amazon.com/AmazonFPS/latest/FPSAPIReference/Settle.html ''' params = { 'Action': 'Settle', 'ReserveTransactionId': transaction_id, } if amount != None: params['TransactionAmount.Value'] = make_amount(amount) params['TransactionAmount.CurrencyCode'] = self.currency_code return params
def reserve(self, order_id, sender_id, amount, charge_to = 'Recipient', description = None): ''' http://docs.aws.amazon.com/AmazonFPS/latest/FPSAPIReference/Reserve.html ''' params = { 'Action': 'Reserve', 'ChargeFeeTo': charge_to, 'TransactionAmount.Value': make_amount(amount), 'TransactionAmount.CurrencyCode': self.currency_code, 'SenderTokenId': sender_id, 'CallerReference': order_id, } if description != None: params['CallerDescription'] = description return params
def reserve(self, order_id, sender_id, amount, charge_to='Recipient', description=None): ''' http://docs.aws.amazon.com/AmazonFPS/latest/FPSAPIReference/Reserve.html ''' params = { 'Action': 'Reserve', 'ChargeFeeTo': charge_to, 'TransactionAmount.Value': make_amount(amount), 'TransactionAmount.CurrencyCode': self.currency_code, 'SenderTokenId': sender_id, 'CallerReference': order_id, } if description != None: params['CallerDescription'] = description return params
def refund(self, order_id, transaction_id, amount = None, refund_policy = 'MasterTxnOnly', description = None): ''' http://docs.aws.amazon.com/AmazonFPS/latest/FPSAPIReference/Refund.html ''' params = { 'Action': 'Pay', 'CallerReference': order_id, 'TransactionId': transaction_id, 'MarketplaceRefundPolicy': refund_policy, } if amount != None: params['RefundAmount.Value'] = make_amount(amount) params['RefundAmount.CurrencyCode'] = self.currency_code if description != None: params['CallerDescription'] = description return params
def refund(self, order_id, transaction_id, amount=None, refund_policy='MasterTxnOnly', description=None): ''' http://docs.aws.amazon.com/AmazonFPS/latest/FPSAPIReference/Refund.html ''' params = { 'Action': 'Pay', 'CallerReference': order_id, 'TransactionId': transaction_id, 'MarketplaceRefundPolicy': refund_policy, } if amount != None: params['RefundAmount.Value'] = make_amount(amount) params['RefundAmount.CurrencyCode'] = self.currency_code if description != None: params['CallerDescription'] = description return params