@@ -26,7 +26,7 @@ This SDK provides a tree of objects for guide you about to craft the checkout mo
26
26
/*
27
27
* Merchant model
28
28
*/
29
- $merchant = new Aplazame\BusinessModel\Merchant ();
29
+ $merchant = new stdClass ();
30
30
$merchant->confirmation_url = "/confirm"; // url that the JS client sent to confirming the order.
31
31
$merchant->cancel_url = "/cancel"; // url that the customer is sent to if there is an error in the checkout.
32
32
$merchant->success_url = "/success"; // url that the customer is sent to after confirming their order.
@@ -36,17 +36,17 @@ $merchant->checkout_url = "/checkout"; // url that the customer is sent to if
36
36
/*
37
37
* Article model
38
38
*/
39
- $article = new Aplazame\BusinessModel\Article ();
40
- $article->id = "89793238462643383279"; // The article ID.
41
- $article->name = "Reloj en oro blanco de 18 quilates y diamantes"; // Article name.
42
- $article->url = "http://shop.example.com/product.html"; // Article url.
43
- $article->image_url = "http://shop.example.com/product_image.png"; // Article image url.
44
- $article->quantity = 2; // Article quantity.
45
- $article->price = Aplazame\BusinessModel \Decimal::fromFloat(4020.00); // Article price (tax is not included). (4,020.00 €)
46
- $article->description = "Movimiento de cuarzo de alta precisión"; // Article description.
47
- $article->tax_rate = Aplazame\BusinessModel \Decimal::fromFloat(21.00); // Article tax rate. (21.00%)
48
- $article->discount = Aplazame\BusinessModel \Decimal::fromFloat(5.00); // The discount amount of the article. (5.00 €)
49
- $article->discount_rate = Aplazame\BusinessModel \Decimal::fromFloat(2.00); // The rate discount of the article. (2.00 %)
39
+ $article = new stdClass ();
40
+ $article->id = "89793238462643383279"; // The article ID.
41
+ $article->name = "Reloj en oro blanco de 18 quilates y diamantes"; // Article name.
42
+ $article->url = "http://shop.example.com/product.html"; // Article url.
43
+ $article->image_url = "http://shop.example.com/product_image.png"; // Article image url.
44
+ $article->quantity = 2; // Article quantity.
45
+ $article->price = Aplazame\Serializer \Decimal::fromFloat(4020.00); // Article price (tax is not included). (4,020.00 €)
46
+ $article->description = "Movimiento de cuarzo de alta precisión"; // Article description.
47
+ $article->tax_rate = Aplazame\Serializer \Decimal::fromFloat(21.00); // Article tax rate. (21.00%)
48
+ $article->discount = Aplazame\Serializer \Decimal::fromFloat(5.00); // The discount amount of the article. (5.00 €)
49
+ $article->discount_rate = Aplazame\Serializer \Decimal::fromFloat(2.00); // The rate discount of the article. (2.00 %)
50
50
51
51
// ... rest of articles in the shopping cart.
52
52
@@ -59,21 +59,21 @@ $articles = array( $article, ... );
59
59
/*
60
60
* Order model
61
61
*/
62
- $order = new Aplazame\BusinessModel\Order ();
63
- $order->id = "28475648233786783165"; // Your order ID.
64
- $order->currency = "EUR"; // Currency code of the order.
65
- $order->tax_rate = Aplazame\BusinessModel \Decimal::fromFloat(21.00); // Order tax rate. (21.00%)
66
- $order->total_amount = Aplazame\BusinessModel \Decimal::fromFloat(4620.00); // Order total amount. (4,620.00 €)
67
- $order->articles = $articles; // Articles in cart.
68
- $order->discount = Aplazame\BusinessModel \Decimal::fromFloat(160.00); // The discount amount of the order. (160.00 €)
69
- $order->discount_rate = Aplazame\BusinessModel \Decimal::fromFloat(2.00); // The rate discount of the order. (2.00 %)
70
- $order->cart_discount = Aplazame\BusinessModel \Decimal::fromFloat(0.50); // The discount amount of the cart. (0.50 €)
71
- $order->cart_discount_rate = Aplazame\BusinessModel \Decimal::fromFloat(3.00); // The rate discount of the cart. (3.00 %)
62
+ $order = new stdClass ();
63
+ $order->id = "28475648233786783165"; // Your order ID.
64
+ $order->currency = "EUR"; // Currency code of the order.
65
+ $order->tax_rate = Aplazame\Serializer \Decimal::fromFloat(21.00); // Order tax rate. (21.00%)
66
+ $order->total_amount = Aplazame\Serializer \Decimal::fromFloat(4620.00); // Order total amount. (4,620.00 €)
67
+ $order->articles = $articles; // Articles in cart.
68
+ $order->discount = Aplazame\Serializer \Decimal::fromFloat(160.00); // The discount amount of the order. (160.00 €)
69
+ $order->discount_rate = Aplazame\Serializer \Decimal::fromFloat(2.00); // The rate discount of the order. (2.00 %)
70
+ $order->cart_discount = Aplazame\Serializer \Decimal::fromFloat(0.50); // The discount amount of the cart. (0.50 €)
71
+ $order->cart_discount_rate = Aplazame\Serializer \Decimal::fromFloat(3.00); // The rate discount of the cart. (3.00 %)
72
72
73
73
/*
74
74
* Customer address model
75
75
*/
76
- $customerAddress = new Aplazame\BusinessModel\Address ();
76
+ $customerAddress = new stdClass ();
77
77
$customerAddress->first_name = "John"; // Address first name.
78
78
$customerAddress->last_name = "Coltrane"; // Address last name.
79
79
$customerAddress->street = "Plaza del Angel nº10"; // Address street.
@@ -88,24 +88,24 @@ $customerAddress->address_addition = "Cerca de la plaza Santa Ana"; // Address a
88
88
/*
89
89
* Customer model
90
90
*/
91
- $customer = new Aplazame\BusinessModel\Customer ();
92
- $customer->id = "1618"; // Customer ID.
93
- $customer->email = "
[email protected] "; // The customer email.
94
- $customer->type = Aplazame\BusinessModel\Customer::TYPE_EXISTING ; // Customer type. Other options are: TYPE_GUEST and TYPE_NEW .
95
- $customer->gender = Aplazame\BusinessModel\Customer::GENDER_UNKNOWN ; // Customer gender. Other options are: GENDER_MALE, GENDER_FEMALE and GENDER_NOT_APPLICABLE .
96
- $customer->first_name = "John"; // Customer first name.
97
- $customer->last_name = "Coltrane"; // Customer last name.
98
- $customer->birthday = DateTime::createFromFormat(DateTime::ISO8601, "1990-08-21T13 :56:45+0000" ); // Customer birthday.
99
- $customer->language = "es"; // Customer language preferences.
100
- $customer->date_joined = DateTime::createFromFormat(DateTime::ISO8601, "2014-08-21T13 :56:45+0000" ); // A datetime designating when the customer account was created.
101
- $customer->last_login = DateTime::createFromFormat(DateTime::ISO8601, "2014-08-27T19 :57:56+0000" ); // A datetime of the customer last login.
102
- $customer->address = $customerAddress; // Customer address.
91
+ $customer = new stdClass ();
92
+ $customer->id = "1618"; // Customer ID.
93
+ $customer->email = "
[email protected] ";
// The customer email.
94
+ $customer->type = 'e' ; // Customer type, the choices are g:guest, n:new, e:existing .
95
+ $customer->gender = 0 ; // Customer gender, the choices are 0: not known, 1: male, 2:female, 3: not applicable .
96
+ $customer->first_name = "John"; // Customer first name.
97
+ $customer->last_name = "Coltrane"; // Customer last name.
98
+ $customer->birthday = Aplazame\Serializer\Date::fromDateTime(new DateTime( "1990-08-21 13 :56:45") ); // Customer birthday.
99
+ $customer->language = "es"; // Customer language preferences.
100
+ $customer->date_joined = Aplazame\Serializer\Date::fromDateTime(new DateTime( "2014-08-21 13 :56:45") ); // A datetime designating when the customer account was created.
101
+ $customer->last_login = Aplazame\Serializer\Date::fromDateTime(new DateTime( "2014-08-27 19 :57:56") ); // A datetime of the customer last login.
102
+ $customer->address = $customerAddress; // Customer address.
103
103
104
104
105
105
/*
106
106
* Billing address model
107
107
*/
108
- $billingAddress = new Aplazame\BusinessModel\Address ();
108
+ $billingAddress = new stdClass ();
109
109
$billingAddress->first_name = "Bill"; // Billing first name.
110
110
$billingAddress->last_name = "Evans"; // Billing last name.
111
111
$billingAddress->street = "Calle de Las Huertas 22"; // Billing street.
@@ -121,28 +121,28 @@ $billingAddress->address_addition = "Cerca de la pizzería"; // Billing address
121
121
/*
122
122
* Shipping info model
123
123
*/
124
- $shippingInfo = new Aplazame\BusinessModel\Address ();
125
- $shippingInfo->first_name = "Django"; // Shipping first name.
126
- $shippingInfo->last_name = "Reinhard"; // Shipping last name.
127
- $shippingInfo->street = "Plaza del Angel nº10"; // Shipping street.
128
- $shippingInfo->city = "Madrid"; // Shipping city.
129
- $shippingInfo->state = "Madrid"; // Shipping state.
130
- $shippingInfo->country = "ES"; // Shipping country code.
131
- $shippingInfo->postcode = "28012"; // Shipping postcode.
132
- $shippingInfo->name = "Planet Express"; // Shipping name.
133
- $shippingInfo->price = Aplazame\BusinessModel \Decimal::fromFloat(5.00); // Shipping price (tax is not included). (5.00 €)
134
- $shippingInfo->phone = "616123456"; // Shipping phone number.
135
- $shippingInfo->alt_phone = "+34917909930"; // Shipping alternative phone.
136
- $shippingInfo->address_addition = "Cerca de la plaza Santa Ana"; // Shipping address addition.
137
- $shippingInfo->tax_rate = Aplazame\BusinessModel \Decimal::fromFloat(21.00); // Shipping tax rate. (21.00%)
138
- $shippingInfo->discount = Aplazame\BusinessModel \Decimal::fromFloat(1.00); // The discount amount of the shipping. (1.00 €)
139
- $shippingInfo->discount_rate = Aplazame\BusinessModel \Decimal::fromFloat(2.00); // The rate discount of the shipping. (2.00 %)
124
+ $shippingInfo = new stdClass ();
125
+ $shippingInfo->first_name = "Django"; // Shipping first name.
126
+ $shippingInfo->last_name = "Reinhard"; // Shipping last name.
127
+ $shippingInfo->street = "Plaza del Angel nº10"; // Shipping street.
128
+ $shippingInfo->city = "Madrid"; // Shipping city.
129
+ $shippingInfo->state = "Madrid"; // Shipping state.
130
+ $shippingInfo->country = "ES"; // Shipping country code.
131
+ $shippingInfo->postcode = "28012"; // Shipping postcode.
132
+ $shippingInfo->name = "Planet Express"; // Shipping name.
133
+ $shippingInfo->price = Aplazame\Serializer \Decimal::fromFloat(5.00); // Shipping price (tax is not included). (5.00 €)
134
+ $shippingInfo->phone = "616123456"; // Shipping phone number.
135
+ $shippingInfo->alt_phone = "+34917909930"; // Shipping alternative phone.
136
+ $shippingInfo->address_addition = "Cerca de la plaza Santa Ana"; // Shipping address addition.
137
+ $shippingInfo->tax_rate = Aplazame\Serializer \Decimal::fromFloat(21.00); // Shipping tax rate. (21.00%)
138
+ $shippingInfo->discount = Aplazame\Serializer \Decimal::fromFloat(1.00); // The discount amount of the shipping. (1.00 €)
139
+ $shippingInfo->discount_rate = Aplazame\Serializer \Decimal::fromFloat(2.00); // The rate discount of the shipping. (2.00 %)
140
140
141
141
142
142
/*
143
143
* Checkout model
144
144
*/
145
- $checkout = new Aplazame\BusinessModel\Checkout ();
145
+ $checkout = new stdClass ();
146
146
$checkout->toc = true;
147
147
$checkout->merchant = $merchant;
148
148
$checkout->order = $order;
@@ -154,7 +154,7 @@ $checkout->shipping = $shippingInfo;
154
154
In your view you will need to put an snippet similar to this one.
155
155
``` html
156
156
<script >
157
- aplazame .checkout ( < ? php echo json_encode ($checkout- > jsonSerialize ( )); ? > );
157
+ aplazame .checkout ( < ? php echo json_encode (Aplazame\Serializer\JsonSerializer :: serializeValue ( $checkout)); ? > );
158
158
< / script>
159
159
` ` `
160
160
0 commit comments