static function PaymentGenerate::payment in Payment 7
Generate a payment.
Parameters
PaymentMethod $payment_method:
integer $uid:
Return value
File
- ./
payment.generate.inc, line 45 - Contains functions for generating content and configuration.
Class
- PaymentGenerate
- Content and configuration generation.
Code
static function payment(PaymentMethod $payment_method, $uid = 1) {
$payment = new Payment(array(
'currency_code' => 'XXX',
'description' => 'This is the payment description',
'finish_callback' => 'payment_generate_finish_callback',
'method' => $payment_method,
'uid' => $uid,
));
$payment
->setLineItem(new PaymentLineItem(array(
'amount' => 1.23,
'description' => 'This is the line item description',
'name' => 'payment-generate-1',
'quantity' => 3,
)));
$payment
->setLineItem(new PaymentLineItem(array(
'amount' => 4.56,
'description' => 'This is the line item description',
'name' => 'payment-generate-2',
'tax_rate' => 0.78,
)));
return $payment;
}