Commit f7015bf5 authored by Ivan Belitskii's avatar Ivan Belitskii

Add profile access methods

parent 211e0863
......@@ -19,21 +19,13 @@ class DqBilling extends \Staskjs\SimpleApi\SimpleJsonApi {
}
public function pay(array $customerData, array $paymentData) {
$customer = [
'id' => $customerData['id']
];
$payment = [
'card_identifier' => $paymentData['card_identifier'],
'merchantSessionKey' => $paymentData['merchant_session_key'],
'description' => $paymentData['payment_type'],
'type' => $paymentData['payment_type'],
'amount' => $paymentData['amount'],
'currency' => $paymentData['currency'],
'save_card' => $paymentData['save_data'],
'applicationAlias' => $paymentData['application_alias']
];
$customer = array_only($customerData, ['id']);
$payment = array_only($paymentData, [
'card_identifier', 'merchantSessionKey', 'description',
'type', 'amount', 'currency', 'save_card', 'applicationAlias',
]);
return $this->request('POST', 'pay', [
'customer' => $customer,
'payment' => $payment,
......@@ -43,4 +35,20 @@ class DqBilling extends \Staskjs\SimpleApi\SimpleJsonApi {
public function getPaymentSession() {
return $this->request('GET', 'payment_session');
}
public function getClientProfiles($urn) {
return $this->request('GET', 'customers', ['urn' => $urn]);
}
public function getProfilePaymentCards($customerId) {
return $this->request('GET', "customers/{$customerId}/cards");
}
public function saveProfile(array $profile) {
$profileData = array_only($profile, [
'urn', 'first_name', 'last_name', 'address_1', 'address_2',
'country', 'city', 'postal_code', 'state', 'id'
]);
return $this->request('POST', 'customers', $profileData);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment